* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Http\Tests\EntryPoint; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint; use Symfony\Component\HttpKernel\HttpKernelInterface; class FormAuthenticationEntryPointTest extends TestCase { public function testStart() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(); $response = new Response(); $httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(); $httpUtils ->expects($this->once()) ->method('createRedirectResponse') ->with($this->equalTo($request), $this->equalTo('/the/login/path')) ->will($this->returnValue($response)) ; $entryPoint = new FormAuthenticationEntryPoint($httpKernel, $httpUtils, '/the/login/path', false); $this->assertEquals($response, $entryPoint->start($request)); } public function testStartWithUseForward() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(); $subRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(); $response = new Response('', 200); $httpUtils = $this->getMockBuilder('Symfony\Component\Security\Http\HttpUtils')->getMock(); $httpUtils ->expects($this->once()) ->method('createRequest') ->with($this->equalTo($request), $this->equalTo('/the/login/path')) ->will($this->returnValue($subRequest)) ; $httpKernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $httpKernel ->expects($this->once()) ->method('handle') ->with($this->equalTo($subRequest), $this->equalTo(HttpKernelInterface::SUB_REQUEST)) ->will($this->returnValue($response)) ; $entryPoint = new FormAuthenticationEntryPoint($httpKernel, $httpUtils, '/the/login/path', true); $entryPointResponse = $entryPoint->start($request); $this->assertEquals($response, $entryPointResponse); $this->assertEquals(401, $entryPointResponse->getStatusCode()); } } __halt_compiler();----SIGNATURE:----aifld/AnmC8AzOdwGkZzY2H/Kzyh0/MJFx4225M5ELT+LcQgC9pJDS4e2Ntf/FU8ojqy98T7KUI0ndITZw3x+mIkRm5WMfCVyea2uT3F7vC608DaaUXA8m/rgXRqhjDCELFYvKV6TErH0FfDbdgmN8t5A+QNBzP8NTKYUJrEflGFtHs4IHl/XRWJ9V6j+c5SZJ/JeZPRLztslwvW4XT48q2sSEBWvBcVq8bbUenoSS6VYPoU34TKnuaZgsoic0Bu8vHqDK8Q8PlOOuOuPkYCjHH3TICNzeJurB0u3v+Gsk9HR49E98hGDBs/4N+YmUUkhOkH8D/nepIrLRU6xibYZ4eqCZriQwOMQHNwiUItWUO+v/OHOcU9ef81fPq7Y9sHjdrRLxpi6E8c2e7U++ePCknKoVt7yaO4OG3ZiKEQfFZS6ZnU//G9IRxWFb3cfcHMDmB3Q9u+KCw6Qd/fNycc12+tGCMCnWYatMd3IBW6EszC4wsLyIGbKLlvl82DqThzrITsumE9y+Eoo544RarDwVXTw3G+lKgom8CSSrZrqXt/iTSA2h+fmKaZKqjhupoDOGgfTWEvryiyqYceSKxat77RLunOCljQOMl1B/la2hi2RF8dthrbHjodQ7mOh1zOKDuXaTXsNAauOsK/mx2tevSi0kUYh/wG+MGbq+TeImA=----ATTACHMENT:----OTA5NjM0NzYyMTY0MDAyOSA3MTExNTg5MzI0ODc3ODk4IDM1MjA4NzM2MTc0MTY0Njg=