This commit is contained in:
Guilhem Niot 2022-09-25 21:47:11 +02:00
parent cf8635eb95
commit 2862d8cf6f
5 changed files with 16 additions and 12 deletions

View File

@ -36,7 +36,6 @@ jobs:
symfony-require: "5.4.*"
- php-version: 8.1
symfony-require: "6.0.*"
api-platform: "early"
steps:
- name: "Checkout"

View File

@ -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);
}

View File

@ -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. <egetick@gmail.com>
*
* @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

View File

@ -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

View File

@ -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', [