From f157255c020ff2874ee8f2a680ef943f3f2fcf1f Mon Sep 17 00:00:00 2001 From: Ahmed Ashraf <118922563+ahmedashraf093@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:34:45 +0300 Subject: [PATCH 1/3] Changing the namespace to RonasIT/AutoDoc solving #62 --- composer.json | 8 ++-- config/auto-doc.php | 8 ++-- readme.md | 8 ++-- src/AutoDocServiceProvider.php | 4 +- src/Commands/PushDocumentationCommand.php | 4 +- src/Drivers/BaseDriver.php | 4 +- src/Drivers/LocalDriver.php | 4 +- src/Drivers/RemoteDriver.php | 4 +- src/Drivers/StorageDriver.php | 4 +- src/Exceptions/DocFileNotExistsException.php | 2 +- src/Exceptions/EmptyContactEmailException.php | 2 +- src/Exceptions/EmptyDocFileException.php | 2 +- .../InvalidDriverClassException.php | 2 +- src/Exceptions/LegacyConfigException.php | 2 +- .../MissedProductionFilePathException.php | 2 +- .../MissedRemoteDocumentationUrlException.php | 2 +- .../DuplicateFieldException.php | 2 +- .../DuplicateParamException.php | 2 +- .../DuplicatePathPlaceholderException.php | 2 +- .../InvalidFieldValueException.php | 2 +- .../SpecValidation/InvalidPathException.php | 2 +- .../InvalidStatusCodeException.php | 2 +- .../InvalidSwaggerSpecException.php | 2 +- .../InvalidSwaggerVersionException.php | 4 +- .../MissingExternalRefException.php | 2 +- .../SpecValidation/MissingFieldException.php | 2 +- .../MissingLocalRefException.php | 2 +- .../MissingPathParamException.php | 2 +- .../MissingPathPlaceholderException.php | 2 +- .../MissingRefFileException.php | 2 +- .../SwaggerDriverClassNotFoundException.php | 2 +- ...nsupportedDocumentationViewerException.php | 2 +- .../WrongSecurityConfigException.php | 2 +- src/Http/Controllers/AutoDocController.php | 4 +- src/Http/Middleware/AutoDocMiddleware.php | 4 +- src/Http/routes.php | 2 +- src/Interfaces/SwaggerDriverInterface.php | 2 +- src/Services/SwaggerService.php | 26 +++++----- src/Tests/AutoDocTestCaseTrait.php | 4 +- .../SwaggerSaveDocumentationSubscriber.php | 4 +- .../PhpUnitExtensions/SwaggerExtension.php | 4 +- src/Traits/GetDependenciesTrait.php | 2 +- src/Validators/SwaggerSpecValidator.php | 32 ++++++------- tests/AutoDocControllerTest.php | 8 ++-- tests/AutoDocMiddlewareTest.php | 6 +-- tests/LocalDriverTest.php | 6 +-- tests/PushDocumentationCommandTest.php | 4 +- tests/RemoteDriverTest.php | 8 ++-- tests/StorageDriverTest.php | 6 +-- tests/SwaggerServiceTest.php | 48 +++++++++---------- tests/TestCase.php | 6 +-- ..._post_user_request_with_object_params.json | 2 +- tests/support/Mock/TestContract.php | 2 +- tests/support/Mock/TestController.php | 2 +- .../support/Mock/TestNotificationSetting.php | 2 +- tests/support/Mock/TestRequest.php | 2 +- .../Mock/TestRequestWithAnnotations.php | 2 +- .../Mock/TestRequestWithoutRuleType.php | 2 +- .../support/Mock/TestRuleWithToStringRule.php | 2 +- .../Mock/TestRuleWithoutToStringRule.php | 2 +- tests/support/Traits/MockTrait.php | 2 +- .../Traits/SwaggerServiceMockTrait.php | 4 +- 62 files changed, 149 insertions(+), 149 deletions(-) diff --git a/composer.json b/composer.json index 21876a91..c7f71fcd 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "autoload": { "psr-4": { - "RonasIT\\Support\\AutoDoc\\": "src/" + "RonasIT\\AutoDoc\\": "src/" }, "exclude-from-classmap": [ "src/Tests/" @@ -36,14 +36,14 @@ }, "autoload-dev": { "psr-4": { - "RonasIT\\Support\\Tests\\": "tests/", - "RonasIT\\Support\\Tests\\Support\\": "tests/support/" + "RonasIT\\Tests\\": "tests/", + "RonasIT\\Tests\\Support\\": "tests/support/" } }, "extra": { "laravel": { "providers": [ - "RonasIT\\Support\\AutoDoc\\AutoDocServiceProvider" + "RonasIT\\AutoDoc\\AutoDocServiceProvider" ] } } diff --git a/config/auto-doc.php b/config/auto-doc.php index 30b01285..e704fa24 100644 --- a/config/auto-doc.php +++ b/config/auto-doc.php @@ -1,8 +1,8 @@ env('SWAGGER_DRIVER', 'local'), diff --git a/readme.md b/readme.md index dcee86fe..1e1ca85d 100644 --- a/readme.md +++ b/readme.md @@ -39,20 +39,20 @@ passing PHPUnit tests. > ```php > 'providers' => [ > // ... - > RonasIT\Support\AutoDoc\AutoDocServiceProvider::class, + > RonasIT\AutoDoc\AutoDocServiceProvider::class, > ], > ``` 1. Run `php artisan vendor:publish` - 2. Add `\RonasIT\Support\AutoDoc\Http\Middleware\AutoDocMiddleware::class` middleware to the global HTTP middleware stack in `Http/Kernel.php`. - 3. Add `\RonasIT\Support\AutoDoc\Tests\AutoDocTestCaseTrait` trait to `tests/TestCase.php` + 2. Add `\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class` middleware to the global HTTP middleware stack in `Http/Kernel.php`. + 3. Add `\RonasIT\AutoDoc\Tests\AutoDocTestCaseTrait` trait to `tests/TestCase.php` 4. Configure documentation saving using one of the next ways: - Add `SwaggerExtension` to the `` block of your `phpunit.xml`. **Please note that this way will be removed after updating** **PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)** ```xml - + diff --git a/src/AutoDocServiceProvider.php b/src/AutoDocServiceProvider.php index ec4a2764..0e6d435b 100644 --- a/src/AutoDocServiceProvider.php +++ b/src/AutoDocServiceProvider.php @@ -1,9 +1,9 @@ config('auto-doc.global_prefix')], function () { Route::get('/auto-doc/documentation', ['uses' => AutoDocController::class . '@documentation']); diff --git a/src/Interfaces/SwaggerDriverInterface.php b/src/Interfaces/SwaggerDriverInterface.php index 45ba0fc7..d1b8131c 100644 --- a/src/Interfaces/SwaggerDriverInterface.php +++ b/src/Interfaces/SwaggerDriverInterface.php @@ -1,6 +1,6 @@ getFunctionMock('RonasIT\Support\AutoDoc\Services', 'report'); + $mock = $this->getFunctionMock('RonasIT\AutoDoc\Services', 'report'); $mock->expects($this->once()); config([ @@ -73,7 +73,7 @@ public function testGetJSONDocumentationDoesntExist() public function testGetJSONDocumentationIsEmpty() { - $mock = $this->getFunctionMock('RonasIT\Support\AutoDoc\Services', 'report'); + $mock = $this->getFunctionMock('RonasIT\AutoDoc\Services', 'report'); $mock->expects($this->once()); config([ diff --git a/tests/AutoDocMiddlewareTest.php b/tests/AutoDocMiddlewareTest.php index 05bc2056..f24ca294 100644 --- a/tests/AutoDocMiddlewareTest.php +++ b/tests/AutoDocMiddlewareTest.php @@ -1,9 +1,9 @@ Date: Tue, 8 Oct 2024 12:26:06 +0300 Subject: [PATCH 2/3] change test from RonasIT\Tests -> RonasIT\AudoDoc\Tests --- composer.json | 4 ++-- tests/AutoDocControllerTest.php | 4 ++-- tests/AutoDocMiddlewareTest.php | 4 ++-- tests/LocalDriverTest.php | 2 +- tests/PushDocumentationCommandTest.php | 4 ++-- tests/RemoteDriverTest.php | 4 ++-- tests/StorageDriverTest.php | 2 +- tests/SwaggerServiceTest.php | 6 +++--- tests/TestCase.php | 4 ++-- .../tmp_data_post_user_request_with_object_params.json | 2 +- tests/support/Mock/TestContract.php | 2 +- tests/support/Mock/TestController.php | 2 +- tests/support/Mock/TestNotificationSetting.php | 2 +- tests/support/Mock/TestRequest.php | 2 +- tests/support/Mock/TestRequestWithAnnotations.php | 2 +- tests/support/Mock/TestRequestWithoutRuleType.php | 2 +- tests/support/Mock/TestRuleWithToStringRule.php | 2 +- tests/support/Mock/TestRuleWithoutToStringRule.php | 2 +- tests/support/Traits/MockTrait.php | 2 +- tests/support/Traits/SwaggerServiceMockTrait.php | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index c7f71fcd..bce83664 100644 --- a/composer.json +++ b/composer.json @@ -36,8 +36,8 @@ }, "autoload-dev": { "psr-4": { - "RonasIT\\Tests\\": "tests/", - "RonasIT\\Tests\\Support\\": "tests/support/" + "RonasIT\\AutoDoc\\Tests\\": "tests/", + "RonasIT\\AutoDoc\\Tests\\Support\\": "tests/support/" } }, "extra": { diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index 140f5a11..daaf8cae 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -1,10 +1,10 @@ Date: Thu, 10 Oct 2024 17:28:24 +0600 Subject: [PATCH 3/3] Update tests/fixtures/SwaggerServiceTest/tmp_data_post_user_request_with_object_params.json --- .../tmp_data_post_user_request_with_object_params.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/fixtures/SwaggerServiceTest/tmp_data_post_user_request_with_object_params.json b/tests/fixtures/SwaggerServiceTest/tmp_data_post_user_request_with_object_params.json index a7f6fcce..b413590c 100644 --- a/tests/fixtures/SwaggerServiceTest/tmp_data_post_user_request_with_object_params.json +++ b/tests/fixtures/SwaggerServiceTest/tmp_data_post_user_request_with_object_params.json @@ -103,7 +103,6 @@ }, "required": ["query"] }, - "postUsers200ResponseObject": { "type": "array", "properties": {