File manager - Edit - /var/www/html/spdc/api/tests/Feature/OccurrencyScriptureTest.php
Back
<?php namespace Tests\Feature; use Tests\BaseTest; use App\Enums\BanType; use App\Models\PlaceType; use App\Models\Occurrency; use App\Enums\ImplementationType; use Illuminate\Http\JsonResponse; use Illuminate\Http\UploadedFile; use App\Models\OccurrencyScripture; use App\Models\OccurrencyScriptureDemolition; use App\Models\OccurrencyScriptureImpediment; use App\Models\OccurrencyScriptureInterdiction; use App\Models\OccurrencyScriptureNotification; use App\Models\OccurrencyScriptureDisinterdiction; use App\Http\Resources\OccurrencyScriptureInterdictionResource; class OccurrencyScriptureTest extends BaseTest { public function test_interdiction_store() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $occurrency = Occurrency::factory()->create(); $placeType = PlaceType::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.interdiction.store', $occurrency), JsonResponse::HTTP_CREATED, [ 'place_type_id' => $placeType->id, 'ban_type' => BanType::PONTUAL, 'implementation_type' => ImplementationType::TOTAL ] ); } public function test_interdiction_update() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $interdiction = OccurrencyScriptureInterdiction::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'put', route('occurrency-scripture.interdiction.update', $interdiction), JsonResponse::HTTP_OK, [ 'place_type_id' => $interdiction->scripture->placeType->id, 'ban_type' => BanType::AREA, 'implementation_type' => ImplementationType::PARCIAL, 'publication' => fake()->word ] ); } public function test_interdiction_pdf() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $interdiction = OccurrencyScriptureInterdiction::factory()->create(); // signing $scripture = $interdiction->scripture; $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.interdiction.pdf', $interdiction), JsonResponse::HTTP_OK ); } public function test_disinterdiction_store() { // deleting existing occurrencys OccurrencyScriptureDisinterdiction::query()->delete(); $occurrency = Occurrency::factory()->create(); $placeType = PlaceType::factory()->create(); $interdiction = OccurrencyScriptureInterdiction::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.disinterdiction.store', $occurrency), JsonResponse::HTTP_CREATED, [ 'place_type_id' => $placeType->id, 'interdiction_id' => $interdiction->id, ] ); } public function test_disinterdiction_update() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $disinterdiction = OccurrencyScriptureDisinterdiction::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'put', route('occurrency-scripture.disinterdiction.update', $disinterdiction), JsonResponse::HTTP_OK, [ 'place_type_id' => $disinterdiction->scripture->placeType->id, 'interdiction_id' => $disinterdiction->interdiction->id, 'publication' => fake()->word ] ); } public function test_disinterdiction_pdf() { // deleting existing occurrencys OccurrencyScriptureDisinterdiction::query()->delete(); $disinterdiction = OccurrencyScriptureDisinterdiction::factory()->create(); // signing $scripture = $disinterdiction->scripture; $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.disinterdiction.pdf', $disinterdiction), JsonResponse::HTTP_OK ); } public function test_notification_store() { // deleting existing occurrencys OccurrencyScriptureNotification::query()->delete(); $occurrency = Occurrency::factory()->create(); $placeType = PlaceType::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.notification.store', $occurrency), JsonResponse::HTTP_CREATED, [ 'arrangements' => fake()->paragraph, 'place_type_id' => $placeType->id, ] ); } public function test_notification_update() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $notification = OccurrencyScriptureNotification::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'put', route('occurrency-scripture.notification.update', $notification), JsonResponse::HTTP_OK, [ 'arrangements' => fake()->paragraph, 'place_type_id' => $notification->scripture->placeType->id, 'publication' => fake()->word ] ); } public function test_notification_pdf() { // deleting existing occurrencys OccurrencyScriptureNotification::query()->delete(); $notification = OccurrencyScriptureNotification::factory()->create(); // signing $scripture = $notification->scripture; $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.notification.pdf', $notification), JsonResponse::HTTP_OK ); } public function test_impediment_store() { // deleting existing occurrencys OccurrencyScriptureNotification::query()->delete(); $occurrency = Occurrency::factory()->create(); $placeType = PlaceType::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.impediment.store', $occurrency), JsonResponse::HTTP_CREATED, [ 'place_type_id' => $placeType->id, ] ); } public function test_impediment_update() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $impediment = OccurrencyScriptureImpediment::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'put', route('occurrency-scripture.impediment.update', $impediment), JsonResponse::HTTP_OK, [ 'place_type_id' => $impediment->scripture->placeType->id, 'publication' => fake()->word ] ); } public function test_impediment_pdf() { // deleting existing occurrencys OccurrencyScriptureImpediment::query()->delete(); $impediment = OccurrencyScriptureImpediment::factory()->create(); // signing $scripture = $impediment->scripture; $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.impediment.pdf', $impediment), JsonResponse::HTTP_OK ); } public function test_demolition_store() { // deleting existing occurrencys OccurrencyScriptureNotification::query()->delete(); $occurrency = Occurrency::factory()->create(); $placeType = PlaceType::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.demolition.store', $occurrency), JsonResponse::HTTP_CREATED, [ 'place_type_id' => $placeType->id, ] ); } public function test_demolition_update() { // deleting existing occurrencys OccurrencyScriptureInterdiction::query()->delete(); $demolition = OccurrencyScriptureDemolition::factory()->create(); // creating a text occurrency $response = $this->authRequest( 'put', route('occurrency-scripture.demolition.update', $demolition), JsonResponse::HTTP_OK, [ 'place_type_id' => $demolition->scripture->placeType->id, 'publication' => fake()->word ] ); } public function test_demolition_pdf() { // deleting existing occurrencys OccurrencyScriptureDemolition::query()->delete(); $demolition = OccurrencyScriptureDemolition::factory()->create(); // signing $scripture = $demolition->scripture; $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.demolition.pdf', $demolition), JsonResponse::HTTP_OK ); } public function test_list_by_occurrency() { // deleting existing occurrencys OccurrencyScripture::query()->delete(); $occurrency = Occurrency::factory()->create(); $scripture = OccurrencyScripture::factory()->state([ 'occurrency_id' => $occurrency->id ])->create(); OccurrencyScriptureInterdiction::factory(2)->state([ 'scripture_id' => $scripture->id ])->create(); OccurrencyScriptureDisinterdiction::factory(2)->state([ 'scripture_id' => $scripture->id ])->create(); OccurrencyScriptureImpediment::factory(2)->state([ 'scripture_id' => $scripture->id ])->create(); OccurrencyScriptureNotification::factory(2)->state([ 'scripture_id' => $scripture->id ])->create(); OccurrencyScriptureDemolition::factory(2)->state([ 'scripture_id' => $scripture->id ])->create(); // creating a text occurrency $response = $this->authRequest( 'get', route('occurrency-scripture.listByOccurrency', $occurrency), JsonResponse::HTTP_OK ); } public function test_sign() { // deleting existing occurrencys OccurrencyScripture::query()->delete(); $scripture = OccurrencyScripture::factory()->create(); $base64Data = base64_encode(file_get_contents('files/gatinhu2.png')); // creating a text occurrency $response = $this->authRequest( 'post', route('occurrency-scripture.sign', $scripture), JsonResponse::HTTP_OK, [ 'document' => generateValidCPF(), 'name' => fake()->name, 'email' => fake()->email, 'signature_file' => 'data:image/png;base64,' . $base64Data, ], [ 'content-type' => 'multipart/form-data' ] ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.16 |
proxy
|
phpinfo
|
Settings