MethodTest::testGetCode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
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