public function RequestMatcherTest::testHost

File

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

Class

RequestMatcherTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testHost() {
  $matcher = new RequestMatcher();
  $request = Request::create('', 'get', array(), array(), array(), array(
    'HTTP_HOST' => 'foo.example.com',
  ));
  $matcher
    ->matchHost('.*\\.example\\.com');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchHost('\\.example\\.com$');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchHost('^.*\\.example\\.com$');
  $this
    ->assertTrue($matcher
    ->matches($request));
  $matcher
    ->matchMethod('.*\\.sensio\\.com');
  $this
    ->assertFalse($matcher
    ->matches($request));
}