public function rentFirstFreeZoneLocker(User $user, Zone $zone) { $locker = $this->lockerRepository->findOneFreeZoneLocker($zone); if (!$locker) { throw new NotFreeZoneLockerException(); } return $this->rentLocker($user, $locker); }
public function it_cannot_rent_without_free_lockers(User $user, LockerRepository $lockerRepository) { $lockerRepository->findOneFreeLocker()->shouldBeCalled()->willReturn(null); $this->shouldThrow(NotFreeLockerException::class)->duringRentFirstFreeLocker($user); }