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');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.