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