Neos\Flow\Tests\Unit\Security\Authentication\EntryPoint\WebRedirectTest::startAuthenticationSetsTheCorrectValuesInTheResponseObjectIfRouteValuesAreSpecified PHP Метод

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

    public function startAuthenticationSetsTheCorrectValuesInTheResponseObjectIfRouteValuesAreSpecified()
    {
        $request = Request::create(new Uri('http://robertlemke.com/admin'));
        $response = new Response();
        $entryPoint = $this->getAccessibleMock(WebRedirect::class, ['dummy']);
        $routeValues = ['@package' => 'SomePackage', '@subpackage' => 'SomeSubPackage', '@controller' => 'SomeController', '@action' => 'someAction', '@format' => 'someFormat', 'otherArguments' => ['foo' => 'bar']];
        $entryPoint->setOptions(['routeValues' => $routeValues]);
        $mockUriBuilder = $this->createMock(UriBuilder::class);
        $mockUriBuilder->expects($this->once())->method('setCreateAbsoluteUri')->with(true)->will($this->returnValue($mockUriBuilder));
        $mockUriBuilder->expects($this->once())->method('uriFor')->with('someAction', ['otherArguments' => ['foo' => 'bar'], '@format' => 'someFormat'], 'SomeController', 'SomePackage', 'SomeSubPackage')->will($this->returnValue('http://resolved/redirect/uri'));
        $entryPoint->_set('uriBuilder', $mockUriBuilder);
        $entryPoint->startAuthentication($request, $response);
        $this->assertEquals('303', substr($response->getStatus(), 0, 3));
        $this->assertEquals('http://resolved/redirect/uri', $response->getHeader('Location'));
    }