Browse Source

add test case for redirecting in IntegrationTestCaseTest

Mark Scherer 11 years ago
parent
commit
719bc22318

+ 24 - 0
tests/TestCase/TestSuite/IntegrationTestCaseTest.php

@@ -135,6 +135,30 @@ class IntegrationTestCaseTest extends IntegrationTestCase
     }
 
     /**
+     * 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
      *
      * @return void

+ 5 - 0
tests/test_app/TestApp/Controller/TestsAppsController.php

@@ -53,4 +53,9 @@ class TestsAppsController extends AppController
     {
         return $this->redirect('http://cakephp.org');
     }
+
+    public function redirect_to_permanent()
+    {
+        return $this->redirect('http://cakephp.org', 301);
+    }
 }