File manager - Edit - /var/www/html/gop/api/tests/Feature/FaseServicoTest.php
Back
<?php namespace Tests\Feature; use App\Models\FaseServico; use Illuminate\Http\JsonResponse; use Illuminate\Http\UploadedFile; use Tests\BaseTest; class FaseServicoTest extends BaseTest { public function test_index() { FaseServico::factory(5)->create(); $this->authRequest( 'get', route('fase-servico.index'), ); } public function test_store() { $request = FaseServico::factory()->make()->toArray(); $this->authRequest( 'post', route('fase-servico.store'), JsonResponse::HTTP_CREATED, $request, ); } public function test_show() { $faseServico = FaseServico::factory()->create(); $this->authRequest( 'get', route('fase-servico.show', $faseServico->id), ); } public function test_update() { $faseServico = FaseServico::factory()->create(); $request = FaseServico::factory()->make()->toArray(); $this->authRequest( 'put', route('fase-servico.update', $faseServico->id), JsonResponse::HTTP_OK, $request, ); } public function test_destroy() { $faseServico = FaseServico::factory()->create(); $this->authRequest( 'delete', route('fase-servico.destroy', $faseServico->id), JsonResponse::HTTP_NO_CONTENT, ); } public function test_storeImage_and_showImage() { $servico = FaseServico::factory()->create(); $image = new UploadedFile( storage_path('test/assinatura.png'), 'assinatura.png', 'image/png', null, true ); $request = [ 'image' => $image, ]; $response = $this->authRequest( 'post', route('servico.storeImage', $servico->id), JsonResponse::HTTP_CREATED, $request, ); $this->authRequest( 'get', route('servico.showModelImages', $servico->id), JsonResponse::HTTP_OK, $request, ); $this->removeTestFiles($response->json()['path']); } public function test_setPrivateFields_and_showPrivateFields() { $servico = FaseServico::factory()->create(); $request = [ 'fields' => [ 'id', ], ]; $this->authRequest( 'post', route('servico.setPrivateFields', $servico->id), JsonResponse::HTTP_OK, $request, ); $this->authRequest( 'get', route('servico.showPrivateFields', $servico->id), ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings