Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Jul 6, 2021
1 parent 40ef514 commit 4fad273
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tests/GenerateDocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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');

Expand All @@ -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',
Expand Down Expand Up @@ -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');

Expand All @@ -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]);
Expand All @@ -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');
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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');

Expand Down

0 comments on commit 4fad273

Please sign in to comment.