File manager - Edit - /var/www/html/spdc/api/tests/Feature/MinuteBookTest.php
Back
<?php namespace Tests\Feature; use Tests\BaseTest; use App\Models\Form; use App\Models\Field; use App\Models\MinuteBook; use Illuminate\Http\JsonResponse; use App\Enums\OccurrencyScriptureType; use AluisioPires\LaravelBaseTest\BaseTestTransactions; class MinuteBookTest extends BaseTest { public function test_index() { // deleting existing minuteBooks MinuteBook::query()->delete(); // creating two minuteBooks MinuteBook::factory(2)->create(); $response = $this->authRequest( 'get', route('minute-book.index'), JsonResponse::HTTP_OK ); $response->assertJsonCount(2, 'data.data'); } public function test_index_with_filter() { // deleting existing forms MinuteBook::query()->delete(); // creating two forms $minuteBooks = MinuteBook::factory(2)->create(); $response = $this->authRequest( 'get', route('minute-book.index', [ 'type' => \App\Enums\ClassName::getValueByKey('entrada_manual') ]), JsonResponse::HTTP_OK ); } // public function test_index_without_pages() // { // // deleting existing fields // MinuteBook::query()->delete(); // // creating two fields // MinuteBook::factory(2)->create(); // $response = $this->authRequest( // 'get', // route('minute-book.index', [ // 'without_pages' => true // ]), // JsonResponse::HTTP_OK // ); // } public function test_store() { // deleting existing minuteBooks MinuteBook::query()->delete(); // creating a text minuteBook $response = $this->authRequest( 'post', route('minute-book.store'), JsonResponse::HTTP_CREATED, MinuteBook::factory()->make()->toArray() ); } // public function test_store_with_invalid_fields() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // // creating a text minuteBook // $response = $this->authRequest( // 'post', // route('minute-book.store'), // JsonResponse::HTTP_UNPROCESSABLE_ENTITY, // MinuteBook::factory()->invalidRequest()->make()->toArray() // ); // } // public function test_store_without_required_fields() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $response = $this->authRequest( // 'post', // route('minute-book.store'), // JsonResponse::HTTP_UNPROCESSABLE_ENTITY, // MinuteBook::factory()->make()->toArray() // ); // $response = $this->authRequest( // 'post', // route('minute-book.store'), // JsonResponse::HTTP_UNPROCESSABLE_ENTITY, // MinuteBook::factory()->withoutName()->make()->toArray() // ); // } // public function test_show() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $minuteBook = MinuteBook::factory()->create(); // $form = Form::factory()->create(); // $fields = Field::factory(2)->create(); // $form->fields()->attach($fields->pluck('id')->toArray()); // $minuteBook->forms()->attach($form->id, ['section' => 'VISTORIA']); // // creating a text minuteBook // $response = $this->authRequest( // 'get', // route('minute-book.show', $minuteBook) // ); // $response->assertSeeText('forms'); // $response->assertSeeText('fields'); // } // public function test_show_with_section_query_filter() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $minuteBook = MinuteBook::factory()->create(); // $formRegistro = Form::factory()->create(); // $formVistoria = Form::factory()->create(); // $formExecucao = Form::factory()->create(); // $fields = Field::factory(2)->create(); // $formRegistro->fields()->attach($fields->pluck('id')->toArray()); // $formVistoria->fields()->attach($fields->pluck('id')->toArray()); // $formExecucao->fields()->attach($fields->pluck('id')->toArray()); // $minuteBook->forms()->attach($formRegistro->id, ['section' => 'REGISTRO']); // $minuteBook->forms()->attach($formVistoria->id, ['section' => 'VISTORIA']); // $minuteBook->forms()->attach($formExecucao->id, ['section' => 'EXECUÇÃO']); // // creating a text minuteBook // $response = $this->authRequest( // 'get', // route('minute-book.show', [$minuteBook, 'section' => 'EXECUÇÃO']) // ); // // $response->assertSeeText('forms'); // // $response->assertSeeText('fields'); // // dump($response->json()); // } // public function test_update() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $minuteBook = MinuteBook::factory()->create(); // $response = $this->authRequest( // 'put', // route('minute-book.update', $minuteBook), // JsonResponse::HTTP_OK, // MinuteBook::factory()->make()->toArray() // ); // $response->assertSeeText('forms'); // $response->assertSeeText('fields'); // } // public function test_destroy() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $minuteBook = MinuteBook::factory()->create(); // // creating a text minuteBook // $response = $this->authRequest( // 'delete', // route('minute-book.destroy', $minuteBook), // JsonResponse::HTTP_NO_CONTENT // ); // } // public function test_destroy_many() // { // // deleting existing minuteBooks // MinuteBook::query()->delete(); // $minuteBooks = MinuteBook::factory(3)->create(); // // creating a text minuteBook // $response = $this->authRequest( // 'post', // route('minute-book.destroyMany'), // JsonResponse::HTTP_NO_CONTENT, // [ // 'minute_books' => $minuteBooks->pluck('id')->toArray() // ] // ); // } // public function test_enum() // { // dd(); // } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.13 |
proxy
|
phpinfo
|
Settings