private function createIteration($time, $expectedDeviation = null, $expectedZValue = null)
{
$iteration = $this->prophesize(Iteration::class);
$iteration->getRevolutions()->willReturn(1);
$iteration->getResult(TimeResult::class)->willReturn(new TimeResult($time));
$iteration->getResult(MemoryResult::class)->willReturn(new MemoryResult($time));
if (null !== $expectedDeviation) {
$iteration->setDeviation($expectedDeviation)->shouldBeCalled();
if (null === $expectedZValue) {
$iteration->setZValue(Argument::that(function ($args) use($expectedZValue) {
return round($args[0], 4) == round($expectedZValue, 4);
}))->shouldBeCalled();
} else {
$iteration->setZValue(Argument::any())->shouldBeCalled();
}
}
return $iteration->reveal();
}