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
... to result in bad (mangled) output when using phpdbg, which then causes Nette Tester to think there are no test case methods, if there is only one, when using an anonymous class extending a \Tester\TestCase class.
Explanation
phpdbg and php interpreters differ in how they behave when echoing a string containing a NULL byte.
❌ ... when using phpdbg, this results in mangled output, like so:
NOTICE THIS -------------------++
||
VV
TestCase:Tester\TestCase@anonymousMethod:testMe
Dependency:/mnt/d/produkce/coding/php/php-nette-tester/anonclasstestcase.phpt
Dependency:/mnt/d/produkce/coding/php/php-nette-tester/src/Framework/TestCase.php
... which is incorrect (not expected) and information about the only test method is mixed on the line starting with TestCase: - thus the information about the only test method is lost. ❗
Version: 2.5.2, WSL (Ubuntu), but reproduced also in non-WSL Ubuntu.
Bug Description
tl;dr
When using
phpdbg
Nette Tester doesn't see the only test method defined in anonymous class which extends\Tester\TestCase
class.Slightly longer tl;dr
phpdbg
andphp
interpreters seem to differ in how they behave when echoing a string containing a NULL byte. This causes the code ...tester/src/Framework/TestCase.php
Lines 214 to 218 in 7fd3b98
phpdbg
, which then causes Nette Tester to think there are no test case methods, if there is only one, when using an anonymous class extending a\Tester\TestCase
class.Explanation
phpdbg
andphp
interpreters differ in how they behave when echoing a string containing a NULL byte.\0
NULL byte.php
somehow deals with (ignores?) the NULL byte, whilephpdbg
seems to stop the echo at that point.nullbyteclassname.php
with this content:php
phpdbg
phpdbg
echoes is not a complete class name. And the456\n
is also trimmed.TestCase::sendMethodList()
reports a list of test methods using this code:phpdbg
, this results in mangled output, like so:TestCase:
- thus the information about the only test method is lost. ❗php
does it like so:Steps To Reproduce
nette/tester
repo and install Composer dependencies.anonclasstestcase.phpt
in the repo's root dir:php
phpdbg
Expected Behavior
Even when using
phpdbg
Nette Tester should find the only test case method defined inside anonymous class which extends\Tester\TestCase
class.Possible Solution
It seems that preprocessing the result of
static::class
by removing"\0"
from it solves the problem.Possibly related:
The text was updated successfully, but these errors were encountered: