* * 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:----F+/5EmfjwQgbxIaRhbs89OzNyRMNkP+fx5ufMZgFIKsfBT1x1MgeQGBrTM26xiyKUmG4CuDyej7ykwLehiU34DQtTyLOmkfAn8HW4k6G1ypLSXehmWIu3DtWW2klvo+csoB+bL/xF7QX7JIKu6ch6k2hVddQ5W1MloDuoYGsZggptruaxLTBZ3pNLN6gfLXzgxNMFExStE/wc0LSfsvdpOnhydaMll6C9XZ39wn95fCbpkfZBsolT/SbIr82HghH6ngmmRytqHKGpu4Pa+MYKaGWhXE8IPRgVS7Eg+Av7Q/7tbHfHREZuJzislnb6DDJLOPcsqapZhmXCN3hrpvY33AwAvWrFWSG5b89hFsbj2ab93BOQqJ0U0KuB+P/OYexvem8KqCBVvzyc0PiVB/54rhvObVEcuaIYdvfFZ4ruQbS2ICtguLOxTdQBchxPOOpZwZ5hkN1Q7juai6S3kKeUP1HG6UsBwieQqiHLsY6FXOZ8bA6ItmdiMs9jTwDX3Yn+RDyP3ykTnBoYGHK77lPAyGiIGSql+kk6ci4F6EdZCO53mwJuVPfoa0+GQgDcPFoxGOWyGaWj7T+qg4SSBYzq+Vx4/h7dAYl4JP70v2tDGa7dFKqH+l0WW7X5pM9+ynpz4X7KjqZMDseMRFhPqo9PNpKp7kgHf5X2IsvUcwBDJM=----ATTACHMENT:----Mjk2NDg3ODczNTI5ODI2IDg4NjU0ODU3OTU1MjkxNjIgMTk0NzkzNzA4NzE5NTA4OA==