You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some versions of PHPUnit (in my experience, 5.x for PHP 5.6), MyTest::defineInitialConstants() will be executed before the Constants::resetConstants() fixture, meaning the following steps happen in order:
The SOME_CONSTANT constant gets defined, and its name tracked in $_constants (implicitly creating the array structure)
Constants::resetConstants() executes, overwriting the $_constants property with a properly-formatted array
The test method executes, with SOME_CONSTANT defined as expected
The Constants::restoreConstants() fixture runs, but sees no constants in $_constants to restore and thus does nothing
If a fixture attempts to define a constant (or, once #11 and #12 are completed, a function/method), an error should be thrown if this occurs before the @before fixture has run.
The text was updated successfully, but these errors were encountered:
Ran into this on project that implements this library:
Imagine we have a test class that looks like this:
In some versions of PHPUnit (in my experience, 5.x for PHP 5.6),
MyTest::defineInitialConstants()
will be executed before theConstants::resetConstants()
fixture, meaning the following steps happen in order:SOME_CONSTANT
constant gets defined, and its name tracked in$_constants
(implicitly creating the array structure)Constants::resetConstants()
executes, overwriting the$_constants
property with a properly-formatted arraySOME_CONSTANT
defined as expectedConstants::restoreConstants()
fixture runs, but sees no constants in$_constants
to restore and thus does nothingIf a fixture attempts to define a constant (or, once #11 and #12 are completed, a function/method), an error should be thrown if this occurs before the
@before
fixture has run.The text was updated successfully, but these errors were encountered: