updated packages
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Cron\Tests;
|
||||
|
||||
use Cron\DayOfWeekField;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,7 @@ class DayOfWeekFieldTest extends TestCase
|
||||
{
|
||||
$f = new DayOfWeekField();
|
||||
$this->assertTrue($f->isSatisfiedBy(new DateTime(), '?'));
|
||||
$this->assertTrue($f->isSatisfiedBy(new DateTimeImmutable(), '?'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,17 @@ class DayOfWeekFieldTest extends TestCase
|
||||
$this->assertSame('2011-03-14 23:59:00', $d->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Cron\DayOfWeekField::increment
|
||||
*/
|
||||
public function testIncrementsDateTimeImmutable()
|
||||
{
|
||||
$d = new DateTimeImmutable('2011-03-15 11:15:00');
|
||||
$f = new DayOfWeekField();
|
||||
$f->increment($d);
|
||||
$this->assertSame('2011-03-16 00:00:00', $d->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Cron\DayOfWeekField::isSatisfiedBy
|
||||
* @expectedException InvalidArgumentException
|
||||
@@ -103,6 +116,18 @@ class DayOfWeekFieldTest extends TestCase
|
||||
$this->assertTrue($f->isSatisfiedBy(new DateTime('2014-04-20 00:00:00'), '7#3'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Cron\DayOfWeekField::isSatisfiedBy
|
||||
*/
|
||||
public function testHandlesLastWeekdayOfTheMonth()
|
||||
{
|
||||
$f = new DayOfWeekField();
|
||||
$this->assertTrue($f->isSatisfiedBy(new DateTime('2018-12-28 00:00:00'), 'FRIL'));
|
||||
$this->assertTrue($f->isSatisfiedBy(new DateTime('2018-12-28 00:00:00'), '5L'));
|
||||
$this->assertFalse($f->isSatisfiedBy(new DateTime('2018-12-21 00:00:00'), 'FRIL'));
|
||||
$this->assertFalse($f->isSatisfiedBy(new DateTime('2018-12-21 00:00:00'), '5L'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/mtdowling/cron-expression/issues/47
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user