mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
5d3af16aaf
- moving all phpunit tests into tests/php - moving all extensions from _config.php into config.yml and removing obsolete _config.php - moving GridFieldSubsiteDetailForm_ItemRequest into own file (cherry picked from commit ee02828)
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Subsites\Tests;
|
|
|
|
use SilverStripe\Security\Group;
|
|
use SilverStripe\Forms\FieldList;
|
|
use SilverStripe\Subsites\Extensions\GroupSubsites;
|
|
use SilverStripe\Subsites\Model\Subsite;
|
|
|
|
class GroupSubsitesTest extends BaseSubsiteTest
|
|
{
|
|
public static $fixture_file = 'subsites/tests/SubsiteTest.yml';
|
|
|
|
protected $requireDefaultRecordsFrom = [GroupSubsites::class];
|
|
public function testTrivialFeatures()
|
|
{
|
|
$this->assertTrue(is_array(singleton('GroupSubsites')->extraStatics()));
|
|
$this->assertTrue(is_array(singleton('GroupSubsites')->providePermissions()));
|
|
$this->assertTrue(singleton(Group::class)->getCMSFields() instanceof FieldList);
|
|
}
|
|
|
|
public function testAlternateTreeTitle()
|
|
{
|
|
$group = new Group();
|
|
$group->Title = 'The A Team';
|
|
$group->AccessAllSubsites = true;
|
|
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(global group)</i>');
|
|
$group->AccessAllSubsites = false;
|
|
$group->write();
|
|
$group->Subsites()->add($this->objFromFixture(Subsite::class, 'domaintest1'));
|
|
$group->Subsites()->add($this->objFromFixture(Subsite::class, 'domaintest2'));
|
|
$this->assertEquals($group->getTreeTitle(), 'The A Team <i>(Test 1, Test 2)</i>');
|
|
}
|
|
}
|