Browse Source

Improving test

Jose Lorenzo Rodriguez 10 years ago
parent
commit
625ca3733b
1 changed files with 4 additions and 3 deletions
  1. 4 3
      tests/TestCase/Controller/ControllerTest.php

+ 4 - 3
tests/TestCase/Controller/ControllerTest.php

@@ -527,12 +527,13 @@ class ControllerTest extends TestCase
         $Response = $this->getMock('Cake\Network\Response', ['stop', 'header', 'statusCode']);
         $Controller = new Controller(null, $Response);
 
-        $Controller->eventManager()->on('Controller.beforeRedirect', function ($event, $url, $response) {
-            return new Response;
+        $newResponse = new Response;
+        $Controller->eventManager()->on('Controller.beforeRedirect', function ($event, $url, $response) use ($newResponse) {
+            return $newResponse;
         });
 
         $result = $Controller->redirect('http://cakephp.org');
-        $this->assertInstanceOf(Response::class, $result);
+        $this->assertSame($newResponse, $result);
     }
 
     /**