PointTest::test_constructs_with_two_integers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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