在 PhpUnit 5 中,我们能够设置预期的类名,然后检查它的错误消息
$this->setExpectedException('Cake\Network\Exception\NotFoundException');
$this->assertEquals('Not Found', $this->_exception->getMessage());
Run Code Online (Sandbox Code Playgroud)
如何在 PhpUnit 6 中做同样的事情?
$this->expectException(NotFoundException::class);
$this->expectExceptionMessage('Not Found');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
549 次 |
最近记录: |