/** @test */ public function createFlowTemplate_WithMultipleLocationStepAttached_DeleteAllLocationStep() { $flowTemplate = FlowTemplate::create($this->flowTemplateData()); $locationStep1 = LocationStep::create($this->locationStepData()); $locationStep2 = LocationStep::create($this->locationStepData()); $locationStep3 = LocationStep::create($this->locationStepData()); $locationStep4 = LocationStep::create($this->locationStepData()); $flowTemplate->locationStep()->save($locationStep1); $flowTemplate->locationStep()->save($locationStep2); $flowTemplate->locationStep()->save($locationStep3); $flowTemplate->locationStep()->save($locationStep4); $locationStep1->delete(); $locationStep2->delete(); $locationStep3->delete(); $locationStep4->delete(); $flowTemplateCreated = FlowTemplate::find($flowTemplate->id); $this->assertCount(0, $flowTemplateCreated->locationStep); $flowTemplate->delete(); }