mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
42 lines
1013 B
PHP
42 lines
1013 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Subsites\Tests;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\Subsites\Model\Subsite;
|
|
use SilverStripe\Subsites\State\SubsiteState;
|
|
|
|
class BaseSubsiteTest extends SapphireTest
|
|
{
|
|
protected function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
SubsiteState::singleton()->setUseSessions(true);
|
|
Subsite::$force_subsite = null;
|
|
}
|
|
|
|
/**
|
|
* Avoid subsites filtering on fixture fetching.
|
|
* @param string $className
|
|
* @param string $identifier
|
|
* @return \SilverStripe\ORM\DataObject
|
|
*/
|
|
protected function objFromFixture($className, $identifier)
|
|
{
|
|
Subsite::disable_subsite_filter(true);
|
|
$obj = parent::objFromFixture($className, $identifier);
|
|
Subsite::disable_subsite_filter(false);
|
|
|
|
return $obj;
|
|
}
|
|
|
|
/**
|
|
* Tests the initial state of disable_subsite_filter
|
|
*/
|
|
public function testDisableSubsiteFilter()
|
|
{
|
|
$this->assertFalse(Subsite::$disable_subsite_filter);
|
|
}
|
|
}
|