Browse Source

Update IntegrationTestCase tests to respect new logic.

In `::testArrayUrls()`, we declare an explicit `_method` to bypass the early GET-only route declared in `::setUp()` that would otherwise now match first.

In `::testAssertRedirect()`, we update the Location in Response we're testing against (since it's a GET), and then update the static string URL to match. We do this since we want the array-based reverse route lookup to match the earlier `/get/tasks/index` route now.
Brian Porter 7 years ago
parent
commit
09f1772dfe
1 changed files with 3 additions and 3 deletions
  1. 3 3
      tests/TestCase/TestSuite/IntegrationTestTraitTest.php

+ 3 - 3
tests/TestCase/TestSuite/IntegrationTestTraitTest.php

@@ -609,7 +609,7 @@ class IntegrationTestTraitTest extends IntegrationTestCase
      */
     public function testArrayUrls()
     {
-        $this->post(['controller' => 'Posts', 'action' => 'index']);
+        $this->post(['controller' => 'Posts', 'action' => 'index', '_method' => 'POST']);
         $this->assertEquals('value', $this->viewVariable('test'));
     }
 
@@ -932,10 +932,10 @@ class IntegrationTestTraitTest extends IntegrationTestCase
     public function testAssertRedirect()
     {
         $this->_response = new Response();
-        $this->_response = $this->_response->withHeader('Location', 'http://localhost/tasks/index');
+        $this->_response = $this->_response->withHeader('Location', 'http://localhost/get/tasks/index');
 
         $this->assertRedirect();
-        $this->assertRedirect('/tasks/index');
+        $this->assertRedirect('/get/tasks/index');
         $this->assertRedirect(['controller' => 'Tasks', 'action' => 'index']);
 
         $this->assertResponseEmpty();