Add defined check for constants

When running tests in a separate process with @runInSeparateProcess, multiple constant definitions throw several PHP notices.