dynamic /
dynamic-blocks
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 | class PhotoGalleryBlockImageTest 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('PhotoGalleryBlockImage', 'one'); |
||
| 16 | $fields = $object->getCMSFields(); |
||
| 17 | $this->assertInstanceOf('FieldList', $fields); |
||
| 18 | $this->assertNull($fields->dataFieldByName('PhotoGalleryID')); |
||
|
0 ignored issues
–
show
|
|||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * |
||
| 23 | */ |
||
| 24 | public function testCanView() |
||
| 25 | { |
||
| 26 | $object = $this->objFromFixture('PhotoGalleryBlockImage', 'one'); |
||
| 27 | $admin = $this->objFromFixture('Member', 'admin'); |
||
| 28 | $this->assertTrue($object->canView($admin)); |
||
|
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 27 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 29 | $member = $this->objFromFixture('Member', 'default'); |
||
| 30 | $this->assertTrue($object->canView($member)); |
||
|
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 29 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * |
||
| 35 | */ |
||
| 36 | public function testCanEdit() |
||
| 37 | { |
||
| 38 | $object = $this->objFromFixture('PhotoGalleryBlockImage', 'one'); |
||
| 39 | $admin = $this->objFromFixture('Member', 'admin'); |
||
| 40 | $this->assertTrue($object->canEdit($admin)); |
||
|
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 39 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 41 | $member = $this->objFromFixture('Member', 'default'); |
||
| 42 | $this->assertTrue($object->canEdit($member)); |
||
|
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 41 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * |
||
| 47 | */ |
||
| 48 | public function testCanDelete() |
||
| 49 | { |
||
| 50 | $object = $this->objFromFixture('PhotoGalleryBlockImage', 'one'); |
||
| 51 | $admin = $this->objFromFixture('Member', 'admin'); |
||
| 52 | $this->assertTrue($object->canDelete($admin)); |
||
|
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 51 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 53 | $member = $this->objFromFixture('Member', 'default'); |
||
| 54 | $this->assertTrue($object->canDelete($member)); |
||
|
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 53 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * |
||
| 59 | */ |
||
| 60 | public function testCanCreate() |
||
| 61 | { |
||
| 62 | $object = $this->objFromFixture('PhotoGalleryBlockImage', 'one'); |
||
| 63 | $admin = $this->objFromFixture('Member', 'admin'); |
||
| 64 | $this->assertTrue($object->canCreate($admin)); |
||
|
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 63 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 65 | $member = $this->objFromFixture('Member', 'default'); |
||
| 66 | $this->assertTrue($object->canCreate($member)); |
||
|
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 65 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. Loading history...
The method
assertTrue() does not seem to exist on object<PhotoGalleryBlockImageTest>.
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. Loading history...
|
|||
| 67 | } |
||
| 68 | } |
||
| 69 |
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.