public function UrlMatcherTest::testMethodNotAllowed

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php, line 32

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testMethodNotAllowed() {
  $coll = new RouteCollection();
  $coll
    ->add('foo', new Route('/foo', array(), array(
    '_method' => 'post',
  )));
  $matcher = new UrlMatcher($coll, new RequestContext());
  try {
    $matcher
      ->match('/foo');
    $this
      ->fail();
  } catch (MethodNotAllowedException $e) {
    $this
      ->assertEquals(array(
      'POST',
    ), $e
      ->getAllowedMethods());
  }
}