Merge branch '3.x'

This commit is contained in:
Guilhem Niot 2020-05-31 17:54:32 +02:00
commit 58f791c0f7
4 changed files with 23 additions and 23 deletions

View File

@ -29,7 +29,6 @@ matrix:
before_install:
- phpenv config-rm xdebug.ini || true
- if [ "$SYMFONY_VERSION" == "^5.0" ]; then composer remove friendsofsymfony/rest-bundle --dev; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --dev --no-update; fi;
install: composer update --no-interaction $COMPOSER_FLAGS

View File

@ -11,7 +11,6 @@
namespace Nelmio\ApiDocBundle\Tests\Functional;
use FOS\RestBundle\FOSRestBundle;
use OpenApi\Annotations as OA;
class FOSRestTest extends WebTestCase
@ -25,10 +24,6 @@ class FOSRestTest extends WebTestCase
public function testFOSRestAction()
{
if (!class_exists(FOSRestBundle::class)) {
$this->markTestSkipped('FOSRestBundle is not installed.');
}
$operation = $this->getOperation('/api/fosrest', 'post');
$this->assertHasParameter('foo', 'query', $operation);

View File

@ -58,12 +58,9 @@ class TestKernel extends Kernel
new ApiPlatformBundle(),
new NelmioApiDocBundle(),
new TestBundle(),
new FOSRestBundle(),
];
if (class_exists(FOSRestBundle::class)) {
$bundles[] = new FOSRestBundle();
}
if ($this->useJMS) {
$bundles[] = new JMSSerializerBundle();
@ -87,15 +84,12 @@ class TestKernel extends Kernel
$routes->import('', '/api', 'api_platform');
$routes->add('/docs/{area}', 'nelmio_api_doc.controller.swagger_ui')->setDefault('area', 'default');
$routes->add('/docs.json', 'nelmio_api_doc.controller.swagger');
$routes->import(__DIR__.'/Controller/FOSRestController.php', '/', 'annotation');
if (class_exists(SerializedName::class)) {
$routes->import(__DIR__.'/Controller/SerializedNameController.php', '/', 'annotation');
}
if (class_exists(FOSRestBundle::class)) {
$routes->import(__DIR__.'/Controller/FOSRestController.php', '/', 'annotation');
}
if ($this->useJMS) {
$routes->import(__DIR__.'/Controller/JMSController.php', '/', 'annotation');
}
@ -134,6 +128,7 @@ class TestKernel extends Kernel
$c->loadFromExtension('twig', [
'strict_variables' => '%kernel.debug%',
'exception_controller' => null,
]);
$c->loadFromExtension('sensio_framework_extra', [
@ -146,7 +141,6 @@ class TestKernel extends Kernel
'mapping' => ['paths' => ['%kernel.project_dir%/Tests/Functional/Entity']],
]);
if (class_exists(FOSRestBundle::class)) {
$c->loadFromExtension('fos_rest', [
'format_listener' => [
'rules' => [
@ -157,6 +151,18 @@ class TestKernel extends Kernel
],
],
]);
// If FOSRestBundle 2.8
if (class_exists(\FOS\RestBundle\EventListener\ResponseStatusCodeListener::class)) {
$c->loadFromExtension('fos_rest', [
'exception' => [
'enabled' => false,
'exception_listener' => false,
'serialize_exceptions' => false,
],
'body_listener' => false,
'routing_loader' => false,
]);
}
// Filter routes

View File

@ -43,7 +43,7 @@
"doctrine/common": "^2.4",
"api-platform/core": "^2.4",
"friendsofsymfony/rest-bundle": "^2.0",
"friendsofsymfony/rest-bundle": "^2.0|^3.0@beta",
"willdurand/hateoas-bundle": "^1.0|^2.0",
"jms/serializer-bundle": "^2.3|^3.0",
"jms/serializer": "^1.14|^3.0"