Added some unit tests.
This commit is contained in:
parent
6ef8cd4b27
commit
55b94901ad
5 changed files with 885 additions and 17 deletions
19
tests/RelativeDateType1Test.php
Executable file
19
tests/RelativeDateType1Test.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use enko\RelativeDateParser\RelativeDateParser;
|
||||
|
||||
class RelativeDateType1Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNextDate()
|
||||
{
|
||||
$now = new DateTime('2014-07-07');
|
||||
$next_date = new DateTime('2014-08-12');
|
||||
|
||||
/** @var RelativeDateParser $parser */
|
||||
$parser = new RelativeDateParser('Zweiter Dienstag des Monats', $now, 'de');
|
||||
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($next_date->format('c'), $parser->getNext()->format('c'));
|
||||
}
|
||||
}
|
19
tests/RelativeDateType2Test.php
Executable file
19
tests/RelativeDateType2Test.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use enko\RelativeDateParser\RelativeDateParser;
|
||||
|
||||
class RelativeDateType2Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNextDate()
|
||||
{
|
||||
$now = new DateTime('2014-07-07');
|
||||
$next_date = new DateTime('2014-07-21');
|
||||
|
||||
/** @var RelativeDateParser $parser */
|
||||
$parser = new RelativeDateParser('Alle 14 Tage', $now, 'de');
|
||||
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($next_date->format('c'), $parser->getNext()->format('c'));
|
||||
}
|
||||
}
|
19
tests/RelativeDateType3Test.php
Executable file
19
tests/RelativeDateType3Test.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use enko\RelativeDateParser\RelativeDateParser;
|
||||
|
||||
class RelativeDateType3Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testNextDate()
|
||||
{
|
||||
$now = new DateTime('2014-07-07');
|
||||
$next_date = new DateTime('2014-08-05');
|
||||
|
||||
/** @var RelativeDateParser $parser */
|
||||
$parser = new RelativeDateParser('Jeder 5. Tag eines Monats', $now, 'de');
|
||||
|
||||
|
||||
// Assert
|
||||
$this->assertEquals($next_date->format('c'), $parser->getNext()->format('c'));
|
||||
}
|
||||
}
|
Reference in a new issue