File manager - Edit - /var/www/html/spdc/api/tests/Unit/OptionTest.php
Back
<?php namespace Tests\Unit; use Tests\BaseTest; use App\Models\Scale; use App\Models\Category; use App\Models\ScaleTeam; use App\Models\ScaleFunction; use App\Models\OccurrencyType; use App\Enums\ScaleFunctionType; use Illuminate\Http\JsonResponse; class OptionTest extends BaseTest { public function test_validations() { $this->authRequest( 'get', route('option.validations') ); } public function test_occurrency_types() { $occurrencyTypes = OccurrencyType::factory(3)->create(); $response = $this->authRequest( 'get', route('option.occurrencyTypes') ); $category = Category::factory()->create(); $category->occurrencyTypes()->attach($occurrencyTypes->pluck('id')->toArray()); $response = $this->authRequest( 'get', route('option.occurrencyTypes', [ 'category_id' => $category->id ]) ); $categoryTwo = Category::factory()->create(); $categoryTwo->occurrencyTypes()->attach($occurrencyTypes->pluck('id')->toArray()); $response = $this->authRequest( 'get', route('option.occurrencyTypes',[ 'with_category' => 1 ]) ); } public function test_external_agents() { $response = $this->authRequest( 'get', route('option.externalAgents') ); // dump($response->json()); } public function test_scale_functions() { $scaleFunction = ScaleFunction::factory(6)->create(); $response = $this->authRequest( 'get', route('option.scaleFunctions') ); // dump($response->json()); } public function test_scale_functions_with_filters() { ScaleFunction::factory(2)->state(['type' => ScaleFunctionType::EXTERNO->value])->create(); ScaleFunction::factory(3)->state(['type' => ScaleFunctionType::INTERNO->value])->create(); $response = $this->authRequest( 'get', route('option.scaleFunctions', [ 'type' => ScaleFunctionType::EXTERNO->value ]) ); dump($response->json()); } public function test_internal_agents() { $scaleFunction = ScaleFunction::factory()->withInternalAgents()->create(); $department = \App\Models\Department::orderBy('id', 'desc')->first(); $response = $this->authRequest( 'get', route('option.internalAgents'), JsonResponse::HTTP_OK, [ 'scale_function_id' => $scaleFunction->id, 'department_id' => $department->id ] ); // dd($response->json()); } public function test_internal_agents_with_zero_options() { $scaleFunction = ScaleFunction::factory()->create(); $department = \App\Models\Department::orderBy('id', 'desc')->first(); $response = $this->authRequest( 'get', route('option.internalAgents'), JsonResponse::HTTP_OK, [ 'scale_function_id' => $scaleFunction->id, 'department_id' => $department->id ] ); // dump($response->json()); } public function test_internal_agents_without_scale_function_id() { $response = $this->authRequest( 'get', route('option.internalAgents'), JsonResponse::HTTP_UNPROCESSABLE_ENTITY ); // dump($response->json()); } public function test_scale_teams() { ScaleTeam::factory(6)->create(); $response = $this->authRequest( 'get', route('option.scaleTeams') ); // dump($response->json()); } public function test_available_scales() { Scale::factory(6)->create(); $response = $this->authRequest( 'get', route('option.availableScales') ); dump($response->json()); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings