diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6fabe66..a505eda 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -36,7 +36,6 @@ jobs: symfony-require: "5.4.*" - php-version: 8.1 symfony-require: "6.0.*" - api-platform: "early" steps: - name: "Checkout" diff --git a/Tests/Functional/Entity/Dummy.php b/Tests/Functional/Entity/Dummy.php index ece0fb1..145aa46 100644 --- a/Tests/Functional/Entity/Dummy.php +++ b/Tests/Functional/Entity/Dummy.php @@ -12,9 +12,11 @@ namespace Nelmio\ApiDocBundle\Tests\Functional\Entity; use ApiPlatform\Core\Annotation\ApiProperty; +use Nelmio\ApiDocBundle\Tests\Functional\EntityExcluded; +// BC Api-Platform < 3.x if (!class_exists(ApiProperty::class)) { - class_alias(Dummy81::class, Dummy::class); + class Dummy extends EntityExcluded\ApiPlatform3\Dummy {} } else { - class_alias(Dummy71::class, Dummy::class); + class_alias(EntityExcluded\ApiPlatform2\Dummy::class, Dummy::class); } diff --git a/Tests/Functional/Entity/Dummy71.php b/Tests/Functional/EntityExcluded/ApiPlatform2/Dummy.php similarity index 84% rename from Tests/Functional/Entity/Dummy71.php rename to Tests/Functional/EntityExcluded/ApiPlatform2/Dummy.php index ef05cdc..5b9ce09 100644 --- a/Tests/Functional/Entity/Dummy71.php +++ b/Tests/Functional/EntityExcluded/ApiPlatform2/Dummy.php @@ -9,17 +9,16 @@ * file that was distributed with this source code. */ -namespace Nelmio\ApiDocBundle\Tests\Functional\Entity; +namespace Nelmio\ApiDocBundle\Tests\Functional\EntityExcluded\ApiPlatform2; -use ApiPlatform\Metadata\ApiProperty; -use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Core\Annotation\ApiProperty; +use ApiPlatform\Core\Annotation\ApiResource; use Symfony\Component\Validator\Constraints as Assert; /** * @author Guilhem N. * * @ApiResource( - * shortName="Dummy", * collectionOperations={ * "get"={"method"="GET"}, * "custom2"={"path"="/foo", "method"="GET"}, @@ -28,7 +27,7 @@ use Symfony\Component\Validator\Constraints as Assert; * itemOperations={"get"={"method"="GET"}}) * ) */ -class Dummy71 +class Dummy { /** * @var int diff --git a/Tests/Functional/Entity/Dummy81.php b/Tests/Functional/EntityExcluded/ApiPlatform3/Dummy.php similarity index 92% rename from Tests/Functional/Entity/Dummy81.php rename to Tests/Functional/EntityExcluded/ApiPlatform3/Dummy.php index 7b5387a..1ed84fa 100644 --- a/Tests/Functional/Entity/Dummy81.php +++ b/Tests/Functional/EntityExcluded/ApiPlatform3/Dummy.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Nelmio\ApiDocBundle\Tests\Functional\Entity; +namespace Nelmio\ApiDocBundle\Tests\Functional\EntityExcluded\ApiPlatform3; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; @@ -23,7 +23,6 @@ use Symfony\Component\Validator\Constraints as Assert; */ #[ ApiResource( - shortName: 'Dummy', operations: [ new Get(name: 'get'), new Get(name: 'custom2', uriTemplate: '/foo'), @@ -32,7 +31,7 @@ use Symfony\Component\Validator\Constraints as Assert; ], ) ] -class Dummy81 +class Dummy { /** * @var int diff --git a/Tests/Functional/TestKernel.php b/Tests/Functional/TestKernel.php index 15d9771..0006cc5 100644 --- a/Tests/Functional/TestKernel.php +++ b/Tests/Functional/TestKernel.php @@ -11,6 +11,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; +use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Symfony\Bundle\ApiPlatformBundle; use Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle; use FOS\RestBundle\FOSRestBundle; @@ -163,7 +164,11 @@ class TestKernel extends Kernel ]); $c->loadFromExtension('api_platform', [ - 'mapping' => ['paths' => ['%kernel.project_dir%/Tests/Functional/Entity']], + 'mapping' => ['paths' => [ + !class_exists(ApiProperty::class) + ? '%kernel.project_dir%/Tests/Functional/EntityExcluded/ApiPlatform3' + : '%kernel.project_dir%/Tests/Functional/EntityExcluded/ApiPlatform2' + ]], ]); $c->loadFromExtension('fos_rest', [