* * 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:----SSZ8F0EefGO9K+nm7kB7pNmAetMghS8puuEeVJzDQlK2LO88IZcqWzAjG+CUuoOYKtUpSJqUKMbLMQO5fQ/yF+bMVwa/IhvKC4IJnyw6ugrbCrjL/0Z57kBDiyg1fUawUhHntvadzlQOV9L+z5LhR1gwf1A8n/QLFeQFK6Aqq4M65oLd0eIV/SXkMATNwE1ydVXo4oBGuy08h0Rfq3popuNRPFC1Q/3J5uq9fD4tXUmihNIFziU22VVyhywXHXHUkEJqu9BOCrLXc+kNJ4eBK7rYUQ5cu2CxaqT4vJr3u800UIxbyzYXpR5SvQubCbc1ZIDrvOuFBMF+0V8pvAR7W4cma/7TSbQqGxBn8ckwMjgvOeSiN9WONGxJNFoHRUwx6xsUGIlHAezvOgX72cEXoen52Ry7QfET2gY1x86N/IyKZojyKvuRXrLhSFxfaYW5PWHtCIJPltdF+Az1NYEUSJpdwVcH+lp+b8bgqENebRtQxR+yl8Xdqcv52SZ4+9ekuKcIAJE8GE7twc9tA/1mwN/SmRg5jbjKG/TBrvEpF0vbyomltQv7i8WMHjdY7NHA8ElEwaKO6IrgW6K/EGln/T4mdOQeIRi+CNJHH5dQJ0Rgx2YoIUsPZMgga35OhdwJ4QU5OaQu1nPx6ho6r+FYx2jCY7yfWJ48UODJhfUzVG4=----ATTACHMENT:----ODA1MTM2MTUzOTY5MTAwOSAxOTg3MjQ1MjYzNjkzMjUzIDEwNjkwMjI5MDExMTkwNQ==