Navigation Menu

Skip to content

Commit

Permalink
Update IntegrationTestCase tests to respect new logic.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
beporter committed Sep 21, 2018
1 parent 1085ced commit 09f1772
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/TestCase/TestSuite/IntegrationTestTraitTest.php
Expand Up @@ -609,7 +609,7 @@ public function testAssertTemplateAfterCellRender()
*/
public function testArrayUrls()
{
$this->post(['controller' => 'Posts', 'action' => 'index']);
$this->post(['controller' => 'Posts', 'action' => 'index', '_method' => 'POST']);
$this->assertEquals('value', $this->viewVariable('test'));
}

Expand Down Expand Up @@ -932,10 +932,10 @@ public function testAssertResponseStatusCodes()
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();
Expand Down

0 comments on commit 09f1772

Please sign in to comment.