BUG Prevent translatable / subdirs interfering with test state

This commit is contained in:
Damian Mooyman 2016-08-23 12:36:12 +12:00
parent 7c97a8ae74
commit 0e61dfc3f6
3 changed files with 20 additions and 10 deletions

View File

@ -13,9 +13,12 @@ class FileSubsitesTest extends BaseSubsiteTest
'File' => array(
'SecureFileExtension',
'VersionedFileExtension'
)
),
'SiteTree' => array(
'Translatable',
)
);
public function testTrivialFeatures()
{
$this->assertTrue(is_array(singleton('FileSubsites')->extraStatics()));
@ -29,35 +32,35 @@ class FileSubsitesTest extends BaseSubsiteTest
Subsite::changeSubsite(1);
$this->assertEquals($file->cacheKeyComponent(), 'subsite-1');
}
public function testWritingSubsiteID()
{
$this->objFromFixture('Member', 'admin')->logIn();
$subsite = $this->objFromFixture('Subsite', 'domaintest1');
FileSubsites::$default_root_folders_global = true;
Subsite::changeSubsite(0);
$file = new File();
$file->write();
$file->onAfterUpload();
$this->assertEquals((int)$file->SubsiteID, 0);
Subsite::changeSubsite($subsite->ID);
$this->assertTrue($file->canEdit());
$file = new File();
$file->write();
$this->assertEquals((int)$file->SubsiteID, 0);
$this->assertTrue($file->canEdit());
FileSubsites::$default_root_folders_global = false;
Subsite::changeSubsite($subsite->ID);
$file = new File();
$file->write();
$this->assertEquals($file->SubsiteID, $subsite->ID);
// Test inheriting from parent folder
$folder = new Folder();
$folder->write();

View File

@ -176,6 +176,9 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest
}
public function testCopyToSubsite() {
// Remove baseurl if testing in subdir
Config::inst()->update('Director', 'alternate_base_url', '/');
/** @var Subsite $otherSubsite */
$otherSubsite = $this->objFromFixture('Subsite', 'subsite1');
$staffPage = $this->objFromFixture('Page', 'staff'); // nested page

View File

@ -7,6 +7,10 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest
'subsites/tests/SubsitesVirtualPageTest.yml',
);
protected $illegalExtensions = array(
'SiteTree' => array('Translatable')
);
public function setUp()
{
parent::setUp();