Completed
Pull Request — master (#35)
by Franco
02:01
created

DMSCartAbstractControllerTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 44
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testLink() 0 6 1
A testGetCart() 0 5 1
A testGetContinueBrowsingLink() 0 5 1
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->controller = DMSCheckoutController::create();
27
        $this->assertSame('checkout', $this->controller->Link());
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...
28
        $this->assertSame('checkout/complete', $this->controller->Link('complete'));
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...
29
    }
30
31
    /**
32
     * Tests if a Cart is received
33
     */
34
    public function testGetCart()
35
    {
36
        // Callable from base class
37
        $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...
38
    }
39
40
    /**
41
     * Controls the `Continue browsing` link found in DMSCartNavigation.ss. Defaults all requests back to home.
42
     * @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...
43
     */
44
    public function testGetContinueBrowsingLink()
45
    {
46
        // Base instance returns something
47
        $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...
48
    }
49
}
50