小编Bru*_*uno的帖子

PHPUnit自定义断言消息

我正在编写一个与PHPUnit一起使用的自定义断言,但每当我放置一个自定义断言时,我都会看到两(2)条错误消息.

代码:

$this->_testCase->assertThat(
    $hasMessageCode,
    $this->_testCase->isTrue(),
   "Failed asserting that API response contains a message whose code is {$code}."
);
Run Code Online (Sandbox Code Playgroud)

输出:

1) ApiTest::testFoo
Failed asserting that API response contains an error whose code is REG012.
Failed asserting that false is true.
Run Code Online (Sandbox Code Playgroud)

有什么办法我只能输出自定义信息并跳过第二个?

php phpunit

5
推荐指数
1
解决办法
389
查看次数

标签 统计

php ×1

phpunit ×1