示例#1
0
 public function pickFrom(GetOpt\GetOpt $optionsFromCommandLine)
 {
     if ($option = $optionsFromCommandLine->getOption($this->name)) {
         return T\Interval::parse($option);
     }
     return $this->default;
 }
示例#2
0
 public function setUp()
 {
     $this->clock = T\clock()->stop();
     $this->now = $this->clock->now();
     $this->jobRepository = $this->getMockBuilder('Recruiter\\Job\\Repository')->disableOriginalConstructor()->getMock();
     $this->mongoLock = $this->getMock('Onebip\\Concurrency\\Lock');
     $this->cleaner = new Cleaner($this->jobRepository, $this->mongoLock);
     $this->interval = Interval::parse('10s');
 }
示例#3
0
 private function validate($argument)
 {
     if (!is_null($argument)) {
         try {
             return T\Interval::parse($argument);
         } catch (T\InvalidIntervalFormat $e) {
             throw new UnexpectedValueException(sprintf("Option '%s' has an invalid value: %s", $this->name, $e->getMessage()));
         }
     }
     return $this->timeToWaitAtMost;
 }
示例#4
0
 /**
  * @expectedException Timeless\InvalidIntervalFormat
  */
 public function testBadString()
 {
     Interval::parse('whatever');
 }