-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup colors in TestCase #441
Conversation
If not set up, "Typed static property Tester\Environment::$useColors must not be accessed before initialization in .../Framework/Environment.php:267" is thrown when `\Tester\Environment::setup()` is not called in the TestCase file.
I don't know if this is the right way either but I went with this patch because the default might not be "no colors" which is what setting public static bool $useColors = false; would do. The default may be "use colors" especially when using env vars like |
I don't think so.
fwrite(STDOUT, self::$useColors ? $s : Dumper::removeColors($s)); David will know more. I'm looking more closely into the guts for the first time :-) |
Yeah, this is the bug this PR is trying to fix 😊 |
I've fixed this by #442. Calling |
|
|
Thanks, that makes sense, adding the initial value is what fixes the original problem, understand the distinction now :-) This PR would fix the problem "just by the way", by changing something else, which doesn't indeed seem correct. |
If not set up, "Typed static property Tester\Environment::$useColors must not be accessed before initialization in .../Framework/Environment.php:267" is thrown when
\Tester\Environment::setup()
is not called in the TestCase-based test file.Without the patch:
With the patch:
Adding
\Tester\Environment::setup();
to the testcase file also fixes the problem, for example:But I believe calling it should not be necessary (I have seen the
Environment::setup()
notes in the README and the docs).I'm a Tester internals noob and am not sure if this is the right way, let me know if that's not the case. I've added the call because I've seen a similar call in here:
tester/src/Runner/CliTester.php
Line 31 in 869cb00