No Description

MinutesFieldTest.php 894B

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