UnitTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testGetCanon() 0 7 1
1
<?php
2
/**
3
 * PHP Units of Measure Library
4
 *
5
 * @link      https://github.com/hiqdev/php-units
6
 * @package   php-units
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\units\tests\tree;
12
13
use hiqdev\php\units\tree\TreeConverter;
14
15
/**
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class UnitTest extends \PHPUnit\Framework\TestCase
19
{
20
    /**
21
     * @var TreeConverter
22
     */
23
    protected $tree;
24
25
    /**
26
     * @var Unit
27
     */
28
    protected $byte;
29
30
    /**
31
     * @var Unit
32
     */
33
    protected $kilo;
34
35
    /**
36
     * @var Unit
37
     */
38
    protected $mega;
39
40
    protected function setUp()
41
    {
42
        $this->tree = new TreeConverter();
43
        $this->byte = $this->tree->getNode('byte');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->tree->getNode('byte') of type object<hiqdev\php\units\tree\NodeUnit> is incompatible with the declared type object<hiqdev\php\units\tests\tree\Unit> of property $byte.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
44
        $this->kilo = $this->tree->getNode('kilobyte');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->tree->getNode('kilobyte') of type object<hiqdev\php\units\tree\NodeUnit> is incompatible with the declared type object<hiqdev\php\units\tests\tree\Unit> of property $kilo.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
45
        $this->mega = $this->tree->getNode('megabyte');
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->tree->getNode('megabyte') of type object<hiqdev\php\units\tree\NodeUnit> is incompatible with the declared type object<hiqdev\php\units\tests\tree\Unit> of property $mega.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46
    }
47
48
    public function testGetCanon()
49
    {
50
        $KB = $this->tree->getNode('KB');
51
        $MB = $this->tree->getNode('MB');
52
        $this->assertTrue($KB->getCanon()->equals($this->kilo));
53
        $this->assertTrue($MB->getCanon()->equals($this->mega));
54
    }
55
}
56