silverstripe-subsites/tests/php/BaseSubsiteTest.php

42 lines
917 B
PHP
Raw Normal View History

<?php
2016-09-22 16:38:29 +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();
Subsite::$use_session_subsiteid = true;
2017-06-01 15:57:53 +02:00
Subsite::$force_subsite = null;
}
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);
}
}