diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index f5b67bab..1f113020 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -13,7 +13,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" steps: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ccbe9e1e..b57f266c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,7 +13,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" steps: diff --git a/.github/workflows/mutation-test.yml b/.github/workflows/mutation-test.yml index bb60d3f6..1e622102 100644 --- a/.github/workflows/mutation-test.yml +++ b/.github/workflows/mutation-test.yml @@ -13,7 +13,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" steps: @@ -43,7 +43,7 @@ jobs: if: ${{ matrix.dependencies == 'locked' }} run: "composer install --no-interaction --no-progress --no-suggest" - name: "Infection" - run: "vendor/bin/infection --only-covered --test-framework-options=\"--testsuite=unit\"" + run: "vendor/bin/roave-infection-static-analysis-plugin --only-covered --test-framework-options=\"--testsuite=unit\"" env: INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }} STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index d204e330..d7fa8413 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -13,7 +13,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" steps: diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 87f5e899..ff458ede 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -16,6 +16,7 @@ jobs: - "locked" php-version: - "7.4" + - "8.0" operating-system: - "ubuntu-latest" - "windows-latest" diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 6c57a484..7960da96 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -13,7 +13,7 @@ jobs: dependencies: - "locked" php-version: - - "7.4" + - "8.0" operating-system: - "ubuntu-latest" steps: diff --git a/composer.json b/composer.json index 2eed9bf7..40c23157 100644 --- a/composer.json +++ b/composer.json @@ -22,42 +22,43 @@ } ], "require": { - "php": ">=7.4.1,<7.5.0", + "php": "^7.4|^8.0", "ext-json": "*", "cebe/php-openapi": "^1.4", - "league/openapi-psr7-validator": "^0.9.0", - "lukasoppermann/http-status": "^2.0", - "nikic/php-parser": "^4.5", + "league/openapi-psr7-validator": "^0.14.0", + "lukasoppermann/http-status": "^3.1", + "nikic/php-parser": "^4.10", "nyholm/psr7": "^1.3", - "phpdocumentor/reflection-docblock": "^5.1", - "sspat/reserved-words": "^1.0", - "symfony/cache": "^5.0", - "symfony/config": "^5.0", - "symfony/console": "^5.0", - "symfony/dependency-injection": "^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/process": "^5.0", + "phpdocumentor/reflection-docblock": "^5.2", + "sspat/reserved-words": "^2.0", + "symfony/cache": "^5.1", + "symfony/config": "^5.1.4", + "symfony/console": "^5.1", + "symfony/dependency-injection": "^5.1.4", + "symfony/event-dispatcher": "^5.1", + "symfony/http-kernel": "^5.1", + "symfony/process": "^5.1", "symfony/psr-http-message-bridge": "^2.0", - "symfony/routing": "^5.0", - "symfony/yaml": "^5.0", - "thecodingmachine/safe": "^1.0" + "symfony/routing": "^5.1", + "symfony/yaml": "^5.1", + "thecodingmachine/safe": "^1.3" }, "require-dev": { - "doctrine/coding-standard": "^8.1.0", - "infection/infection": "^0.16.4", + "doctrine/coding-standard": "^8.2", + "infection/infection": "^0.20.2", "matthiasnoback/symfony-config-test": "^4.2", - "matthiasnoback/symfony-dependency-injection-test": "^4.1", - "phpstan/phpstan": "^0.12.33", - "phpstan/phpstan-phpunit": "^0.12.13", - "phpstan/phpstan-strict-rules": "^0.12.4", - "phpunit/phpunit": "^9.2.6", + "matthiasnoback/symfony-dependency-injection-test": "^4.2", + "phpstan/phpstan": "^0.12.64", + "phpstan/phpstan-phpunit": "^0.12.17", + "phpstan/phpstan-strict-rules": "^0.12.7", + "phpunit/phpunit": "^9.5", + "roave/infection-static-analysis-plugin": "^1.6", "sensiolabs/security-checker": "^6.0", - "squizlabs/php_codesniffer": "^3.5.5", + "squizlabs/php_codesniffer": "^3.5", "symfony/browser-kit": "^5.1", "symfony/framework-bundle": "^5.1", - "thecodingmachine/phpstan-safe-rule": "^1.0.0", - "vimeo/psalm": "^3.12.2" + "thecodingmachine/phpstan-safe-rule": "^1.0", + "vimeo/psalm": "^4.3" }, "minimum-stability": "dev", "prefer-stable": true, @@ -86,7 +87,7 @@ "stan": "phpstan analyse --memory-limit=-1", "sec": "security-checker security:check", "tests": "phpunit --fail-on-warning", - "mutation": "infection --only-covered --test-framework-options=\"--testsuite=unit\"", + "mutation": "vendor/bin/roave-infection-static-analysis-plugin --only-covered --test-framework-options=\"--testsuite=unit\"", "all": "composer psalm && composer stan && composer tests && composer mutation && composer cs && composer sec" } } diff --git a/test/functional/Command/.gitignore b/test/functional/.gitignore similarity index 100% rename from test/functional/Command/.gitignore rename to test/functional/.gitignore diff --git a/test/functional/Command/CommandTestCase.php b/test/functional/Command/CommandTestCase.php index 55e122a7..0b13d351 100644 --- a/test/functional/Command/CommandTestCase.php +++ b/test/functional/Command/CommandTestCase.php @@ -4,33 +4,52 @@ namespace OnMoon\OpenApiServerBundle\Test\Functional\Command; +use OnMoon\OpenApiServerBundle\Test\Functional\TestKernel; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; + +use function get_class; abstract class CommandTestCase extends KernelTestCase { - /** - * phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint - * @var string $class - */ - protected static $class = CommandTestKernel::class; - protected string $openapiNamespace = 'PetStore'; protected string $openapiOperationId = 'getGood'; protected CommandTester $commandTester; protected Application $application; + /** + * @param mixed[] $data + */ + public function __construct(?string $name = null, array $data = [], string $dataName = '') + { + parent::__construct($name, $data, $dataName); + + $kernelClass = new class ('test', true) extends TestKernel { + protected function configureContainer(ContainerConfigurator $c): void + { + } + + protected function configureRoutes(RoutingConfigurator $routes): void + { + } + }; + + self::$class = get_class($kernelClass); + } + public function setUp(): void { - $this->application = new Application(static::bootKernel()); + $this->application = new Application(self::bootKernel()); } public function tearDown(): void { $filesystem = new Filesystem(); - $filesystem->remove([CommandTestKernel::$bundleRootPath]); + $filesystem->remove([TestKernel::$bundleRootPath]); unset($this->commandTester, $this->application); parent::tearDown(); } diff --git a/test/functional/Command/DeleteGeneratedCodeCommandTest.php b/test/functional/Command/DeleteGeneratedCodeCommandTest.php index c5aaa101..f2839537 100644 --- a/test/functional/Command/DeleteGeneratedCodeCommandTest.php +++ b/test/functional/Command/DeleteGeneratedCodeCommandTest.php @@ -5,6 +5,7 @@ namespace OnMoon\OpenApiServerBundle\Test\Functional\Command; use OnMoon\OpenApiServerBundle\Command\DeleteGeneratedCodeCommand; +use OnMoon\OpenApiServerBundle\Test\Functional\TestKernel; use PHPUnit\Framework\Assert; use Symfony\Component\Console\Tester\CommandTester; @@ -25,8 +26,8 @@ public function setUp(): void $command = $this->application->find(DeleteGeneratedCodeCommand::COMMAND); $this->commandTester = new CommandTester($command); - mkdir(CommandTestKernel::$bundleRootPath); - file_put_contents(CommandTestKernel::$bundleRootPath . '/test.txt', ''); + mkdir(TestKernel::$bundleRootPath); + file_put_contents(TestKernel::$bundleRootPath . '/test.txt', ''); } public function testDeletion(): void @@ -38,9 +39,9 @@ public function testDeletion(): void ]); $output = $this->commandTester->getDisplay(); - Assert::assertEquals(sprintf('Delete all contents of the directory %1$s? (y/n): All contents of directory were deleted: %1$s', CommandTestKernel::$bundleRootPath), rtrim($output)); + Assert::assertEquals(sprintf('Delete all contents of the directory %1$s? (y/n): All contents of directory were deleted: %1$s', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); - Assert::assertFileDoesNotExist(CommandTestKernel::$bundleRootPath . '/test.txt'); + Assert::assertFileDoesNotExist(TestKernel::$bundleRootPath . '/test.txt'); } public function testDeletionCancel(): void @@ -52,9 +53,9 @@ public function testDeletionCancel(): void ]); $output = $this->commandTester->getDisplay(); - Assert::assertEquals(sprintf('Delete all contents of the directory %1$s? (y/n):', CommandTestKernel::$bundleRootPath), rtrim($output)); + Assert::assertEquals(sprintf('Delete all contents of the directory %1$s? (y/n):', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); - Assert::assertDirectoryExists(CommandTestKernel::$bundleRootPath); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/test.txt'); + Assert::assertDirectoryExists(TestKernel::$bundleRootPath); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/test.txt'); } } diff --git a/test/functional/Command/GenerateApiCodeCommandTest.php b/test/functional/Command/GenerateApiCodeCommandTest.php index cf04d88d..b49259eb 100644 --- a/test/functional/Command/GenerateApiCodeCommandTest.php +++ b/test/functional/Command/GenerateApiCodeCommandTest.php @@ -5,6 +5,7 @@ namespace OnMoon\OpenApiServerBundle\Test\Functional\Command; use OnMoon\OpenApiServerBundle\Command\GenerateApiCodeCommand; +use OnMoon\OpenApiServerBundle\Test\Functional\TestKernel; use PHPUnit\Framework\Assert; use Symfony\Component\Console\Tester\CommandTester; @@ -31,14 +32,14 @@ public function testGeneration(): void ]); $output = $this->commandTester->getDisplay(); - Assert::assertEquals(sprintf('API server code generated in: %s', CommandTestKernel::$bundleRootPath), rtrim($output)); + Assert::assertEquals(sprintf('API server code generated in: %s', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); - Assert::assertDirectoryExists(CommandTestKernel::$bundleRootPath); - Assert::assertDirectoryIsReadable(CommandTestKernel::$bundleRootPath); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/ServiceSubscriber/ApiServiceLoaderServiceSubscriber.php'); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/' . ucfirst($this->openapiOperationId) . '.php'); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Request/' . ucfirst($this->openapiOperationId) . 'RequestDto.php'); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Request/PathParameters/PathParametersDto.php'); - Assert::assertFileExists(CommandTestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Response/OK/' . ucfirst($this->openapiOperationId) . 'OKDto.php'); + Assert::assertDirectoryExists(TestKernel::$bundleRootPath); + Assert::assertDirectoryIsReadable(TestKernel::$bundleRootPath); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/ServiceSubscriber/ApiServiceLoaderServiceSubscriber.php'); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/' . ucfirst($this->openapiOperationId) . '.php'); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Request/' . ucfirst($this->openapiOperationId) . 'RequestDto.php'); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Request/PathParameters/PathParametersDto.php'); + Assert::assertFileExists(TestKernel::$bundleRootPath . '/Apis/' . $this->openapiNamespace . '/' . ucfirst($this->openapiOperationId) . '/Dto/Response/OK/' . ucfirst($this->openapiOperationId) . 'OKDto.php'); } } diff --git a/test/functional/Command/RefreshApiCodeCommandTest.php b/test/functional/Command/RefreshApiCodeCommandTest.php index 15fb0751..34dbb331 100644 --- a/test/functional/Command/RefreshApiCodeCommandTest.php +++ b/test/functional/Command/RefreshApiCodeCommandTest.php @@ -6,6 +6,7 @@ use OnMoon\OpenApiServerBundle\Command\ProcessFactory; use OnMoon\OpenApiServerBundle\Command\RefreshApiCodeCommand; +use OnMoon\OpenApiServerBundle\Test\Functional\TestKernel; use PHPUnit\Framework\Assert; use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Console\Tester\CommandTester; @@ -40,7 +41,7 @@ public function testRefreshingAcceptedByUser(): void ->expects(self::atLeast(2)) ->method('getProcess'); - $command = new RefreshApiCodeCommand(CommandTestKernel::$bundleRootPath, $this->processFactory, self::COMMAND); + $command = new RefreshApiCodeCommand(TestKernel::$bundleRootPath, $this->processFactory, self::COMMAND); $this->application->add($command); $this->commandTester = new CommandTester($command); @@ -51,7 +52,7 @@ public function testRefreshingAcceptedByUser(): void ]); $output = $this->commandTester->getDisplay(); - Assert::assertEquals(sprintf('Delete all contents of the directory %s? (y/n):', CommandTestKernel::$bundleRootPath), rtrim($output)); + Assert::assertEquals(sprintf('Delete all contents of the directory %s? (y/n):', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); } @@ -61,7 +62,7 @@ public function testRefreshingDeclinedByUser(): void ->expects(self::never()) ->method('getProcess'); - $command = new RefreshApiCodeCommand(CommandTestKernel::$bundleRootPath, $this->processFactory, self::COMMAND); + $command = new RefreshApiCodeCommand(TestKernel::$bundleRootPath, $this->processFactory, self::COMMAND); $this->application->add($command); $this->commandTester = new CommandTester($command); @@ -72,7 +73,7 @@ public function testRefreshingDeclinedByUser(): void ]); $output = $this->commandTester->getDisplay(); - Assert::assertEquals(sprintf('Delete all contents of the directory %s? (y/n):', CommandTestKernel::$bundleRootPath), rtrim($output)); + Assert::assertEquals(sprintf('Delete all contents of the directory %s? (y/n):', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); } } diff --git a/test/functional/Controller/ApiControllerTest.php b/test/functional/Controller/ApiControllerTest.php index dedbd4dc..26eb9b9c 100644 --- a/test/functional/Controller/ApiControllerTest.php +++ b/test/functional/Controller/ApiControllerTest.php @@ -7,15 +7,19 @@ use OnMoon\OpenApiServerBundle\Command\GenerateApiCodeCommand; use OnMoon\OpenApiServerBundle\Controller\ApiController; use OnMoon\OpenApiServerBundle\Interfaces\ApiLoader; +use OnMoon\OpenApiServerBundle\Test\Functional\TestKernel; use PHPUnit\Framework\Assert; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\AbstractBrowser; use Symfony\Component\BrowserKit\HttpBrowser; use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; +use function get_class; use function Safe\file_put_contents; use function Safe\json_decode; @@ -24,14 +28,28 @@ */ class ApiControllerTest extends WebTestCase { + private AbstractBrowser $client; + /** - * phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint - * @var string $class + * @param mixed[] $data */ - protected static $class = ControllerTestKernel::class; + public function __construct(?string $name = null, array $data = [], string $dataName = '') + { + parent::__construct($name, $data, $dataName); + $kernelClass = new class ('test', true) extends TestKernel { + protected function configureContainer(ContainerConfigurator $c): void + { + } - private AbstractBrowser $client; + protected function configureRoutes(RoutingConfigurator $routes): void + { + $routes->import(__DIR__ . '/openapi_routes.yaml'); + } + }; + + self::$class = get_class($kernelClass); + } public function setUp(): void { @@ -47,7 +65,7 @@ public function setUp(): void static::$container->set('petstore.getGood', new $getGoodImplClassName()); - $apiLoaderClass = ControllerTestKernel::$bundleRootNamespace . '\ServiceSubscriber\ApiServiceLoaderServiceSubscriber'; + $apiLoaderClass = TestKernel::$bundleRootNamespace . '\ServiceSubscriber\ApiServiceLoaderServiceSubscriber'; /** @var ApiLoader $apiLoader */ $apiLoader = new $apiLoaderClass(static::$container); @@ -59,7 +77,7 @@ public function setUp(): void public function tearDown(): void { $filesystem = new Filesystem(); - $filesystem->remove([ControllerTestKernel::$bundleRootPath]); + $filesystem->remove([TestKernel::$bundleRootPath]); unset($this->client); parent::tearDown(); } @@ -89,11 +107,11 @@ private function createGetGoodImpl(): string declare(strict_types=1); -namespace OnMoon\OpenApiServerBundle\Test\Functional\Controller\Generated; +namespace OnMoon\OpenApiServerBundle\Test\Functional\Generated; -use OnMoon\OpenApiServerBundle\Test\Functional\Controller\Generated\Apis\PetStore\GetGood\Dto\Request\GetGoodRequestDto; -use OnMoon\OpenApiServerBundle\Test\Functional\Controller\Generated\Apis\PetStore\GetGood\Dto\Response\OK\GetGoodOKDto; -use OnMoon\OpenApiServerBundle\Test\Functional\Controller\Generated\Apis\PetStore\GetGood\GetGood; +use OnMoon\OpenApiServerBundle\Test\Functional\Generated\Apis\PetStore\GetGood\Dto\Request\GetGoodRequestDto; +use OnMoon\OpenApiServerBundle\Test\Functional\Generated\Apis\PetStore\GetGood\Dto\Response\OK\GetGoodOKDto; +use OnMoon\OpenApiServerBundle\Test\Functional\Generated\Apis\PetStore\GetGood\GetGood; class GetGoodImpl implements GetGood { @@ -104,8 +122,8 @@ public function getGood(GetGoodRequestDto \$request): GetGoodOKDto } EOD; - file_put_contents(ControllerTestKernel::$bundleRootPath . '/GetGoodImpl.php', $content); + file_put_contents(TestKernel::$bundleRootPath . '/GetGoodImpl.php', $content); - return ControllerTestKernel::$bundleRootNamespace . '\GetGoodImpl'; + return TestKernel::$bundleRootNamespace . '\GetGoodImpl'; } } diff --git a/test/functional/Controller/ControllerTestKernel.php b/test/functional/Controller/ControllerTestKernel.php deleted file mode 100644 index 512ee2da..00000000 --- a/test/functional/Controller/ControllerTestKernel.php +++ /dev/null @@ -1,98 +0,0 @@ - __DIR__ . '/openapi_specification.yaml', - 'type' => 'yaml', - 'name_space' => 'PetStore', - 'media_type' => 'application/json', - ]; - $container->prependExtensionConfig('open_api_server', [ - 'root_path' => static::$bundleRootPath, - 'root_name_space' => static::$bundleRootNamespace, - 'language_level' => '7.4.0', - 'generated_dir_permissions' => 0755, - 'full_doc_blocks' => false, - 'send_nulls' => false, - 'specs' => [$specificationName => $specification], - ]); - - $container->prependExtensionConfig( - 'framework', - ['test' => true] - ); - } - - /** - * @inheritDoc - */ - public function getCacheDir() - { - return __DIR__ . '/var/cache'; - } - - /** - * @inheritDoc - */ - public function getLogDir() - { - return __DIR__ . '/var/log'; - } - - protected function configureContainer(ContainerConfigurator $container): void - { - } - - protected function configureRoutes(RoutingConfigurator $routes): void - { - $routes->import(__DIR__ . '/openapi_routes.yaml'); - } - - /** - * {@inheritdoc} - */ - public function registerBundles(): iterable - { - $contents = [ - FrameworkBundle::class => ['test' => true], - OpenApiServerBundle::class => ['test' => true], - ]; - foreach ($contents as $class => $envs) { - if (! ($envs[$this->environment] ?? $envs['all'] ?? false)) { - continue; - } - - yield new $class(); - } - } - - public function shutdown(): void - { - $filesystem = new Filesystem(); - $filesystem->remove([__DIR__ . '/var']); - - parent::shutdown(); - } -} diff --git a/test/functional/Controller/openapi_specification.yaml b/test/functional/Controller/openapi_specification.yaml deleted file mode 100644 index 680a4b3e..00000000 --- a/test/functional/Controller/openapi_specification.yaml +++ /dev/null @@ -1,36 +0,0 @@ -openapi: '3.0.3' -info: - title: 'Test Goods API' - version: '1.0' -paths: - '/goods/{goodId}': - get: - operationId: "getGood" - parameters: - - $ref: '#/components/parameters/GoodIdParam' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/GoodResponseSchema' -components: - schemas: - GoodResponseSchema: - title: Good Response - type: object - properties: - title: - type: string - required: - - title - parameters: - GoodIdParam: - name: goodId - in: path - required: true - schema: - type: string - description: Good ID - example: 136 diff --git a/test/functional/Command/CommandTestKernel.php b/test/functional/TestKernel.php similarity index 79% rename from test/functional/Command/CommandTestKernel.php rename to test/functional/TestKernel.php index 4492b4f6..2aff3432 100644 --- a/test/functional/Command/CommandTestKernel.php +++ b/test/functional/TestKernel.php @@ -2,18 +2,16 @@ declare(strict_types=1); -namespace OnMoon\OpenApiServerBundle\Test\Functional\Command; +namespace OnMoon\OpenApiServerBundle\Test\Functional; use OnMoon\OpenApiServerBundle\OpenApiServerBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -class CommandTestKernel extends BaseKernel +abstract class TestKernel extends BaseKernel { use MicroKernelTrait; @@ -30,8 +28,8 @@ protected function build(ContainerBuilder $container): void 'media_type' => 'application/json', ]; $container->prependExtensionConfig('open_api_server', [ - 'root_path' => static::$bundleRootPath, - 'root_name_space' => static::$bundleRootNamespace, + 'root_path' => self::$bundleRootPath, + 'root_name_space' => self::$bundleRootNamespace, 'language_level' => '7.4.0', 'generated_dir_permissions' => 0755, 'full_doc_blocks' => false, @@ -61,14 +59,6 @@ public function getLogDir() return __DIR__ . '/var/log'; } - protected function configureContainer(ContainerConfigurator $container): void - { - } - - protected function configureRoutes(RoutingConfigurator $routes): void - { - } - /** * {@inheritdoc} */ diff --git a/test/functional/Command/openapi_specification.yaml b/test/functional/openapi_specification.yaml similarity index 100% rename from test/functional/Command/openapi_specification.yaml rename to test/functional/openapi_specification.yaml diff --git a/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php b/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php index 95a35949..07cda2ac 100644 --- a/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php +++ b/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php @@ -19,7 +19,7 @@ use const PHP_EOL; /** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\CodeGenerator; + * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\CodeGenerator */ class CodeGeneratorTest extends TestCase {