ci: setup GitHub actions
Been having issues with Travis CI, figured time to give GitHub Actions a go. Also moved over from Coveralls to CodeCov due to some limitations in coverage format.
This commit is contained in:
parent
4bfd20985d
commit
fb97d20b8e
7 changed files with 117 additions and 43 deletions
|
@ -13,8 +13,63 @@ class RandomDateTest extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
public function testDate()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
|
||||
$assertRegExp = 'assertMatchesRegularExpression';
|
||||
} else {
|
||||
$assertRegExp = 'assertRegExp';
|
||||
}
|
||||
|
||||
$rd = new joshtronic\RandomDate();
|
||||
$this->assertRegExp('/^[0-9]{4}(-[0-9]{2}){2}$/i', $rd->date('Y-m-d'));
|
||||
$date = $rd->date('Y-m-d');
|
||||
|
||||
$this->$assertRegExp('/^[0-9]{4}(-[0-9]{2}){2}$/i', $date);
|
||||
}
|
||||
|
||||
public function testMin()
|
||||
{
|
||||
$rd = new joshtronic\RandomDate();
|
||||
$date = $rd->min('yesterday')->date('Y-m-d');
|
||||
|
||||
$min = date('Y-m-d', strtotime('yesterday'));
|
||||
$max = date('Y-m-d', strtotime('today'));
|
||||
|
||||
$this->assertGreaterThanOrEqual($min, $date);
|
||||
$this->assertLessThanOrEqual($max, $date);
|
||||
}
|
||||
|
||||
public function testMax()
|
||||
{
|
||||
$rd = new joshtronic\RandomDate();
|
||||
$date = $rd->min('5 days ago')->max('4 days ago')->date('Y-m-d');
|
||||
|
||||
$min = date('Y-m-d', strtotime('5 days ago'));
|
||||
$max = date('Y-m-d', strtotime('4 days ago'));
|
||||
|
||||
$this->assertGreaterThanOrEqual($min, $date);
|
||||
$this->assertLessThanOrEqual($max, $date);
|
||||
}
|
||||
|
||||
public function testBetween()
|
||||
{
|
||||
$rd = new joshtronic\RandomDate();
|
||||
$date = $rd->between('7 days ago', '6 days ago')->date('Y-m-d');
|
||||
|
||||
$min = date('Y-m-d', strtotime('7 days ago'));
|
||||
$max = date('Y-m-d', strtotime('6 days ago'));
|
||||
|
||||
$this->assertGreaterThanOrEqual($min, $date);
|
||||
$this->assertLessThanOrEqual($max, $date);
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
{
|
||||
$rd = new joshtronic\RandomDate();
|
||||
$date = $rd->between('+8 days', '+9 days')->date('Y-m-d');
|
||||
$date = $rd->reset()->date('Y-m-d');
|
||||
|
||||
$today = date('Y-m-d', strtotime('today'));
|
||||
|
||||
$this->assertLessThanOrEqual($today, $date);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue