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 DMSDocumentCartExtensionTest extends SapphireTest |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | protected static $fixture_file = 'DMSDocumentCartExtensionTest.yml'; |
||
6 | |||
7 | protected $requiredExtensions = array( |
||
8 | 'DMSDocument' => array('DMSDocumentCartExtension') |
||
9 | ); |
||
10 | |||
11 | public function testMaximumCartQuantity() |
||
12 | { |
||
13 | $document = DMSDocument::create(array('AllowedInCart' => true, 'MaximumCartQuantity' => '')); |
||
14 | |||
15 | $this->assertFalse($document->getHasQuantityLimit()); |
||
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
16 | |||
17 | $document->MaximumCartQuantity = 0; |
||
18 | $this->assertFalse($document->getHasQuantityLimit()); |
||
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
19 | |||
20 | $document->MaximumCartQuantity = 1; |
||
21 | $this->assertTrue($document->getHasQuantityLimit()); |
||
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
22 | $this->assertSame(1, $document->getMaximumQuantity()); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
23 | |||
24 | $document->MaximumCartQuantity = 10; |
||
25 | $this->assertSame(10, $document->getMaximumQuantity()); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * The CSS classes are required for the CMS Javascript to work, assert that they are correct |
||
30 | */ |
||
31 | View Code Duplication | public function testCmsFieldsHaveRequiredCssClasses() |
|
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. ![]() |
|||
32 | { |
||
33 | $fields = DMSDocument::create()->getCMSFields(); |
||
34 | |||
35 | $allowedInCart = $fields->fieldByName('AllowedInCart'); |
||
36 | $this->assertInstanceOf('CheckboxField', $allowedInCart); |
||
0 ignored issues
–
show
The method
assertInstanceOf() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
37 | $this->assertTrue((bool) $allowedInCart->hasClass('dms-allowed-in-cart')); |
||
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
38 | |||
39 | $allowedInCart = $fields->fieldByName('MaximumCartQuantity'); |
||
40 | $this->assertInstanceOf('TextField', $allowedInCart); |
||
0 ignored issues
–
show
The method
assertInstanceOf() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
41 | $this->assertTrue((bool) $allowedInCart->hasClass('dms-maximum-cart-quantity')); |
||
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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 | * Ensure that validation messages can be retrieved once, cleared, then not again |
||
46 | */ |
||
47 | public function testGetValidationResult() |
||
48 | { |
||
49 | Session::set('dms-cart-validation-message', 'testing'); |
||
50 | $this->assertSame('testing', DMSDocument::create()->getValidationResult()); |
||
0 ignored issues
–
show
The method
assertSame() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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->assertFalse(DMSDocument::create()->getValidationResult()); |
||
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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 | } |
||
53 | |||
54 | /** |
||
55 | * Test that print request count is shown in the document's summary |
||
56 | */ |
||
57 | View Code Duplication | public function testPrintRequestCountIsShownInDocumentSummary() |
|
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. ![]() |
|||
58 | { |
||
59 | $document = $this->objFromFixture('DMSDocument', 'requested_for_print'); |
||
60 | $fields = $document->getCMSFields(); |
||
61 | |||
62 | // Results of DMSDocument::getFieldsForFile is the first in the list |
||
63 | $summary = $fields->first(); |
||
64 | $this->assertInstanceOf('FieldGroup', $summary); |
||
0 ignored issues
–
show
The method
assertInstanceOf() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
65 | |||
66 | $printRequestField = $summary->FieldList() |
||
67 | ->fieldByName('FilePreview.FilePreviewData.FilePreviewDataFields.PrintRequestCount'); |
||
68 | |||
69 | $this->assertNotNull($printRequestField, 'Print request count field exists in DMSDocument fields'); |
||
0 ignored issues
–
show
The method
assertNotNull() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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. ![]() |
|||
70 | $this->assertEquals(3, $printRequestField->Value()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<DMSDocumentCartExtensionTest> .
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 | } |
||
72 | |||
73 | /** |
||
74 | * @expectedException DMSDocumentCartException |
||
75 | * @expectedExceptionMessage peanut is not accepted for this method. |
||
76 | */ |
||
77 | public function testGetActionLinkThrowsExceptionOnInvalidAction() |
||
78 | { |
||
79 | DMSDocument::singleton()->getActionLink('Peanut'); |
||
80 | } |
||
81 | } |
||
82 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.