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;
|
|
|
|
|
2018-01-18 05:48:09 +01:00
|
|
|
use SilverStripe\Core\Config\Config;
|
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-08-30 05:29:13 +02:00
|
|
|
use SilverStripe\Subsites\State\SubsiteState;
|
2017-05-24 15:25:34 +02:00
|
|
|
|
2017-05-24 15:26:28 +02:00
|
|
|
class BaseSubsiteTest extends SapphireTest
|
|
|
|
{
|
2017-08-29 07:22:32 +02:00
|
|
|
protected function setUp()
|
2017-05-24 15:26:28 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2017-08-30 05:29:13 +02:00
|
|
|
SubsiteState::singleton()->setUseSessions(true);
|
2018-01-18 05:48:09 +01:00
|
|
|
Config::modify()->set(Subsite::class, 'write_hostmap', false);
|
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.
|
2017-08-29 07:22:32 +02:00
|
|
|
* @param string $className
|
|
|
|
* @param string $identifier
|
2017-06-01 15:10:07 +02:00
|
|
|
* @return \SilverStripe\ORM\DataObject
|
|
|
|
*/
|
2017-08-29 07:22:32 +02:00
|
|
|
protected function objFromFixture($className, $identifier)
|
2017-06-01 15:57:53 +02:00
|
|
|
{
|
|
|
|
Subsite::disable_subsite_filter(true);
|
2017-08-29 07:22:32 +02:00
|
|
|
$obj = parent::objFromFixture($className, $identifier);
|
2017-06-01 15:57:53 +02:00
|
|
|
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
|
|
|
}
|