MethodTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGetCode() 0 14 2
1
<?php
2
3
namespace Meanbee\MagentoRoyalmail\Test\Unit\Model;
4
5
use Meanbee\MagentoRoyalmail\Model\Method;
6
use Meanbee\Royalmail\Carrier;
7
8
/**
9
 * Class MethodTest
10
 */
11
class MethodTest extends \PHPUnit_Framework_TestCase
12
{
13
    /**
14
     * @var Carrier
15
     */
16
    protected $carrier;
17
18
    /**
19
     * @inheritdoc
20
     */
21
    protected function setUp()
22
    {
23
        $this->carrier = new Carrier();
24
    }
25
26
    /**
27
     * Test that all codes returned are 37 characters or shorter
28
     * We're trying to keep carrer_method under 40
29
     */
30
    public function testGetCode()
31
    {
32
        $carrierMethods= $this->carrier->getAllMethods();
33
34
        foreach ($carrierMethods as $carrierMethodCode => $carrierMethodName) {
35
            $method = new Method(
36
                $carrierMethodCode,
37
                $carrierMethodCode,
38
                $carrierMethodName
39
            );
40
41
            $this->assertTrue(strlen($method->getCode()) < 38);
42
        }
43
    }
44
}
45