|
@@ 17-24 (lines=8) @@
|
| 14 |
|
*/ |
| 15 |
|
class SpecificTest extends \PHPUnit_Framework_TestCase |
| 16 |
|
{ |
| 17 |
|
public function testIfUpcomingMatchFoundUseCurrentPeriod() |
| 18 |
|
{ |
| 19 |
|
$selector = new Specific(new Increasing(), 15); |
| 20 |
|
|
| 21 |
|
$date = '2014-02-05'; |
| 22 |
|
$period = new Month($date); |
| 23 |
|
$this->assertEquals('2014-02-15', $selector->select($date, $period)); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
public function testIfNoUpcomingMatchFoundUseNextPeriod() |
| 27 |
|
{ |
|
@@ 26-33 (lines=8) @@
|
| 23 |
|
$this->assertEquals('2014-02-15', $selector->select($date, $period)); |
| 24 |
|
} |
| 25 |
|
|
| 26 |
|
public function testIfNoUpcomingMatchFoundUseNextPeriod() |
| 27 |
|
{ |
| 28 |
|
$selector = new Specific(new Increasing(), 15); |
| 29 |
|
|
| 30 |
|
$date = '2014-02-25'; |
| 31 |
|
$period = new Month($date); |
| 32 |
|
$this->assertEquals('2014-03-15', $selector->select($date, $period)); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
public function testIfNoUpcomingMatchFoundUsePreviousPeriod() |
| 36 |
|
{ |
|
@@ 35-42 (lines=8) @@
|
| 32 |
|
$this->assertEquals('2014-03-15', $selector->select($date, $period)); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
public function testIfNoUpcomingMatchFoundUsePreviousPeriod() |
| 36 |
|
{ |
| 37 |
|
$selector = new Specific(new Decreasing(), 15); |
| 38 |
|
|
| 39 |
|
$date = '2014-02-05'; |
| 40 |
|
$period = new Month($date); |
| 41 |
|
$this->assertEquals('2014-01-15', $selector->select($date, $period)); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
public function testCapNumberToDaysInPeriod() |
| 45 |
|
{ |
|
@@ 44-51 (lines=8) @@
|
| 41 |
|
$this->assertEquals('2014-01-15', $selector->select($date, $period)); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
public function testCapNumberToDaysInPeriod() |
| 45 |
|
{ |
| 46 |
|
$selector = new Specific(new Increasing(), 31); |
| 47 |
|
|
| 48 |
|
$date = '2015-02-01'; |
| 49 |
|
$period = new Month($date); |
| 50 |
|
$this->assertEquals('2015-02-28', $selector->select($date, $period)); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
/** |
| 54 |
|
* @expectedException \InvalidArgumentException |