2013-01-03 14:46:56 +01:00
|
|
|
<?php
|
2016-09-22 16:38:29 +02:00
|
|
|
|
2017-04-23 22:23:34 +02:00
|
|
|
namespace SilverStripe\Subsites\Tests;
|
|
|
|
|
2016-09-22 16:38:29 +02:00
|
|
|
use SilverStripe\Dev\SapphireTest;
|
2017-05-24 15:25:34 +02:00
|
|
|
use SilverStripe\Subsites\Model\Subsite;
|
|
|
|
|
2017-05-24 15:26:28 +02:00
|
|
|
class BaseSubsiteTest extends SapphireTest
|
|
|
|
{
|
|
|
|
|
2017-05-29 13:42:42 +02:00
|
|
|
public function setUp()
|
2017-05-24 15:26:28 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2017-04-23 22:23:34 +02:00
|
|
|
Subsite::$use_session_subsiteid = true;
|
2017-06-01 15:57:53 +02:00
|
|
|
Subsite::$force_subsite = null;
|
2017-04-23 22:23:34 +02:00
|
|
|
}
|
2017-05-24 15:26:28 +02:00
|
|
|
|
2017-06-01 15:10:07 +02:00
|
|
|
/**
|
|
|
|
* Avoid subsites filtering on fixture fetching.
|
|
|
|
* @param string $class
|
|
|
|
* @param string $id
|
|
|
|
* @return \SilverStripe\ORM\DataObject
|
|
|
|
*/
|
2017-06-01 15:57:53 +02:00
|
|
|
public function objFromFixture($class, $id)
|
|
|
|
{
|
|
|
|
Subsite::disable_subsite_filter(true);
|
|
|
|
$obj = parent::objFromFixture($class, $id);
|
|
|
|
Subsite::disable_subsite_filter(false);
|
2017-05-24 15:26:28 +02:00
|
|
|
|
|
|
|
return $obj;
|
|
|
|
}
|
|
|
|
|
2017-06-01 15:57:53 +02:00
|
|
|
/**
|
|
|
|
* Tests the initial state of disable_subsite_filter
|
|
|
|
*/
|
|
|
|
public function testDisableSubsiteFilter()
|
|
|
|
{
|
|
|
|
$this->assertFalse(Subsite::$disable_subsite_filter);
|
|
|
|
}
|
2013-04-30 05:50:45 +02:00
|
|
|
}
|