コード例 #1
0
 /**
  * @dataProvider getPortData
  */
 public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHttpPort, $expectedHttpsPort)
 {
     $listener = new RouterListener($this->router, $defaultHttpPort, $defaultHttpsPort);
     $event = $this->createGetResponseEventForUri($uri);
     $listener->onEarlyKernelRequest($event);
     $this->assertEquals($expectedHttpPort, $this->context->getHttpPort());
     $this->assertEquals($expectedHttpsPort, $this->context->getHttpsPort());
     $this->assertEquals(0 === strpos($uri, 'https') ? 'https' : 'http', $this->context->getScheme());
 }
コード例 #2
0
 /**
  * @dataProvider getPortData
  */
 public function testPort($defaultHttpPort, $defaultHttpsPort, $uri, $expectedHttpPort, $expectedHttpsPort)
 {
     $listener = new RouterListener($this->router, $defaultHttpPort, $defaultHttpsPort);
     $expectedContext = new RequestContext();
     $expectedContext->setHttpPort($expectedHttpPort);
     $expectedContext->setHttpsPort($expectedHttpsPort);
     $expectedContext->setScheme(0 === strpos($uri, 'https') ? 'https' : 'http');
     $this->router->expects($this->once())->method('setContext')->with($expectedContext);
     $event = $this->createGetResponseEventForUri($uri);
     $listener->onEarlyCoreRequest($event);
 }