DistanceShippingMethodTest::testCalculateRates()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
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
}