silverstripe-subsites/tests/GroupSubsitesTest.php

28 lines
1.0 KiB
PHP
Raw Normal View History

2010-03-21 23:32:22 +01:00
<?php
2016-09-22 16:38:29 +02:00
use SilverStripe\Forms\FieldList;
use SilverStripe\Security\Group;
class GroupSubsitesTest extends BaseSubsiteTest {
2010-03-21 23:32:22 +01:00
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()));
2016-09-22 16:38:29 +02:00
$this->assertTrue(singleton('SilverStripe\\Security\\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;
$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'));
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(Test 1, Test 2)</i>');
2010-03-21 23:32:22 +01:00
}
}