File manager - Edit - /var/www/html/gop/api/tests/Feature/FornecimentoTest.php
Back
<?php namespace Tests\Feature; use App\Models\Fornecimento; use App\Models\Material; use Illuminate\Http\JsonResponse; use Tests\BaseTest; class FornecimentoTest extends BaseTest { public function removeTestFiles($path) { $path = str_replace('\\', '/', $path); $storagePath = storage_path('app/'.str($path)->after('storage/')); parent::removeTestFiles($storagePath); } public function test_index() { Fornecimento::factory(10)->create(); $this->authRequest( 'get', route('fornecimento.index'), ); } public function test_gera_pdf() { $fornecimento = Fornecimento::factory()->has(Material::factory(5), 'materiais')->create(); $response = $this->authRequest( 'get', route('fornecimento.geraPdf', $fornecimento->id), ); $this->removeTestFiles($response->json()); } public function test_store() { $fornecimentoArray = Fornecimento::factory()->make()->toArray(); $this->authRequest( 'post', route('fornecimento.store'), JsonResponse::HTTP_CREATED, $fornecimentoArray, ); } public function test_show() { $fornecimento = Fornecimento::factory()->create(); $this->authRequest( 'get', route('fornecimento.show', $fornecimento->id), ); } public function test_update() { $fornecimento = Fornecimento::factory()->create(); $fornecimentoArray = Fornecimento::factory()->make()->toArray(); $this->authRequest( 'put', route('fornecimento.update', $fornecimento->id), JsonResponse::HTTP_OK, $fornecimentoArray, ); } public function test_destroy() { $fornecimento = Fornecimento::factory()->create(); $this->authRequest( 'delete', route('fornecimento.destroy', $fornecimento->id), JsonResponse::HTTP_NO_CONTENT, ); } public function test_PrivateFields() { $model = Fornecimento::factory()->create(); $request = [ 'fields' => [ 'id', ], ]; $this->authRequest( 'post', route('fornecimento.setPrivateFields', $model->id), JsonResponse::HTTP_OK, $request, ); $this->authRequest( 'get', route('fornecimento.showPrivateFields', $model->id), ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings