diff --git a/tests/Fixtures/TestBundle/Entity/Issue5625/Currency.php b/tests/Fixtures/TestBundle/Entity/Issue5625/Currency.php new file mode 100644 index 00000000000..7086fdccff8 --- /dev/null +++ b/tests/Fixtures/TestBundle/Entity/Issue5625/Currency.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity\Issue5625; + +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\Get; +use ApiPlatform\OpenApi\Model\Operation; + +/** + * Currency. + */ +#[ApiResource(operations: [ + new Get(uriTemplate: '/get_security_1', openapi: new Operation(security: [['JWT' => ['CURRENCY_READ']]])), +])] +class Currency +{ + public $id; + public $name; +} diff --git a/tests/Symfony/Bundle/Command/OpenApiCommandTest.php b/tests/Symfony/Bundle/Command/OpenApiCommandTest.php index 7b3b1b648d0..f012a8bcc52 100644 --- a/tests/Symfony/Bundle/Command/OpenApiCommandTest.php +++ b/tests/Symfony/Bundle/Command/OpenApiCommandTest.php @@ -41,7 +41,6 @@ protected function setUp(): void $application = new Application(static::$kernel); $application->setCatchExceptions(false); $application->setAutoExit(false); - $this->tester = new ApplicationTester($application); $this->handleDeprecations(); @@ -59,6 +58,7 @@ public function testExecuteWithYaml(): void $this->tester->run(['command' => 'api:openapi:export', '--yaml' => true]); $result = $this->tester->getDisplay(); + $this->assertYaml($result); $operationId = 'api_dummy_cars_get_collection'; @@ -96,6 +96,14 @@ public function testExecuteWithYaml(): void YAML; $this->assertStringContainsString(str_replace(\PHP_EOL, "\n", $expected), $result); + + $expected = <<assertStringContainsString(str_replace(\PHP_EOL, "\n", $expected), $result); } public function testWriteToFile(): void