Skip to content

Commit

Permalink
Added unit test around "forbidden section" redirection
Browse files Browse the repository at this point in the history
See #115
  • Loading branch information
chillu committed Oct 22, 2013
1 parent 8b5a1c9 commit c0e6d1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/SubsiteAdminFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ function testSubsiteAdmin() {
$this->assertNotRegExp('#^admin/assets/.*#', $this->mainSession->lastUrl(),
'Is redirected away from forbidden section');

// Check forbidden site.
// Check forbidden site, on a section that's allowed on another subsite
$this->getAndFollowAll("admin/pages/?SubsiteID=0");
$this->assertEquals(Subsite::currentSubsiteID(), $subsite1->ID, 'Is redirected to permitted subsite.');

// Check forbidden site, on a section that's not allowed on any other subsite
$this->getAndFollowAll("admin/assets/?SubsiteID=0");
$this->assertEquals(Subsite::currentSubsiteID(), $subsite1->ID, 'Is redirected to first permitted subsite.');
var_dump($this->mainSession->lastUrl());
$this->assertNotRegExp('#^Security/login.*#', $this->mainSession->lastUrl(), 'Is not denied access');

// Check the standalone XHR controller.
$response = $this->getAndFollowAll('SubsiteXHRController');
$this->assertNotRegExp('#^Security/login.*#', $this->mainSession->lastUrl(),
Expand Down

0 comments on commit c0e6d1a

Please sign in to comment.