You are here

public function RequestMatcherTest::testScheme 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::testScheme()

File

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

Class

RequestMatcherTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testScheme() {
  $httpRequest = $request = $request = Request::create('');
  $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array(
    'HTTPS' => 'on',
  ));
  $matcher = new RequestMatcher();
  $matcher
    ->matchScheme('https');
  $this
    ->assertFalse($matcher
    ->matches($httpRequest));
  $this
    ->assertTrue($matcher
    ->matches($httpsRequest));
  $matcher
    ->matchScheme('http');
  $this
    ->assertFalse($matcher
    ->matches($httpsRequest));
  $this
    ->assertTrue($matcher
    ->matches($httpRequest));
  $matcher = new RequestMatcher();
  $this
    ->assertTrue($matcher
    ->matches($httpsRequest));
  $this
    ->assertTrue($matcher
    ->matches($httpRequest));
}