mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Subsites\Tests;
|
|
|
|
use SilverStripe\Core\Config\Config;
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\Subsites\Model\Subsite;
|
|
use SilverStripe\Subsites\State\SubsiteState;
|
|
|
|
class BaseSubsiteTest extends SapphireTest
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
SubsiteState::singleton()->setUseSessions(true);
|
|
Config::modify()->set(Subsite::class, 'write_hostmap', false);
|
|
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);
|
|
}
|
|
}
|