为什么这个断言在运行phpunit时不会失败?

问题描述 投票:0回答:1

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

namespace AlaphantTest;

use PHPUnit\Framework\TestCase;
use Alaphant\Module;

class ModuleTest extends TestCase
{
    protected $module;

    public function setUp(){
        $this->module = new Module();
    }

    public function testIsValid(){
        $this->assertTrue(1==2);
    }
}
php phpunit
1个回答
0
投票

我无法复制此内容:

$ cat Test.php         
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

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.
© www.soinside.com 2019 - 2024. All rights reserved.