/** * 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(); }
/** * @test */ public function it_removes_the_business_service() { $this->arrangeBusinessWithOwner(); $service = $this->makeService(); $this->business->services()->save($service); $this->assertCount(1, $this->business->fresh()->services); $this->actingAs($this->owner); $this->call('DELETE', route('manager.business.service.destroy', ['business' => $this->business, 'service' => $service])); $this->assertCount(0, $this->business->fresh()->services); }
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); }