Completed
Push — master ( 0ebf95...33622c )
by Damian
12s
created

BaseSubsiteTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace SilverStripe\Subsites\Tests;
4
5
use SilverStripe\Dev\SapphireTest;
6
use SilverStripe\Subsites\Model\Subsite;
7
use SilverStripe\Subsites\State\SubsiteState;
8
9
class BaseSubsiteTest extends SapphireTest
10
{
11
    protected function setUp()
12
    {
13
        parent::setUp();
14
15
        SubsiteState::singleton()->setUseSessions(true);
16
        Subsite::$force_subsite = null;
17
    }
18
19
    /**
20
     * Avoid subsites filtering on fixture fetching.
21
     * @param string $className
22
     * @param string $identifier
23
     * @return \SilverStripe\ORM\DataObject
24
     */
25
    protected function objFromFixture($className, $identifier)
26
    {
27
        Subsite::disable_subsite_filter(true);
28
        $obj = parent::objFromFixture($className, $identifier);
29
        Subsite::disable_subsite_filter(false);
30
31
        return $obj;
32
    }
33
34
    /**
35
     * Tests the initial state of disable_subsite_filter
36
     */
37
    public function testDisableSubsiteFilter()
38
    {
39
        $this->assertFalse(Subsite::$disable_subsite_filter);
40
    }
41
}
42