Confirms that the expected exception is thrown.
public function testMethodNotAllowed() {
$chain = new ChainMatcher();
$method_not_allowed = new MockMatcher(function (Request $request) {
throw new MethodNotAllowedException(array(
'POST',
));
});
try {
$chain
->add($method_not_allowed);
$chain
->matchRequest(Request::create('my/path'));
} catch (MethodNotAllowedException $e) {
$this
->pass('Correct exception thrown.');
} catch (Exception $e) {
$this
->fail('Incorrect exception thrown: ' . get_class($e));
}
}