/**
  * @test
  */
 public function it_updates_the_vacancy_in_simple_mode()
 {
     $this->arrangeBusinessWithOwner();
     $this->actingAs($this->vacancy->business->owner());
     $this->visit(route('manager.business.vacancy.create', $this->vacancy->business));
     $newCapacity = $this->vacancy->capacity + 5;
     $this->type($newCapacity, "vacancy[{$this->vacancy->date}][{$this->vacancy->service->id}]");
     $this->press('Update');
     $this->assertEquals($this->vacancy->fresh()->capacity, $newCapacity);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 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);
     $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();
 }