X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=production%2Fexample_apps%2Fzippy_maps%2Ftests%2FTestCase%2FController%2FPagesControllerTest.php;fp=production%2Fexample_apps%2Fzippy_maps%2Ftests%2FTestCase%2FController%2FPagesControllerTest.php;h=1b478a3139de82b45d0a3854e2ad8845ececa84f;hb=34d1cb2e8687b826357db1d3821bf9e05cf6f13d;hp=0000000000000000000000000000000000000000;hpb=21f30bb859e6c15393e23ac0e5ef417b82f628a5;p=feisty_meow.git diff --git a/production/example_apps/zippy_maps/tests/TestCase/Controller/PagesControllerTest.php b/production/example_apps/zippy_maps/tests/TestCase/Controller/PagesControllerTest.php new file mode 100644 index 00000000..1b478a31 --- /dev/null +++ b/production/example_apps/zippy_maps/tests/TestCase/Controller/PagesControllerTest.php @@ -0,0 +1,97 @@ +get('/'); + $this->assertResponseOk(); + $this->get('/'); + $this->assertResponseOk(); + } + + /** + * testDisplay method + * + * @return void + */ + public function testDisplay() + { + $this->get('/pages/home'); + $this->assertResponseOk(); + $this->assertResponseContains('CakePHP'); + $this->assertResponseContains(''); + } + + /** + * Test that missing template renders 404 page in production + * + * @return void + */ + public function testMissingTemplate() + { + Configure::write('debug', false); + $this->get('/pages/not_existing'); + + $this->assertResponseError(); + $this->assertResponseContains('Error'); + } + + /** + * Test that missing template in debug mode renders missing_template error page + * + * @return void + */ + public function testMissingTemplateInDebug() + { + Configure::write('debug', true); + $this->get('/pages/not_existing'); + + $this->assertResponseFailure(); + $this->assertResponseContains('Missing Template'); + $this->assertResponseContains('Stacktrace'); + $this->assertResponseContains('not_existing.ctp'); + } + + /** + * Test directory traversal protection + * + * @return void + */ + public function testDirectoryTraversalProtection() + { + $this->get('/pages/../Layout/ajax'); + $this->assertResponseCode(403); + $this->assertResponseContains('Forbidden'); + } +}