ShippingEstimatorTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetEstimates() 0 12 1
1
<?php 
2
3
class ShippingEstimatorTest extends SapphireTest{
4
    
5
    protected static $fixture_file = array(
6
        'silvershop-shipping/tests/fixtures/TableShippingMethod.yml'
7
    );
8
    
9
    function testGetEstimates() {
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...
10
        $order = new Order();
11
        $address = new Address();
12
        $package = new ShippingPackage(2);
0 ignored issues
show
Unused Code introduced by
$package is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
13
        $estimator = new ShippingEstimator($order, $address);
14
15
        $options = $estimator->getShippingMethods();
16
        $this->assertNotNull($options, "options found");
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<ShippingEstimatorTest>.

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...
17
        
18
        $estimates = $estimator->getEstimates();
19
        $this->assertNotNull($estimates, "estimates found");
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<ShippingEstimatorTest>.

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...
20
    }
21
    
22
}