mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Merge branch '2.4' into 2
This commit is contained in:
commit
0179176b6c
@ -3,13 +3,11 @@
|
|||||||
namespace SilverStripe\Subsites\Tests;
|
namespace SilverStripe\Subsites\Tests;
|
||||||
|
|
||||||
use SilverStripe\CMS\Controllers\CMSMain;
|
use SilverStripe\CMS\Controllers\CMSMain;
|
||||||
use SilverStripe\Control\Director;
|
|
||||||
use SilverStripe\Control\Session;
|
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
use SilverStripe\Subsites\Model\Subsite;
|
use SilverStripe\Subsites\Model\Subsite;
|
||||||
|
|
||||||
class SubsiteAdminTest extends BaseSubsiteTest
|
class SubsiteAdminTest extends FunctionalTest
|
||||||
{
|
{
|
||||||
protected static $fixture_file = 'SubsiteTest.yml';
|
protected static $fixture_file = 'SubsiteTest.yml';
|
||||||
|
|
||||||
@ -20,13 +18,6 @@ class SubsiteAdminTest extends BaseSubsiteTest
|
|||||||
Config::modify()->set(Subsite::class, 'write_hostmap', false);
|
Config::modify()->set(Subsite::class, 'write_hostmap', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function adminLoggedInSession()
|
|
||||||
{
|
|
||||||
return new Session([
|
|
||||||
'loggedInAs' => $this->idFromFixture(Member::class, 'admin')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test generation of the view
|
* Test generation of the view
|
||||||
*/
|
*/
|
||||||
@ -34,24 +25,20 @@ class SubsiteAdminTest extends BaseSubsiteTest
|
|||||||
{
|
{
|
||||||
$subsite1ID = $this->objFromFixture(Subsite::class, 'domaintest1')->ID;
|
$subsite1ID = $this->objFromFixture(Subsite::class, 'domaintest1')->ID;
|
||||||
|
|
||||||
// Open the admin area logged in as admin
|
$this->logInAs('admin');
|
||||||
$response1 = Director::test('admin/subsites/', null, $this->adminLoggedInSession());
|
|
||||||
|
|
||||||
// Confirm that this URL gets you the entire page, with the edit form loaded
|
// Confirm that this URL gets you the entire page, with the edit form loaded
|
||||||
$response2 = Director::test(
|
$response = $this->get(
|
||||||
"admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/"
|
"admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/"
|
||||||
."SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit",
|
."SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit"
|
||||||
null,
|
|
||||||
$this->adminLoggedInSession()
|
|
||||||
);
|
);
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
strpos($response2->getBody(), 'id="Form_ItemEditForm_ID"') !== false,
|
strpos($response->getBody(), 'id="Form_ItemEditForm_ID"') !== false,
|
||||||
'Testing Form_ItemEditForm_ID exists'
|
'Testing Form_ItemEditForm_ID exists'
|
||||||
);
|
);
|
||||||
$this->assertTrue(strpos($response2->getBody(), '<head') !== false, 'Testing <head> exists');
|
$this->assertTrue(strpos($response->getBody(), '<head') !== false, 'Testing <head> exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that the main-site user with ADMIN permissions can access all subsites, regardless
|
* Test that the main-site user with ADMIN permissions can access all subsites, regardless
|
||||||
* of whether he is in a subsite-specific group or not.
|
* of whether he is in a subsite-specific group or not.
|
||||||
|
Loading…
Reference in New Issue
Block a user