2

In PhpUnit 5 we was able to set expected class name and then to check it's error message

$this->setExpectedException('Cake\Network\Exception\NotFoundException');
$this->assertEquals('Not Found', $this->_exception->getMessage());

How to do the same in PhpUnit 6?

1 Answer 1

5
$this->expectException(NotFoundException::class);
$this->expectExceptionMessage('Not Found');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.