NavTest::testStringification()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Symball\ReportBundle\Tests\Unit;
10
11
/* The base PHPUnit test class */
12
use PHPUnit\Framework\TestCase;
13
14
use Symball\ReportBundle\Service\Nav;
15
16
/* Extend the default PHPUnit test case */
17
class NavTest extends TestCase
18
{
19
    /* Test that posts can be instantiated */
20
    public function testCreation()
21
    {
22
        /* Create a post */
23
        $nav = new Nav();
24
        /* Check that it is an object type */
25
        $this->assertEquals(true, is_object($nav));
26
    }
27
    public function testCoordinates()
28
    {
29
        $nav = new Nav(1, 1);
30
31
        $this->assertEquals(1, $nav->column());
32
        $this->assertEquals(1, $nav->row());
33
    }
34
    public function testStringification()
35
    {
36
37
        $nav = new Nav(1, 1);
38
39
        $this->assertEquals('A1', (string) $nav);
40
    }
41
    public function testPointerMovement()
42
    {
43
44
        $nav = new Nav(1, 1);
45
46
        $this->assertEquals('A1', (string) $nav);
47
        $nav->right();
48
        $this->assertEquals('B1', (string) $nav);
49
        $nav->right(2);
50
        $this->assertEquals('D1', (string) $nav);
51
        $nav->down();
52
        $this->assertEquals('D2', (string) $nav);
53
        $nav->down(2);
54
        $this->assertEquals('D4', (string) $nav);
55
        $nav->left();
56
        $this->assertEquals('C4', (string) $nav);
57
        $nav->left(2);
58
        $this->assertEquals('A4', (string) $nav);
59
        $nav->up();
60
        $this->assertEquals('A3', (string) $nav);
61
        $nav->up(2);
62
        $this->assertEquals('A1', (string) $nav);
63
    }
64
    public function testPointerError()
65
    {
66
67
        $this->expectException('\Exception');
68
69
        $nav = new Nav(1, 1);
70
        $nav->up();
71
    }
72
}
73