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\NavHorizontal; |
15
|
|
|
|
16
|
|
|
/* Extend the default PHPUnit test case */ |
17
|
|
View Code Duplication |
class NavHorizontalTest extends TestCase |
|
|
|
|
18
|
|
|
{ |
19
|
|
|
/* Test that posts can be instantiated */ |
20
|
|
|
public function testCreation() |
21
|
|
|
{ |
22
|
|
|
/* Create a post */ |
23
|
|
|
$nav = new NavHorizontal(); |
24
|
|
|
/* Check that it is an object type */ |
25
|
|
|
$this->assertEquals(true, is_object($nav)); |
26
|
|
|
} |
27
|
|
|
public function testNext() |
28
|
|
|
{ |
29
|
|
|
$nav = new NavHorizontal(1, 1); |
30
|
|
|
$nav->next(); |
31
|
|
|
|
32
|
|
|
$this->assertEquals(1, $nav->column()); |
33
|
|
|
$this->assertEquals(2, $nav->row()); |
34
|
|
|
} |
35
|
|
|
public function testAxisXMove() |
36
|
|
|
{ |
37
|
|
|
$nav = new NavHorizontal(1, 1); |
38
|
|
|
$nav->axisXMove(); |
39
|
|
|
|
40
|
|
|
$this->assertEquals(1, $nav->column()); |
41
|
|
|
$this->assertEquals(2, $nav->row()); |
42
|
|
|
} |
43
|
|
|
public function testAxisYMove() |
44
|
|
|
{ |
45
|
|
|
$nav = new NavHorizontal(1, 1); |
46
|
|
|
$nav->axisYMove(); |
47
|
|
|
|
48
|
|
|
$this->assertEquals(2, $nav->column()); |
49
|
|
|
$this->assertEquals(1, $nav->row()); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.