Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions tests/Fixtures/TestBundle/Entity/Issue5625/Currency.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* 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;
}
10 changes: 9 additions & 1 deletion tests/Symfony/Bundle/Command/OpenApiCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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';

Expand Down Expand Up @@ -96,6 +96,14 @@ public function testExecuteWithYaml(): void
YAML;

$this->assertStringContainsString(str_replace(\PHP_EOL, "\n", $expected), $result);

$expected = <<<YAML
security:
-
JWT:
- CURRENCY_READ
YAML;
$this->assertStringContainsString(str_replace(\PHP_EOL, "\n", $expected), $result);
}

public function testWriteToFile(): void
Expand Down