public function UrlMatcherTest::testMethodNotAllowedAggregatesAllowedMethods

File

drupal/core/vendor/symfony/routing/Symfony/Component/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(
    '_method' => 'post',
  )));
  $coll
    ->add('foo2', new Route('/foo', array(), array(
    '_method' => '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());
  }
}