Completed
Push — master ( 597319...02e318 )
by Damian
15s
created

FluentVersionedExtensionTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsPublishedInLocale() 0 6 1
A setUp() 0 10 1
A testIsDraftedInLocale() 0 6 1
1
<?php
2
3
namespace TractorCow\Fluent\Tests\Extension;
4
5
use Page;
0 ignored issues
show
Bug introduced by
The type Page was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SilverStripe\CMS\Model\SiteTree;
7
use SilverStripe\Dev\SapphireTest;
8
use TractorCow\Fluent\Extension\FluentSiteTreeExtension;
9
use TractorCow\Fluent\Model\Domain;
10
use TractorCow\Fluent\Model\Locale;
11
use TractorCow\Fluent\State\FluentState;
12
13
class FluentVersionedExtensionTest extends SapphireTest
14
{
15
    protected static $fixture_file = 'FluentVersionedExtensionTest.yml';
16
17
    protected static $required_extensions = [
18
        SiteTree::class => [
19
            FluentSiteTreeExtension::class,
20
        ],
21
    ];
22
23
    protected function setUp()
24
    {
25
        parent::setUp();
26
27
        // Clear cache
28
        Locale::clearCached();
29
        Domain::clearCached();
30
        FluentState::singleton()
31
            ->setLocale('en_NZ')
32
            ->setIsDomainMode(false);
33
    }
34
35
    public function testIsDraftedInLocale()
36
    {
37
        /** @var Page $page */
38
        $page = $this->objFromFixture(Page::class, 'home');
39
40
        $this->assertTrue($page->isDraftedInLocale());
41
    }
42
43
    public function testIsPublishedInLocale()
44
    {
45
        /** @var Page $page */
46
        $page = $this->objFromFixture(Page::class, 'home');
47
48
        $this->assertTrue($page->isPublishedInLocale());
49
    }
50
}
51