{!! $sol !!} namespace Tests\Feature\{{class_basename($model)}}; use App\Models\{{class_basename($model)}}; use Tests\Bootstrap; use App\Models\User; class {{class_basename($model)}}ShowTest extends Bootstrap { public function test_{{lcfirst(class_basename($model))}}_show_success() { $this->modelWithPolicy('{{$model->getTable()}}', ['permission:{{$model->getTable()}}.show']) ->loginAs(['{{$model->getTable()}}.show']) ->getJson(route("api.{{$model->getTable()}}.show", ${{lcfirst(class_basename($model))}} = $this->one({{class_basename($model)}}::class))) ->assertOk(); } public function test_{{lcfirst(class_basename($model))}}_show_not_found() { $this->modelWithPolicy('{{$model->getTable()}}', ['permission:{{$model->getTable()}}.show']) ->loginAs(['{{$model->getTable()}}.show']) ->getJson(route("api.{{$model->getTable()}}.show", 0)) ->assertNotFound(); } public function test_{{lcfirst(class_basename($model))}}_show_forbidden() { $this->modelWithPolicy('{{$model->getTable()}}', ['permission:{{$model->getTable()}}.show']) ->loginAs(['wrong.permission']) ->getJson(route("api.{{$model->getTable()}}.show", ${{lcfirst(class_basename($model))}} = $this->one({{class_basename($model)}}::class)), []) ->assertForbidden(); } }