make(); $response = $this->post(route('plan.store'), $form->toArray()); $response->assertStatus(201); } public function test_plan_list() { Plan::factory(30)->create(); $response = $this->get(route('plan.index')); $response->assertStatus(200) ->assertJsonStructure([ 'data' => [ '*' => [ 'id', 'title', 'requirement_total', 'project_total', 'begin', 'end', 'description', ] ] ]); } public function test_plan_show() { $plan = Plan::factory()->create(); $response = $this->get(route('plan.show', ['plan' => $plan->id])); $response->assertStatus(200) ->assertJsonStructure([ 'data' => [ 'id', 'title', 'requirement_total', 'asset_id', 'parent_id', 'project_total', 'begin', 'end', 'description', ] ]); } public function test_plan_update(): void { $plan = Plan::factory()->create(); $form = Plan::factory()->make(); $response = $this->put(route('plan.update', ['plan' => $plan->id]), $form->toArray()); $response->assertStatus(204); $newAsset = Plan::find($plan->id); $this->assertEquals($form->name, $newAsset->name); } public function test_plan_delete(): void { $plan = Plan::factory()->create(); $response = $this->delete(route('plan.destroy', ['plan' => $plan->id])); $response->assertStatus(204); $this->assertNull(Plan::find($plan->id)); } }