isTimeoutEnabled() public method

public isTimeoutEnabled ( ) : boolean
return boolean
Esempio n. 1
0
 /**
  *
  * @return boolean
  */
 public function isTimeout()
 {
     if (!$this->config->isTimeoutEnabled()) {
         return false;
     }
     $duration = \microtime(true) - $this->getStartTime();
     return $duration > $this->config->getTimeout();
 }
Esempio n. 2
0
 /**
  * @dataProvider dataProvider_isTimeoutEnabled
  */
 public function testTimeout($timeout, $expectedEnabled, $expectedTimeout)
 {
     $func = function () {
         exit;
     };
     $configData = array('worker' => $func, 'quantity' => 10);
     if (!\is_null($timeout)) {
         $configData['timeout'] = $timeout;
     }
     $config = new Config($configData);
     $this->assertTrue($expectedEnabled === $config->isTimeoutEnabled());
     $this->assertEquals($expectedTimeout, $config->getTimeout());
 }