You are here

public function RequestMatcherTest::testAttributes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/RequestMatcherTest.php \Symfony\Component\HttpFoundation\Tests\RequestMatcherTest::testAttributes()

File

vendor/symfony/http-foundation/Tests/RequestMatcherTest.php, line 131

Class

RequestMatcherTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testAttributes() {
  $matcher = new RequestMatcher();
  $request = Request::create('/admin/foo');
  $request->attributes
    ->set('foo', 'foo_bar');
  $matcher
    ->matchAttribute('foo', 'foo_.*');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchAttribute('foo', 'foo');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchAttribute('foo', '^foo_bar$');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchAttribute('foo', 'babar');
  $this
    ->assertFalse($matcher
    ->matches($request));
}