From 4fad273447b548c13f899948b4a44e50f5d28590 Mon Sep 17 00:00:00 2001 From: shalvah Date: Tue, 6 Jul 2021 12:44:11 +0100 Subject: [PATCH] Refactor tests --- tests/GenerateDocumentationTest.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/GenerateDocumentationTest.php b/tests/GenerateDocumentationTest.php index 87051627..4779252a 100644 --- a/tests/GenerateDocumentationTest.php +++ b/tests/GenerateDocumentationTest.php @@ -22,6 +22,9 @@ protected function setUp(): void parent::setUp(); config(['scribe.database_connections_to_transact' => []]); + // Skip these ones for faster tests + config(['scribe.openapi.enabled' => false]); + config(['scribe.postman.enabled' => false]); $factory = app(\Illuminate\Database\Eloquent\Factory::class); $factory->define(TestUser::class, function () { @@ -206,7 +209,6 @@ public function generated_postman_collection_file_is_correct() ], ]); config(['scribe.postman.enabled' => true]); - config(['scribe.openapi.enabled' => false]); $this->artisan('scribe:generate'); @@ -230,7 +232,6 @@ public function generated_openapi_spec_file_is_correct() // We want to have the same values for params each time config(['scribe.faker_seed' => 1234]); - config(['scribe.postman.enabled' => false]); config(['scribe.openapi.enabled' => true]); config(['scribe.openapi.overrides' => [ 'info.version' => '3.9.9', @@ -372,8 +373,6 @@ public function generates_correct_url_params_from_resource_routes_and_field_bind ]); }); config(['scribe.routes.0.match.prefixes' => ['*']]); - config(['scribe.openapi.enabled' => false]); - config(['scribe.postman.enabled' => false]); $this->artisan('scribe:generate'); @@ -387,8 +386,6 @@ public function generates_correct_url_params_from_resource_routes_and_field_bind public function will_not_extract_if_noExtraction_flag_is_set() { config(['scribe.routes.0.exclude' => ['*']]); - config(['scribe.openapi.enabled' => false]); - config(['scribe.postman.enabled' => false]); Utils::copyDirectory(__DIR__.'/Fixtures/.scribe', '.scribe'); $output = $this->artisan('scribe:generate', ['--no-extraction' => true]); @@ -412,8 +409,6 @@ public function merges_user_defined_endpoints() RouteFacade::get('/api/action1', [TestGroupController::class, 'action1']); RouteFacade::get('/api/action2', [TestGroupController::class, 'action2']); config(['scribe.routes.0.match.prefixes' => ['api/*']]); - config(['scribe.openapi.enabled' => false]); - config(['scribe.postman.enabled' => false]); if (!is_dir('.scribe/endpoints')) mkdir('.scribe/endpoints', 0777, true); copy(__DIR__ . '/Fixtures/custom.0.yaml', '.scribe/endpoints/custom.0.yaml'); @@ -443,8 +438,6 @@ public function respects_endpoints_and_group_sort_order() RouteFacade::get('/api/action1b', [TestGroupController::class, 'action1b']); RouteFacade::get('/api/action2', [TestGroupController::class, 'action2']); config(['scribe.routes.0.match.prefixes' => ['api/*']]); - config(['scribe.openapi.enabled' => false]); - config(['scribe.postman.enabled' => false]); $this->artisan('scribe:generate'); @@ -504,8 +497,6 @@ public function will_auto_set_content_type_to_multipart_if_file_params_are_prese */ RouteFacade::post('nested-file', fn() => null); config(['scribe.routes.0.match.prefixes' => ['*']]); - config(['scribe.openapi.enabled' => false]); - config(['scribe.postman.enabled' => false]); $this->artisan('scribe:generate');