silverstripe-subsites/tests/php/BaseSubsiteTest.php
Steve Boyd d4bc28e65c API Remove deprecated code
Co-authored-by: Sabina Talipova <sabina.talipova@silverstripe.com>
2023-01-27 09:55:04 +13:00

43 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);
}
/**
* 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);
}
}