File manager - Edit - /var/www/html/gop/api/tests/Feature/PrestadorTest.php
Back
<?php namespace Tests\Feature; use App\Models\Prestador; use Illuminate\Http\JsonResponse; use Illuminate\Http\UploadedFile; use Tests\BaseTest; class PrestadorTest extends BaseTest { public function test_index() { Prestador::factory(10)->create(); $this->authRequest( 'get', route('prestador.index'), ); } public function test_store() { $prestadorArray = Prestador::factory()->make()->toArray(); $file = new UploadedFile( storage_path('test/assinatura.png'), 'assinatura.png', 'image/png', null, true ); $prestadorArray['assinatura'] = $file; $response = $this->authRequest( 'post', route('prestador.store'), JsonResponse::HTTP_CREATED, $prestadorArray, ); $path = storage_path(str($response->json('assinatura'))->replace('storage', 'app/public')); $this->removeTestFiles($path); } public function test_show() { $prestador = Prestador::factory()->create(); $response = $this->authRequest( 'get', route('prestador.show', $prestador->id), ); } public function test_update() { $prestador = Prestador::factory()->create(); $prestadorArray = Prestador::factory()->make()->toArray(); $file = new UploadedFile( storage_path('test/assinatura.png'), 'assinatura.png', 'image/png', null, true ); $prestadorArray['assinatura'] = $file; $response = $this->authRequest( 'put', route('prestador.update', $prestador->id), JsonResponse::HTTP_OK, $prestadorArray, ); $path = storage_path(str($response->json('assinatura'))->replace('storage', 'app/public')); $this->removeTestFiles($path); } public function test_destroy() { $prestador = Prestador::factory()->create(); $response = $this->authRequest( 'delete', route('prestador.destroy', $prestador->id), JsonResponse::HTTP_NO_CONTENT, ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings