|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace TractorCow\Fluent\Tests\Extension; |
|
4
|
|
|
|
|
5
|
|
|
use Page; |
|
|
|
|
|
|
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
|
|
|
public function testExistsInLocale() |
|
52
|
|
|
{ |
|
53
|
|
|
/** @var Page $page */ |
|
54
|
|
|
$page = $this->objFromFixture(Page::class, 'home'); |
|
55
|
|
|
|
|
56
|
|
|
$this->assertTrue($page->existsInLocale()); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** @group wip */ |
|
60
|
|
|
public function testSourceLocaleIsCurrentWhenPageExistsInIt() |
|
61
|
|
|
{ |
|
62
|
|
|
// Read from the locale that the page exists in already |
|
63
|
|
|
/** @var Page $page */ |
|
64
|
|
|
$page = $this->objFromFixture(Page::class, 'home'); |
|
65
|
|
|
|
|
66
|
|
|
$this->assertEquals('en_NZ', $page->getSourceLocale()->Locale); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths