/**
  * @test
  */
 public function it_checks_for_bookable_slots_when_unavailable()
 {
     $this->business->vacancies()->delete();
     // ...that has a published availability (Vacancy)...
     $date = Carbon::parse('today 00:00 ' . $this->business->timezone);
     $startAt = Carbon::parse('today 09:00 ' . $this->business->timezone)->timezone('UTC');
     $finishAt = Carbon::parse('today 18:00 ' . $this->business->timezone)->timezone('UTC');
     $this->vacancy = $this->createVacancy(['business_id' => $this->business->id, 'service_id' => $this->service->id, 'date' => $date->toDateString(), 'start_at' => $startAt->toDateTimeString(), 'finish_at' => $finishAt->toDateTimeString(), 'capacity' => 0]);
     $bookable = $this->concierge->business($this->business)->isBookable();
     $this->assertFalse($bookable);
 }
 /**
  * Arrange Fixture.
  *
  * @return void
  */
 protected function arrangeFixture()
 {
     // Given there is...
     // ...a Business...
     $this->business = $this->createBusiness(['strategy' => 'dateslot']);
     // ...owned by user...
     $this->owner = $this->createUser();
     $this->business->owners()->save($this->owner);
     // ...and the Business provides a service...
     $this->service = $this->createService(['business_id' => $this->business->id]);
     // ...that has a published availability (Vacancy)...
     $date = Carbon::parse('today 00:00 ' . $this->business->timezone);
     $startAt = Carbon::parse('today 09:00 ' . $this->business->timezone)->timezone('UTC');
     $finishAt = Carbon::parse('today 18:00 ' . $this->business->timezone)->timezone('UTC');
     $this->vacancy = $this->createVacancy(['business_id' => $this->business->id, 'service_id' => $this->service->id, 'date' => $date->toDateString(), 'start_at' => $startAt->toDateTimeString(), 'finish_at' => $finishAt->toDateTimeString(), 'capacity' => 2]);
     // ...and there is another user that may issue reservation requests...
     $this->issuer = $this->createUser();
     // ...under the addressbook Contact
     $this->contact = $this->createContact(['user_id' => $this->issuer->id]);
 }
Exemple #3
0
 /**
  * Arrange Fixture.
  *
  * @return void
  */
 protected function arrangeFixture()
 {
     // Given there is...
     // a Business owned by Me (User)
     $this->owner = $this->createUser();
     $this->issuer = $this->createUser();
     $this->business = $this->createBusiness();
     $this->business->owners()->save($this->owner);
     // And the Business provides a Service
     $this->service = $this->makeService();
     $this->business->services()->save($this->service);
     // And the Service has Vacancies to be reserved
     $this->vacancy = $this->makeVacancy();
     $this->vacancy->service()->associate($this->service);
     $this->business->vacancies()->save($this->vacancy);
     // And a Contact that holds an Appointment for that Service
     $this->contact = $this->createContact();
     $this->contact->user()->associate($this->issuer->id);
     $this->business->contacts()->save($this->contact);
 }
 /**
  * Arrange Fixture.
  *
  * @return void
  */
 protected function arrangeFixture()
 {
     // Given there is...
     // a Business owned by Me (User)
     $this->owner = $this->createUser();
     $this->issuer = $this->createUser();
     $this->business = $this->createBusiness();
     $this->business->owners()->save($this->owner);
     // And the Business provides a Service
     $this->service = $this->makeService();
     $this->business->services()->save($this->service);
     $startAt = Carbon\Carbon::parse('today 09:00 ' . $this->business->timezone)->timezone('UTC');
     $finishAt = Carbon\Carbon::parse('today 18:00 ' . $this->business->timezone)->timezone('UTC');
     // And the Service has Vacancies to be reserved
     $this->vacancy = $this->makeVacancy(['start_at' => $startAt->toDateTimeString(), 'finish_at' => $finishAt->toDateTimeString(), 'date' => $startAt->timezone($this->business->timezone)->toDateString(), 'capacity' => 2]);
     $this->vacancy->service()->associate($this->service);
     $this->business->vacancies()->save($this->vacancy);
     // And a Contact that holds an Appointment for that Service
     $this->contact = $this->createContact();
 }
 protected function arrangeBusinessWithOwner()
 {
     $this->owner = $this->createUser();
     $this->business = $this->createBusiness();
     $this->business->owners()->save($this->owner);
     $this->serviceOne = $this->createService();
     $this->serviceTwo = $this->createService();
     $this->serviceThree = $this->createService();
     $this->business->services()->save($this->serviceOne);
     $this->business->services()->save($this->serviceTwo);
     $this->business->services()->save($this->serviceThree);
     $this->vacancy = $this->createVacancy(['business_id' => $this->business->id, 'service_id' => $this->serviceOne->id]);
 }
 protected function arrangeBusinessWithOwner()
 {
     $this->owner = $this->createUser();
     $this->business = $this->createBusiness();
     $this->business->owners()->save($this->owner);
     $this->contactOne = $this->createContact();
     $this->contactTwo = $this->createContact();
     $this->contactThree = $this->createContact();
     $this->business->contacts()->save($this->contactOne);
     $this->business->contacts()->save($this->contactTwo);
     $this->business->contacts()->save($this->contactThree);
     $this->serviceOne = $this->createService();
     $this->serviceTwo = $this->createService();
     $this->serviceThree = $this->createService();
     $this->appointment = $this->makeAppointment($this->business, $this->createUser(), $this->contactOne);
     $this->appointment->save();
     $this->business->services()->save($this->serviceOne);
     $this->business->services()->save($this->serviceTwo);
     $this->business->services()->save($this->serviceThree);
 }
 protected function arrangeBusinessWithOwner()
 {
     $this->owner = $this->createUser();
     $this->business = $this->createBusiness();
     $this->business->owners()->save($this->owner);
 }