@@ 11-43 (lines=33) @@ | ||
8 | * @author Kristjan Siimson <[email protected]> |
|
9 | * @package Direction\Tests |
|
10 | */ |
|
11 | class DecrementTest extends \PHPUnit_Framework_TestCase |
|
12 | { |
|
13 | /** |
|
14 | * @uses COG\ChronoShifter\Period\Period |
|
15 | */ |
|
16 | public function testNextMovesToPreviousPeriod() |
|
17 | { |
|
18 | $periodMock = $this |
|
19 | ->getMockBuilder('COG\ChronoShifter\Period\Period') |
|
20 | ->setMethods(array('previous')) |
|
21 | ->getMockForAbstractClass(); |
|
22 | ||
23 | $periodMock->expects($this->once())->method('previous'); |
|
24 | ||
25 | $direction = new Decreasing(); |
|
26 | $direction->next($periodMock); |
|
27 | } |
|
28 | ||
29 | public function testCompareEqualDates() |
|
30 | { |
|
31 | $direction = new Decreasing(); |
|
32 | $this->assertEquals(0, $direction->compare('2014-01-01 00:23:23', '2014-01-01 00:25:25')); |
|
33 | } |
|
34 | ||
35 | public function testFirstDateAfterSecondDate() |
|
36 | { |
|
37 | $direction = new Decreasing(); |
|
38 | $this->assertEquals(-1, $direction->compare('2014-01-02 00:00:00', '2014-01-01 23:59:59')); |
|
39 | } |
|
40 | ||
41 | public function testSecondDateAfterFirstDate() |
|
42 | { |
|
43 | $direction = new Decreasing(); |
|
44 | $this->assertEquals(1, $direction->compare('2014-01-01 23:59:59', '2014-01-02 00:00:00')); |
|
45 | } |
|
46 | } |
@@ 11-43 (lines=33) @@ | ||
8 | * @author Kristjan Siimson <[email protected]> |
|
9 | * @package Direction\Tests |
|
10 | */ |
|
11 | class IncrementTest extends \PHPUnit_Framework_TestCase |
|
12 | { |
|
13 | /** |
|
14 | * @uses COG\ChronoShifter\Period\Period |
|
15 | */ |
|
16 | public function testNextMovesToNextPeriod() |
|
17 | { |
|
18 | $periodMock = $this |
|
19 | ->getMockBuilder('COG\ChronoShifter\Period\Period') |
|
20 | ->setMethods(array('next')) |
|
21 | ->getMockForAbstractClass(); |
|
22 | ||
23 | $periodMock->expects($this->once())->method('next'); |
|
24 | ||
25 | $direction = new Increasing(); |
|
26 | $direction->next($periodMock); |
|
27 | } |
|
28 | ||
29 | public function testCompareEqualDates() |
|
30 | { |
|
31 | $direction = new Increasing(); |
|
32 | $this->assertEquals(0, $direction->compare('2014-01-01 00:23:23', '2014-01-01 00:25:25')); |
|
33 | } |
|
34 | ||
35 | public function testFirstDateAfterSecondDate() |
|
36 | { |
|
37 | $direction = new Increasing(); |
|
38 | $this->assertEquals(1, $direction->compare('2014-01-02 00:00:00', '2014-01-01 23:59:59')); |
|
39 | } |
|
40 | ||
41 | public function testSecondDateAfterFirstDate() |
|
42 | { |
|
43 | $direction = new Increasing(); |
|
44 | $this->assertEquals(-1, $direction->compare('2014-01-01 23:59:59', '2014-01-02 00:00:00')); |
|
45 | } |
|
46 | } |