【发布时间】:2020-02-22 17:33:18
【问题描述】:
我在文档中发现错误测试:
$this->expectError();
$this->expectErrorMessage('foo');
\trigger_error('foo', \E_USER_ERROR);
但这不适用于我的示例:
$this->expectError();
$this->expectErrorMessageMatches( '/test/' );
require 'test.php';
因为需要它是 E_COMPILE_ERROR。我在文档中没有找到如何测试这一点?
【问题讨论】:
-
但是如果连代码都编译不出来,为什么还要测试呢?
标签: php unit-testing phpunit