Networking\InitCmsBundle\Tests\Controller\FrontendPageControllerTest::testChangeAdminLanguageAction PHP Метод

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

    public function testChangeAdminLanguageAction()
    {
        // session
        $session = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Session\\Session')->disableOriginalConstructor()->getMock();
        $session->expects($this->once())->method('set')->with($this->equalTo('admin/_locale'), $this->equalTo('xy'));
        // request
        $request = $this->getMockBuilder('\\Symfony\\Component\\HttpFoundation\\Request')->disableOriginalConstructor()->getMock();
        $request->expects($this->once())->method('getSession')->will($this->returnValue($session));
        // request headers
        $headers = $this->getMock('\\Symfony\\Component\\HttpFoundation\\HeaderBag');
        $headers->expects($this->once())->method('get')->will($this->returnValue('/test/'))->with($this->equalTo('referer'));
        $request->headers = $headers;
        // controller test
        $controller = new FrontendPageController();
        $response = $controller->changeAdminLanguageAction($request, 'xy');
        $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\RedirectResponse', $response, 'Redirect returned');
    }