|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SilverStripe\VersionFeed\Tests; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use Page; |
|
|
|
|
|
|
7
|
|
|
use SilverStripe\VersionFeed\VersionFeed; |
|
8
|
|
|
use SilverStripe\VersionFeed\VersionFeedController; |
|
9
|
|
|
use SilverStripe\Dev\SapphireTest; |
|
10
|
|
|
use SilverStripe\CMS\Model\SiteTree; |
|
11
|
|
|
use SilverStripe\CMS\Controllers\ContentController; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
class VersionFeedTest extends SapphireTest { |
|
15
|
|
|
|
|
16
|
|
|
protected $usesDatabase = true; |
|
17
|
|
|
|
|
18
|
|
|
protected static $required_extensions = [ |
|
19
|
|
|
SiteTree::class => [VersionFeed::class], |
|
20
|
|
|
ContentController::class => [VersionFeedController::class], |
|
21
|
|
|
]; |
|
22
|
|
|
|
|
23
|
|
|
protected $illegalExtensions = [ |
|
24
|
|
|
'SiteTree' => ['Translatable'] |
|
25
|
|
|
]; |
|
26
|
|
|
|
|
27
|
|
|
public function testDiffedChangesExcludesRestrictedItems() { |
|
28
|
|
|
$this->markTestIncomplete(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testDiffedChangesIncludesFullHistory() { |
|
32
|
|
|
$this->markTestIncomplete(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function testDiffedChangesTitle() { |
|
36
|
|
|
$page = new Page(['Title' => 'My Title']); |
|
37
|
|
|
$page->write(); |
|
38
|
|
|
$page->publish('Stage', 'Live'); |
|
39
|
|
|
|
|
40
|
|
|
$page->Title = 'My Changed Title'; |
|
41
|
|
|
$page->write(); |
|
42
|
|
|
$page->publish('Stage', 'Live'); |
|
43
|
|
|
|
|
44
|
|
|
$page->Title = 'My Unpublished Changed Title'; |
|
45
|
|
|
$page->write(); |
|
46
|
|
|
|
|
47
|
|
|
// Strip spaces from test output because they're not reliably maintained by the HTML Tidier |
|
48
|
|
|
$cleanDiffOutput = function($val) { |
|
49
|
|
|
return str_replace(' ','',strip_tags($val)); |
|
50
|
|
|
}; |
|
51
|
|
|
|
|
52
|
|
|
$this->assertContains( |
|
53
|
|
|
str_replace(' ' ,'',_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Changed Title'), |
|
54
|
|
|
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle')), |
|
55
|
|
|
'Detects published title changes' |
|
56
|
|
|
); |
|
57
|
|
|
|
|
58
|
|
|
$this->assertNotContains( |
|
59
|
|
|
str_replace(' ' ,'',_t('RSSHistory.TITLECHANGED', 'Title has changed:') . 'My Unpublished Changed Title'), |
|
60
|
|
|
array_map($cleanDiffOutput, $page->getDiffList()->column('DiffTitle')), |
|
61
|
|
|
'Ignores unpublished title changes' |
|
62
|
|
|
); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
|
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