public function RequestMatcherTest::testPath

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php, line 125

Class

RequestMatcherTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testPath() {
  $matcher = new RequestMatcher();
  $request = Request::create('/admin/foo');
  $matcher
    ->matchPath('/admin/.*');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchPath('/admin');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchPath('^/admin/.*$');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchMethod('/blog/.*');
  $this
    ->assertFalse($matcher
    ->matches($request));
}