Selaa lähdekoodia

[Security] fixed tests

Fabien Potencier 14 vuotta sitten
vanhempi
commit
2f51bc3ef3
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 7 1
      tests/Symfony/Tests/Component/Security/Http/HttpUtilsTest.php

+ 7 - 1
tests/Symfony/Tests/Component/Security/Http/HttpUtilsTest.php

@@ -31,14 +31,20 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase
         $this->assertTrue($response->isRedirect('http://symfony.com/'));
 
         // route name
-        $utils = new HttpUtils($router = $this->getMock('Symfony\Component\Routing\RouterInterface'));
+        $utils = new HttpUtils($router = $this->getMockBuilder('Symfony\Component\Routing\Router')->disableOriginalConstructor()->getMock());
         $router
             ->expects($this->any())
             ->method('generate')
             ->with('foobar', array(), true)
             ->will($this->returnValue('http://localhost/foo/bar'))
         ;
+        $router
+            ->expects($this->any())
+            ->method('getContext')
+            ->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')))
+        ;
         $response = $utils->createRedirectResponse($this->getRequest(), 'foobar');
+        $this->assertTrue($response->isRedirect('http://localhost/foo/bar'));
     }
 
     public function testCreateRequest()