VectorUtiilsSubtractTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSubtract() 0 15 1
A testSubtractInvalid() 0 12 1
1
<?php
2
3
namespace PHP\Math\VectorTest;
4
5
use PHP\Math\Vector\Vector;
6
use PHP\Math\Vector\VectorUtils;
7
use PHPUnit_Framework_TestCase;
8
9
class VectorUtiilsSubtractTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testSubtract()
12
    {
13
        // Arrange
14
        $lft = new Vector(array(10, 20, 30));
15
        $rgt = new Vector(array(5, 5, 5));
16
17
        // Act
18
        $result = VectorUtils::subtract($lft, $rgt);
19
20
        // Assert
21
        $this->assertInstanceOf('PHP\Math\Vector\Vector', $result);
22
        $this->assertEquals('[5.0000000000, 15.0000000000, 25.0000000000]', (string)$result);
23
        $this->assertEquals('[10.0000000000, 20.0000000000, 30.0000000000]', (string)$lft);
24
        $this->assertEquals('[5.0000000000, 5.0000000000, 5.0000000000]', (string)$rgt);
25
    }
26
27
    /**
28
     * @expectedException InvalidArgumentException
29
     */
30
    public function testSubtractInvalid()
31
    {
32
        // Arrange
33
        $lft = new Vector(array(10, 20, 30));
34
        $rgt = new Vector(array(5, 5, 5, 5));
35
36
        // Act
37
        VectorUtils::subtract($lft, $rgt);
38
39
        // Assert
40
        // ...
41
    }
42
}
43