From 719bc223183b1cd3908a4dc61f8f5041334ea044 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Mon, 26 Jan 2015 21:48:24 +0100 Subject: [PATCH] add test case for redirecting in IntegrationTestCaseTest --- .../TestSuite/IntegrationTestCaseTest.php | 24 +++++++++++++++++++ .../Controller/TestsAppsController.php | 5 ++++ 2 files changed, 29 insertions(+) diff --git a/tests/TestCase/TestSuite/IntegrationTestCaseTest.php b/tests/TestCase/TestSuite/IntegrationTestCaseTest.php index b79944b5ede..5431fa5be39 100644 --- a/tests/TestCase/TestSuite/IntegrationTestCaseTest.php +++ b/tests/TestCase/TestSuite/IntegrationTestCaseTest.php @@ -134,6 +134,30 @@ public function testPostAndErrorHandling() $this->assertResponseContains(''); } + /** + * 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 * diff --git a/tests/test_app/TestApp/Controller/TestsAppsController.php b/tests/test_app/TestApp/Controller/TestsAppsController.php index 2e69791a808..eaa1dd4e1d4 100644 --- a/tests/test_app/TestApp/Controller/TestsAppsController.php +++ b/tests/test_app/TestApp/Controller/TestsAppsController.php @@ -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); + } }