/** * @Then I am in the floor number :floorNumber */ public function iAmInTheFloorNumber($floorNumber) { $targetFloor = new Floor($floorNumber); if (!$this->resident->getCurrentFloor()->isEqual($targetFloor)) { throw new \Exception("The I should be in the floor number {$floorNumber}"); } }
public function it_should_reach_the_resident_floor_when_button_down_is_pressed($elevator) { $elevator->beADoubleOf('Bones\\Building\\Elevator\\Elevator'); $resident = Resident::createOnTheFloor(new Floor(0)); $this->beConstructedWith($elevator); $this->pressDownButton($resident); $elevator->moveToFloor($resident->getCurrentFloor())->shouldHaveBeenCalled(); }
public function pressButtonWithNumber($floorNumber, Resident $resident) { $targetFloor = new Floor($floorNumber); $this->elevator->moveToFloor($targetFloor); $resident->setCurrentFloor($targetFloor); }