You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
926 B

  1. <?php
  2. namespace Cron\Tests;
  3. use Cron\MinutesField;
  4. use DateTime;
  5. use PHPUnit_Framework_TestCase;
  6. /**
  7. * @author Michael Dowling <mtdowling@gmail.com>
  8. */
  9. class MinutesFieldTest extends PHPUnit_Framework_TestCase
  10. {
  11. /**
  12. * @covers Cron\MinutesField::validate
  13. */
  14. public function testValidatesField()
  15. {
  16. $f = new MinutesField();
  17. $this->assertTrue($f->validate('1'));
  18. $this->assertTrue($f->validate('*'));
  19. $this->assertTrue($f->validate('*/3,1,1-12'));
  20. }
  21. /**
  22. * @covers Cron\MinutesField::increment
  23. */
  24. public function testIncrementsDate()
  25. {
  26. $d = new DateTime('2011-03-15 11:15:00');
  27. $f = new MinutesField();
  28. $f->increment($d);
  29. $this->assertEquals('2011-03-15 11:16:00', $d->format('Y-m-d H:i:s'));
  30. $f->increment($d, true);
  31. $this->assertEquals('2011-03-15 11:15:00', $d->format('Y-m-d H:i:s'));
  32. }
  33. }