public function average()
{
$total = 0;
for ($i = 0; $i < 3; ++$i) {
$total += $this->_service->readTemp();
}
return $total / 3;
}
/** @test */ public function simpleStubWithPhake() { $service = \Phake::mock('\\Acme\\ServiceInterface'); \Phake::when($service)->readTemp()->thenReturn(10)->thenReturn(12)->thenReturn(14); $temperature = new Temperature($service); $this->assertEquals(12, $temperature->average()); }