This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | View Code Duplication | class PromoObjectTest extends SapphireTest |
|
4 | { |
||
5 | /** |
||
6 | * @var string |
||
7 | */ |
||
8 | protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml'; |
||
9 | |||
10 | /** |
||
11 | * |
||
12 | */ |
||
13 | public function testGetCMSFields() |
||
14 | { |
||
15 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
16 | $fields = $object->getCMSFields(); |
||
17 | $this->assertInstanceOf('FieldList', $fields); |
||
18 | $this->assertNotNull($fields->dataFieldByName('BlockLinkID')); |
||
0 ignored issues
–
show
|
|||
19 | } |
||
20 | |||
21 | /** |
||
22 | * |
||
23 | */ |
||
24 | public function testValidateName() |
||
25 | { |
||
26 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
27 | $object->Name = ''; |
||
28 | $this->setExpectedException('ValidationException'); |
||
0 ignored issues
–
show
The method
setExpectedException() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
29 | $object->write(); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * |
||
34 | */ |
||
35 | public function testCanView() |
||
36 | { |
||
37 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
38 | $admin = $this->objFromFixture('Member', 'admin'); |
||
39 | $this->assertTrue($object->canView($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 38 can also be of type object<DataObject> ; however, DataObject::canView() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
40 | $member = $this->objFromFixture('Member', 'default'); |
||
41 | $this->assertTrue($object->canView($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 40 can also be of type object<DataObject> ; however, DataObject::canView() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * |
||
46 | */ |
||
47 | public function testCanEdit() |
||
48 | { |
||
49 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
50 | $admin = $this->objFromFixture('Member', 'admin'); |
||
51 | $this->assertTrue($object->canEdit($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 50 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
52 | $member = $this->objFromFixture('Member', 'default'); |
||
53 | $this->assertTrue($object->canEdit($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 52 can also be of type object<DataObject> ; however, DataObject::canEdit() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
54 | } |
||
55 | |||
56 | /** |
||
57 | * |
||
58 | */ |
||
59 | public function testCanDelete() |
||
60 | { |
||
61 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
62 | $admin = $this->objFromFixture('Member', 'admin'); |
||
63 | $this->assertTrue($object->canDelete($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 62 can also be of type object<DataObject> ; however, DataObject::canDelete() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
64 | $member = $this->objFromFixture('Member', 'default'); |
||
65 | $this->assertTrue($object->canDelete($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 64 can also be of type object<DataObject> ; however, DataObject::canDelete() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
66 | } |
||
67 | |||
68 | /** |
||
69 | * |
||
70 | */ |
||
71 | public function testCanCreate() |
||
72 | { |
||
73 | $object = $this->objFromFixture('PromoObject', 'one'); |
||
74 | $admin = $this->objFromFixture('Member', 'admin'); |
||
75 | $this->assertTrue($object->canCreate($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 74 can also be of type object<DataObject> ; however, DataObject::canCreate() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
76 | $member = $this->objFromFixture('Member', 'default'); |
||
77 | $this->assertTrue($object->canCreate($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 76 can also be of type object<DataObject> ; however, DataObject::canCreate() does only seem to accept object<Member>|null , maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. ![]() The method
assertTrue() does not seem to exist on object<PromoObjectTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
78 | } |
||
79 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.