在PhpUnit 5中,我们能够设置预期的类名,然后检查它的错误信息
$this->setExpectedException('Cake\Network\Exception\NotFoundException');
$this->assertEquals('Not Found', $this->_exception->getMessage());
如何在PhpUnit 6中做同样的事情?
答案 0 :(得分:2)
$this->expectException(NotFoundException::class);
$this->expectExceptionMessage('Not Found');