DistanceShippingMethodTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testDistanceFare() 0 11 1
A testCalculateRates() 0 15 1
1
<?php
2
3
class DistanceShippingMethodTest extends SapphireTest{
4
    
5
    protected static $fixture_file = array(
6
        'silvershop-shipping/tests/fixtures/DistanceShippingMethod.yml',
7
        'silvershop-shipping/tests/fixtures/Warehouses.yml'
8
    );
9
10
    function testDistanceFare() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
        $method = $this->objFromFixture("DistanceShippingMethod", "ds");
12
        $this->assertEquals(0, $method->getDistanceFare(9));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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...
13
        $this->assertEquals(0, $method->getDistanceFare(0.5));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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...
14
        $this->assertEquals(234, $method->getDistanceFare(150));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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...
15
        $this->assertEquals(678, $method->getDistanceFare(999999));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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...
16
17
        //TODO: what if distane can't be calculated?
18
        //what if warehouse can't be found?
19
        //what if address is invalid?
20
    }
21
22
    function testCalculateRates() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
        $method = $this->objFromFixture("DistanceShippingMethod", "ds");
24
        $this->assertEquals(234,
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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...
25
            $method->calculateRate(
26
                new ShippingPackage(), 
27
                $this->objFromFixture("Address", "customeraddress1")
28
            )
29
        );
30
        $this->assertEquals(567,
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<DistanceShippingMethodTest>.

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
            $method->calculateRate(
32
                new ShippingPackage(), 
33
                $this->objFromFixture("Address", "customeraddress2")
34
            )
35
        );
36
    }
37
38
}