setException() public method

Should be called when an Exception is encountered during the execution of any of the iteration processes. After an exception is encountered the results from this iteration set are invalid.
public setException ( Exception $exception )
$exception Exception
Ejemplo n.º 1
0
 /**
  * It should throw an exception if getStats is called when an exception has been set.
  *
  * @expectedException RuntimeException
  * @expectedExceptionMessage Cannot retrieve stats when an exception
  */
 public function testGetStatsWithExceptionException()
 {
     $variant = new Variant($this->subject->reveal(), $this->parameterSet->reveal(), 4, 20);
     $this->subject->getRetryThreshold()->willReturn(10);
     $variant->createIteration(TestUtil::createResults(4, 10));
     $variant->createIteration(TestUtil::createResults(4, 10));
     $variant->createIteration(TestUtil::createResults(4, 10));
     $variant->createIteration(TestUtil::createResults(4, 10));
     $variant->computeStats();
     $variant->setException(new \Exception('Test'));
     $variant->getStats();
 }