为什么这个断言在运行phpunit时没有失败?



为什么这在phpunit上没有显示错误?当我运行测试时,它不会标记断言错误。

namespace AlaphantTest;
use PHPUnitFrameworkTestCase;
use AlaphantModule;
class ModuleTest extends TestCase
{
protected $module;
public function setUp(){
$this->module = new Module();
}
public function testIsValid(){
$this->assertTrue(1==2);
}
}

我无法重现这个:

$ cat Test.php         
<?php declare(strict_types=1);
use PHPUnitFrameworkTestCase;
final class Test extends TestCase
{
public function testOne(): void
{
$this->assertTrue(1 == 2);
}
}
$ php phpunit-8.5.phar Test.php
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
F                                                                   1 / 1 (100%)
Time: 59 ms, Memory: 10.00 MB
There was 1 failure:
1) Test::testOne
Failed asserting that false is true.
/home/sb/Test.php:8
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

最新更新