Completed
Push — master ( 824833...660d11 )
by
unknown
14s
created

DMSCartAbstractControllerTest::testGetCart()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * Class DMSDocumentCartControllerTest contains all the tests for {@link DMSDocumentCartController}
5
 */
6
class DMSCartAbstractControllerTest extends FunctionalTest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    protected static $fixture_file = 'dms-cart/tests/DMSDocumentCartTest.yml';
9
10
    /**
11
     * @var DMSCartAbstractController
12
     */
13
    protected $controller;
14
15
    public function setUp()
16
    {
17
        parent::setUp();
18
        $this->controller = DMSCartAbstractController::create();
19
    }
20
21
    /**
22
     * Ensure the link is "friendly", not a class name
23
     */
24
    public function testLink()
25
    {
26
        $this->assertNull($this->controller->Link());
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<DMSCartAbstractControllerTest>.

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...
27
    }
28
29
    /**
30
     * Tests if a Cart is received
31
     */
32
    public function testGetCart()
33
    {
34
        // Callable from base class
35
        $this->assertInstanceOf('DMSDocumentCart', $this->controller->getCart());
0 ignored issues
show
Bug introduced by
The method assertInstanceOf() does not seem to exist on object<DMSCartAbstractControllerTest>.

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...
36
    }
37
38
    /**
39
     * Controls the `Continue browsing` link found in DMSCartNavigation.ss. Defaults all requests back to home.
40
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
41
     */
42
    public function testGetContinueBrowsingLink()
43
    {
44
        // Base instance returns something
45
        $this->assertSame(Director::absoluteBaseURL(), $this->controller->getContinueBrowsingLink());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<DMSCartAbstractControllerTest>.

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...
46
    }
47
}
48