eZ\Bundle\EzPublishCoreBundle\Tests\EventListener\RequestEventListenerTest::testOnKernelRequestForward PHP Метод

testOnKernelRequestForward() публичный Метод

    public function testOnKernelRequestForward()
    {
        $queryParameters = array('some' => 'thing');
        $cookieParameters = array('cookie' => 'value');
        $request = Request::create('/test_sa/foo/bar', 'GET', $queryParameters, $cookieParameters);
        $semanticPathinfo = '/foo/something';
        $request->attributes->set('semanticPathinfo', $semanticPathinfo);
        $request->attributes->set('needsForward', true);
        $request->attributes->set('someAttribute', 'someValue');
        $expectedForwardRequest = Request::create($semanticPathinfo, 'GET', $queryParameters, $cookieParameters);
        $expectedForwardRequest->attributes->set('semanticPathinfo', $semanticPathinfo);
        $expectedForwardRequest->attributes->set('someAttribute', 'someValue');
        $response = new Response('Success!');
        $this->httpKernel->expects($this->once())->method('handle')->with($this->equalTo($expectedForwardRequest))->will($this->returnValue($response));
        $event = new GetResponseEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST);
        $this->requestEventListener->onKernelRequestForward($event);
        $this->assertSame($response, $event->getResponse());
        $this->assertTrue($event->isPropagationStopped());
    }