/** * @covers Cron\AbstractField::isSatisfied */ public function testTestsIfSatisfied() { $f = new DayOfWeekField(); $this->assertTrue($f->isSatisfied('12', '3-13')); $this->assertTrue($f->isSatisfied('15', '3-59/12')); $this->assertTrue($f->isSatisfied('12', '*')); $this->assertTrue($f->isSatisfied('12', '12')); $this->assertFalse($f->isSatisfied('12', '3-11')); $this->assertFalse($f->isSatisfied('12', '3-59/13')); $this->assertFalse($f->isSatisfied('12', '11')); }
public function validate($value) { $value = $this->convertLiterals($value); return parent::validate($this->replaceHashValue($value)); }
/** * @see https://github.com/mtdowling/cron-expression/issues/47 */ public function testIssue47() { $f = new DayOfWeekField(); $this->assertFalse($f->validate('mon,')); $this->assertFalse($f->validate('mon-')); $this->assertFalse($f->validate('*/2,')); $this->assertFalse($f->validate('-mon')); $this->assertFalse($f->validate(',1')); $this->assertFalse($f->validate('*-')); $this->assertFalse($f->validate(',-')); }
/** * @covers Cron\DayOfWeekField::isSatisfiedBy */ public function testHandlesZeroAndSevenDayOfTheWeekValues() { $f = new DayOfWeekField(); $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '0-2')); $this->assertTrue($f->isSatisfiedBy(new DateTime('2011-09-04 00:00:00'), '6-0')); }