/** @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()); }
public function testGetsAverageTemperatureFromThreeServiceReadings() { $service = m::mock('service'); $service->shouldReceive('readTemp')->times(3)->andReturn(10, 12, 14); $temperature = new Temperature($service); $this->assertEquals(12, $temperature->average()); }