作者:巢i仔 | 来源:互联网 | 2023-02-07 14:08
这似乎只发生在我的系统上.没有其他人可以重现它.如果错误的消息太大(在我的情况下大约65k字节),屏幕上不会打印任何内容.我在Windows 7上使用PHP 7.1.3,默认的php.ini(内存限制设置为8gb)和默认的PHPUnit 6.0.13配置.错误不会出现在prompt和powershell中.
expected = $expected;
}
protected function matches($actual){
return false;
}
function failureDescription($other): string{
return "desc";
}
function toString(){
return "description";
}
function additionalFailureDescription($other): string{
return str_repeat("x", 100000);
// If set to a smaller dump, error will appear
// some people I asked to try could dump one million
// bytes without problems, while I can't print more
// than about 50k
}
}
class SomeTest extends TestCase
{
function testBigDump(){
TestCase::assertThat("irrelevant", new MyConstraint("irrelevant"));
}
}
?>
这就是我在屏幕上看到的:
Sebastian Bergmann和贡献者的PHPUnit 6.0.13.
运行时:PHPDBG 7.1.3配置:..............
F 1/1(100%)
时间:361毫秒,内存:6.00MB
有1次失败:
1)SomeTest :: testBigDump
<------- Notice no error description here
FAILURES!测试:1,断言:1,失败:1.
你知道是什么原因引起的吗?先感谢您.
1> Benjamin..:
你的配置中的东西是通过phpdbg运行phpunit测试
我重新创建了这个问题,尝试使用Windows 7 VM尽可能多地复制环境.
线索是Runtime: PHPDBG
你转储中的线.显然有关phpdbg运行时的东西会阻止大缓冲区正常工作.请参阅下面的输出,通过phpdbg.exe运行时的初始输出(缺少测试说明),然后通过php.exe运行(显然是截断的):
C:\project>phpdbg -r phpunit-6.1.0.phar -v test.php
[Welcome to phpdbg, the interactive PHP debugger, v0.5.0]
To get help using phpdbg type "help" and press enter
[Please report bugs to ]
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.
Runtime: PHPDBG 7.1.4
F 1 / 1 (100%)
Time: 99 ms, Memory: 22.00MB
There was 1 failure:
1) SomeTest::testBigDump
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
[Script ended normally]
C:\project>php phpunit-6.1.0.phar test.php
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 109 ms, Memory: 8.00MB
There was 1 failure:
1) SomeTest::testBigDump
Failed asserting that desc.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----- Snip -----