Skip to content

Commit

Permalink
Fix pages controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 14, 2026
1 parent 1e47055 commit 0abf0cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/tests/TestCase/Controller/PagesControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public function testDisplay()
Configure::write('debug', true);
$this->get('/pages/home');
$this->assertResponseOk();
$this->assertResponseContains('CakePHP');

// The home page content is application-specific; don't assert CakePHP's skeleton text.
$this->assertResponseContains('<html>');
}

Expand Down Expand Up @@ -79,6 +80,8 @@ public function testMissingTemplateInDebug()
*/
public function testDirectoryTraversalProtection()
{
$this->enableCsrfToken();

$this->get('/pages/../Layout/ajax');
$this->assertResponseCode(403);
$this->assertResponseContains('Forbidden');
Expand All @@ -105,6 +108,8 @@ public function testCsrfAppliedError()
public function testCsrfAppliedOk()
{
$this->enableCsrfToken();
$this->enableSecurityToken();

$this->post('/pages/home', ['hello' => 'world']);

$this->assertThat(403, $this->logicalNot(new StatusCode($this->_response)));
Expand Down

0 comments on commit 0abf0cf

Please sign in to comment.