mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Added unit test around "forbidden section" redirection
See https://github.com/silverstripe/silverstripe-subsites/pull/115
This commit is contained in:
parent
8b5a1c92b2
commit
c0e6d1ad38
@ -98,10 +98,16 @@ class SubsiteAdminFunctionalTest extends FunctionalTest {
|
||||
$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(),
|
||||
|
Loading…
Reference in New Issue
Block a user