You are here

public function UrlMatcherTest::testMethodNotAllowedAggregatesAllowedMethods in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php \Symfony\Component\Routing\Tests\Matcher\UrlMatcherTest::testMethodNotAllowedAggregatesAllowedMethods()

File

vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php, line 56

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testMethodNotAllowedAggregatesAllowedMethods() {
  $coll = new RouteCollection();
  $coll
    ->add('foo1', new Route('/foo', array(), array(), array(), '', array(), array(
    'post',
  )));
  $coll
    ->add('foo2', new Route('/foo', array(), array(), array(), '', array(), array(
    'put',
    'delete',
  )));
  $matcher = new UrlMatcher($coll, new RequestContext());
  try {
    $matcher
      ->match('/foo');
    $this
      ->fail();
  } catch (MethodNotAllowedException $e) {
    $this
      ->assertEquals(array(
      'POST',
      'PUT',
      'DELETE',
    ), $e
      ->getAllowedMethods());
  }
}