2010-03-21 23:32:22 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class GroupSubsitesTest extends SapphireTest {
|
|
|
|
static $fixture_file = 'subsites/tests/SubsiteTest.yml';
|
|
|
|
|
|
|
|
protected $requireDefaultRecordsFrom = array('GroupSubsites');
|
|
|
|
|
|
|
|
function testTrivialFeatures() {
|
|
|
|
$this->assertTrue(is_array(singleton('GroupSubsites')->extraStatics()));
|
|
|
|
$this->assertTrue(is_array(singleton('GroupSubsites')->providePermissions()));
|
2012-03-25 18:35:01 +02:00
|
|
|
$this->assertTrue(singleton('Group')->getCMSFields() instanceof FieldList);
|
2010-03-21 23:32:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function testAlternateTreeTitle() {
|
|
|
|
$group = new Group();
|
|
|
|
$group->Title = 'The A Team';
|
|
|
|
$group->AccessAllSubsites = true;
|
2012-07-11 15:32:10 +02:00
|
|
|
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(global group)</i>');
|
2010-03-21 23:32:22 +01:00
|
|
|
$group->AccessAllSubsites = false;
|
|
|
|
$group->write();
|
|
|
|
$group->Subsites()->add($this->objFromFixture('Subsite', 'domaintest1'));
|
|
|
|
$group->Subsites()->add($this->objFromFixture('Subsite', 'domaintest2'));
|
2012-07-11 15:32:10 +02:00
|
|
|
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(Test 1, Test 2)</i>');
|
2010-03-21 23:32:22 +01:00
|
|
|
}
|
|
|
|
}
|