public function RouterListenerTest::testSubRequestWithDifferentMethod in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php \Symfony\Component\HttpKernel\Tests\EventListener\RouterListenerTest::testSubRequestWithDifferentMethod()
File
- vendor/
symfony/ http-kernel/ Tests/ EventListener/ RouterListenerTest.php, line 102
Class
Namespace
Symfony\Component\HttpKernel\Tests\EventListenerCode
public function testSubRequestWithDifferentMethod() {
$kernel = $this
->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$request = Request::create('http://localhost/', 'post');
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
$requestMatcher = $this
->getMock('Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface');
$requestMatcher
->expects($this
->any())
->method('matchRequest')
->with($this
->isInstanceOf('Symfony\\Component\\HttpFoundation\\Request'))
->will($this
->returnValue(array()));
$context = new RequestContext();
$requestMatcher
->expects($this
->any())
->method('getContext')
->will($this
->returnValue($context));
$listener = new RouterListener($requestMatcher, new RequestContext(), null, $this->requestStack);
$listener
->onKernelRequest($event);
// sub-request with another HTTP method
$kernel = $this
->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$request = Request::create('http://localhost/', 'get');
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST);
$listener
->onKernelRequest($event);
$this
->assertEquals('GET', $context
->getMethod());
}