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 FormBlockTest 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 testGetPluralName() |
||
14 | { |
||
15 | $object = singleton('FormBlock'); |
||
16 | $this->assertEquals('Form Blocks', $object->plural_name()); |
||
0 ignored issues
–
show
|
|||
17 | } |
||
18 | |||
19 | /** |
||
20 | * |
||
21 | */ |
||
22 | public function testGetCMSFields() |
||
23 | { |
||
24 | $object = $this->objFromFixture('FormBlock', 'one'); |
||
25 | $fields = $object->getCMSFields(); |
||
26 | $this->assertInstanceOf('FieldList', $fields); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | */ |
||
32 | public function testBlockForm() |
||
33 | { |
||
34 | if (class_exists('UserDefinedForm')) { |
||
35 | $object = $this->objFromFixture('FormBlock', 'one'); |
||
36 | $form = $object->Form(); |
||
37 | $this->assertInstanceOf('UserDefinedForm', $form); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | */ |
||
44 | View Code Duplication | public function testCanView() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
45 | { |
||
46 | $object = $this->objFromFixture('FormBlock', 'one'); |
||
47 | $admin = $this->objFromFixture('Member', 'admin'); |
||
48 | $member = $this->objFromFixture('Member', 'default'); |
||
49 | if (class_exists('UserDefinedForm')) { |
||
50 | $this->assertTrue($object->canView($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 47 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<FormBlockTest> .
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. ![]() |
|||
51 | $this->assertTrue($object->canView($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 48 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<FormBlockTest> .
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 | } else { |
||
53 | $this->assertFalse($object->canView($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 47 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
assertFalse() does not seem to exist on object<FormBlockTest> .
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 | $this->assertFalse($object->canView($member)); |
||
0 ignored issues
–
show
It seems like
$member defined by $this->objFromFixture('Member', 'default') on line 48 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
assertFalse() does not seem to exist on object<FormBlockTest> .
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. ![]() |
|||
55 | } |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * |
||
60 | */ |
||
61 | View Code Duplication | public function testCanCreate() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
62 | { |
||
63 | $object = $this->objFromFixture('FormBlock', 'one'); |
||
64 | $admin = $this->objFromFixture('Member', 'admin'); |
||
65 | $member = $this->objFromFixture('Member', 'default'); |
||
66 | if (class_exists('UserDefinedForm')) { |
||
67 | $this->assertTrue($object->canCreate($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 64 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<FormBlockTest> .
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. ![]() |
|||
68 | $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. ![]() The method
assertTrue() does not seem to exist on object<FormBlockTest> .
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. ![]() |
|||
69 | } else { |
||
70 | $this->assertFalse($object->canCreate($admin)); |
||
0 ignored issues
–
show
It seems like
$admin defined by $this->objFromFixture('Member', 'admin') on line 64 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
assertFalse() does not seem to exist on object<FormBlockTest> .
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. ![]() |
|||
71 | $this->assertFalse($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. ![]() The method
assertFalse() does not seem to exist on object<FormBlockTest> .
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. ![]() |
|||
72 | } |
||
73 | } |
||
74 | } |
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.