Reputation: 4103
How do you clear the excepted exception after setting the expectedException like so:
PHPUnit_Framework_TestCase::setExpectedException('Acme\Services\Forms\FormValidationException');
What I want to say to PHPUnit is: don't expect an exception anymore, please fail the test if you encounter one.
Upvotes: 1
Views: 771
Reputation: 8356
A unit test should only verify one aspect of the unit of code under test. So if you first want to expect some exception to be raised and then you don't that just means that you should implement these verifications in two separate tests.
Upvotes: 4
Reputation: 6548
Just call the same method again passing null as Exception argument:
\PHPUnit_Framework_TestCase::setExpectedException(null);
Upvotes: 2