PointTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A test_constructs_with_two_integers() 0 4 1
A test_constructs_with_two_floats() 0 4 1
A test_length_is_sum_of_coordinates() 0 5 1
A test_distance_is_distance_from_the_origin() 0 5 1
A test_move_returns_new_point() 0 8 1
1
<?php
2
3
namespace Cgi\Calc\Tests;
4
5
use Cgi\Calc\Point;
6
7
class PointTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function test_constructs_with_two_integers()
10
    {
11
        new Point(1, 2);
12
    }
13
14
    public function test_constructs_with_two_floats()
15
    {
16
        new Point(1.2, 3.4);
17
    }
18
19
    public function test_length_is_sum_of_coordinates()
20
    {
21
        $point = new Point(5,8);
22
        static::assertEquals(13, $point->length());
23
    }
24
25
    public function test_distance_is_distance_from_the_origin()
26
    {
27
        $point = new Point(3,4);
28
        static::assertEquals(5, $point->distance());
29
    }
30
31
    public function test_move_returns_new_point()
32
    {
33
        $a = new Point(1,1);
34
        $c = $a->move($by = new Point(2,2));
35
36
        static::assertNotSame($a, $c);
37
        static::assertNotSame($by, $c);
38
    }
39
}
40