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(); }
/** * @Given The elevator is on my floor */ public function theElevatorIsOnMyFloor() { $groundFloor = new Floor(0); $this->resident = Resident::createOnTheFloor($groundFloor); $residentCurrentFloor = $this->resident->getCurrentFloor(); if ($this->elevatorController->getElevator()->isOnTheFloor($residentCurrentFloor)) { throw new \Exception("The Elevator should be in my floor"); } }