示例#1
0
 /**
  * @covers Cron\DayOfWeekField::validate
  */
 public function testValdatesField()
 {
     $f = new DayOfWeekField();
     $this->assertTrue($f->validate('1'));
     $this->assertTrue($f->validate('*'));
     $this->assertTrue($f->validate('*/3,1,1-12'));
     $this->assertTrue($f->validate('SUN-2'));
 }
 /**
  * @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(',-'));
 }
 public function validate($value)
 {
     $value = $this->convertLiterals($value);
     return parent::validate($this->replaceHashValue($value));
 }