1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Class ManageableObjectDataExtensionTest |
5
|
|
|
*/ |
6
|
|
|
class ManageableObjectDataExtensionTest extends SapphireTest |
|
|
|
|
7
|
|
|
{ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
protected static $fixture_file = 'fixtures.yml'; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @var array |
16
|
|
|
*/ |
17
|
|
|
protected $extraDataObjects = [ |
18
|
|
|
SampleManageableDataObject::class, |
19
|
|
|
SampleManageableObjectPage::class, |
20
|
|
|
]; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Ensure any current member is logged out |
24
|
|
|
*/ |
25
|
|
|
public function logOut() |
26
|
|
|
{ |
27
|
|
|
if ($member = Member::currentUser()) { |
|
|
|
|
28
|
|
|
$member->logOut(); |
29
|
|
|
} |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* |
34
|
|
|
*/ |
35
|
|
|
public function testGetListingPage() |
36
|
|
|
{ |
37
|
|
|
$this->assertEquals(SampleManageableObjectPage::class, |
38
|
|
|
Injector::inst()->get(SampleManageableDataObject::class)->getListingPage()); |
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* |
43
|
|
|
*/ |
44
|
|
|
public function testGetAddLink() |
45
|
|
|
{ |
46
|
|
|
$page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
47
|
|
|
$object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
48
|
|
|
|
49
|
|
|
$this->logOut(); |
50
|
|
|
$this->assertFalse($object->getAddLink()); |
51
|
|
|
|
52
|
|
|
$this->logInWithPermission('MDO_Create'); |
53
|
|
|
|
54
|
|
|
$this->assertEquals($page->Link('add'), $object->getAddLink()); |
55
|
|
|
|
56
|
|
|
$this->logOut(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* |
61
|
|
|
*/ |
62
|
|
|
public function testGetEditLink() |
63
|
|
|
{ |
64
|
|
|
$page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
65
|
|
|
$object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
66
|
|
|
|
67
|
|
|
$this->logOut(); |
68
|
|
|
$this->assertFalse($object->getEditLink()); |
69
|
|
|
|
70
|
|
|
$this->logInWithPermission('MDO_Edit'); |
71
|
|
|
|
72
|
|
|
$this->assertEquals(Controller::join_links($page->Link('edit'), $object->ID), $object->getEditLink()); |
|
|
|
|
73
|
|
|
|
74
|
|
|
$this->logOut(); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* |
79
|
|
|
*/ |
80
|
|
|
public function testGetDeleteLink() |
81
|
|
|
{ |
82
|
|
|
$page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
83
|
|
|
$object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
84
|
|
|
|
85
|
|
|
$this->logOut(); |
86
|
|
|
$this->assertFalse($object->getDeleteLink()); |
87
|
|
|
|
88
|
|
|
$this->logInWithPermission('MDO_Delete'); |
89
|
|
|
|
90
|
|
|
$this->assertEquals(Controller::join_links($page->Link('delete'), $object->ID), $object->getDeleteLink()); |
91
|
|
|
|
92
|
|
|
$this->logOut(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
} |
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