示例#1
0
 public function testAddAndGet()
 {
     $commandA = $this->getMock('Odesk\\Phystrix\\AbstractCommand', array('run'));
     $commandB = $this->getMock('Odesk\\Phystrix\\AbstractCommand', array('run'));
     $this->assertEmpty($this->requestLog->getExecutedCommands());
     $this->requestLog->addExecutedCommand($commandA);
     $this->requestLog->addExecutedCommand($commandB);
     $this->assertEquals(array($commandA, $commandB), $this->requestLog->getExecutedCommands());
 }
示例#2
0
 public function testRequestLogOff()
 {
     $this->setUpCommonExpectations();
     $this->command->setConfig(new \Zend\Config\Config(array('requestLog' => array('enabled' => false))));
     $this->assertEmpty($this->requestLog->getExecutedCommands());
     $this->assertEquals('run result', $this->command->execute());
     $this->assertEmpty($this->requestLog->getExecutedCommands());
 }
示例#3
0
 /**
  * Adds reference to the command to the current request log
  */
 private function recordExecutedCommand()
 {
     if ($this->requestLog && $this->config->get('requestLog')->get('enabled')) {
         $this->requestLog->addExecutedCommand($this);
     }
 }