diff options
Diffstat (limited to 'Http/Tests/FirewallTest.php')
-rw-r--r-- | Http/Tests/FirewallTest.php | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Http/Tests/FirewallTest.php b/Http/Tests/FirewallTest.php index 1e0c1ef..20da3ae 100644 --- a/Http/Tests/FirewallTest.php +++ b/Http/Tests/FirewallTest.php @@ -20,18 +20,18 @@ class FirewallTest extends \PHPUnit_Framework_TestCase { public function testOnKernelRequestRegistersExceptionListener() { - $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $listener = $this->getMock('Symfony\Component\Security\Http\Firewall\ExceptionListener', array(), array(), '', false); + $listener = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ExceptionListener')->disableOriginalConstructor()->getMock(); $listener ->expects($this->once()) ->method('register') ->with($this->equalTo($dispatcher)) ; - $request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false); + $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(); - $map = $this->getMock('Symfony\Component\Security\Http\FirewallMapInterface'); + $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock(); $map ->expects($this->once()) ->method('getListeners') @@ -39,7 +39,7 @@ class FirewallTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(array(array(), $listener))) ; - $event = new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST); + $event = new GetResponseEvent($this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), $request, HttpKernelInterface::MASTER_REQUEST); $firewall = new Firewall($map, $dispatcher); $firewall->onKernelRequest($event); @@ -49,59 +49,59 @@ class FirewallTest extends \PHPUnit_Framework_TestCase { $response = new Response(); - $first = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface'); + $first = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock(); $first ->expects($this->once()) ->method('handle') ; - $second = $this->getMock('Symfony\Component\Security\Http\Firewall\ListenerInterface'); + $second = $this->getMockBuilder('Symfony\Component\Security\Http\Firewall\ListenerInterface')->getMock(); $second ->expects($this->never()) ->method('handle') ; - $map = $this->getMock('Symfony\Component\Security\Http\FirewallMapInterface'); + $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock(); $map ->expects($this->once()) ->method('getListeners') ->will($this->returnValue(array(array($first, $second), null))) ; - $event = $this->getMock( - 'Symfony\Component\HttpKernel\Event\GetResponseEvent', - array('hasResponse'), - array( - $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), - $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false), + $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') + ->setMethods(array('hasResponse')) + ->setConstructorArgs(array( + $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), + $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->disableOriginalConstructor()->disableOriginalClone()->getMock(), HttpKernelInterface::MASTER_REQUEST, - ) - ); + )) + ->getMock() + ; $event ->expects($this->once()) ->method('hasResponse') ->will($this->returnValue(true)) ; - $firewall = new Firewall($map, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); + $firewall = new Firewall($map, $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock()); $firewall->onKernelRequest($event); } public function testOnKernelRequestWithSubRequest() { - $map = $this->getMock('Symfony\Component\Security\Http\FirewallMapInterface'); + $map = $this->getMockBuilder('Symfony\Component\Security\Http\FirewallMapInterface')->getMock(); $map ->expects($this->never()) ->method('getListeners') ; $event = new GetResponseEvent( - $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), - $this->getMock('Symfony\Component\HttpFoundation\Request'), + $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(), + $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(), HttpKernelInterface::SUB_REQUEST ); - $firewall = new Firewall($map, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); + $firewall = new Firewall($map, $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock()); $firewall->onKernelRequest($event); $this->assertFalse($event->hasResponse()); |