Skip to content

Commit

Permalink
add test case for redirecting in IntegrationTestCaseTest
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Jan 26, 2015
1 parent 0a25531 commit 719bc22
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/TestCase/TestSuite/IntegrationTestCaseTest.php
Expand Up @@ -134,6 +134,30 @@ public function testPostAndErrorHandling()
$this->assertResponseContains('<!DOCTYPE html>');
}

/**
* Test redirecting and integration tests.
*
* @return void
*/
public function testRedirect()
{
$this->post('/tests_apps/redirect_to');
$this->assertResponseOk();
$this->assertResponseCode(302);
}

/**
* Test redirecting and integration tests.
*
* @return void
*/
public function testRedirectPermanent()
{
$this->post('/tests_apps/redirect_to_permanent');
$this->assertResponseOk();
$this->assertResponseCode(301);
}

/**
* Test the responseOk status assertion
*
Expand Down
5 changes: 5 additions & 0 deletions tests/test_app/TestApp/Controller/TestsAppsController.php
Expand Up @@ -53,4 +53,9 @@ public function redirect_to()
{
return $this->redirect('http://cakephp.org');
}

public function redirect_to_permanent()
{
return $this->redirect('http://cakephp.org', 301);
}
}

0 comments on commit 719bc22

Please sign in to comment.