From 2764e006378837a9fe087ec9817d5f6c71ecc846 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 14 Dec 2018 12:28:27 +0100 Subject: [PATCH 1/7] drop support for unmaintained Symfony versions --- .travis.yml | 3 --- composer.json | 40 ++++++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0fcde98ed..5e2ddc101 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,9 +18,6 @@ matrix: - php: 5.5 env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak - php: 5.6 - # Symfony 2 LTS - - php: 7.0 - env: SYMFONY_LTS='^2' # Symfony 3 LTS - php: 7.0 env: SYMFONY_LTS='^3' diff --git a/composer.json b/composer.json index be067a029..4e03a0e79 100644 --- a/composer.json +++ b/composer.json @@ -30,17 +30,17 @@ "require": { "php": "^5.5.9|~7.0", "psr/log": "^1.0", - "symfony/config": "^2.7|^3.0|^4.0", - "symfony/debug": "^2.7|^3.0|^4.0", - "symfony/dependency-injection": "^2.7|^3.0|^4.0", - "symfony/event-dispatcher": "^2.7|^3.0|^4.0", - "symfony/finder": "^2.7|^3.0|^4.0", - "symfony/framework-bundle": "^2.7|^3.0|^4.0", - "symfony/http-foundation": "^2.7|^3.0|^4.0", - "symfony/http-kernel": "^2.7|^3.0|^4.0", - "symfony/routing": "^2.7|^3.0|^4.0", - "symfony/security-core": "^2.7|^3.0|^4.0", - "symfony/templating": "^2.7|^3.0|^4.0", + "symfony/config": "^3.4|^4.0", + "symfony/debug": "^3.4|^4.0", + "symfony/dependency-injection": "^3.4|^4.0", + "symfony/event-dispatcher": "^3.4|^4.0", + "symfony/finder": "^3.4|^4.0", + "symfony/framework-bundle": "^3.4|^4.0", + "symfony/http-foundation": "^3.4|^4.0", + "symfony/http-kernel": "^3.4|^4.0", + "symfony/routing": "^3.4|^4.0", + "symfony/security-core": "^3.4|^4.0", + "symfony/templating": "^3.4|^4.0", "doctrine/inflector": "^1.0", "willdurand/negotiation": "^2.0", "willdurand/jsonp-callback-validator": "^1.0" @@ -48,18 +48,18 @@ "require-dev": { "sensio/framework-extra-bundle": "^3.0.13|^4.0|^5.0", "symfony/phpunit-bridge": "^4.1.8", - "symfony/asset": "^2.7|^3.0|^4.0", - "symfony/form": "^2.7|^3.0|^4.0", - "symfony/validator": "^2.7|^3.0|^4.0", + "symfony/asset": "^3.4|^4.0", + "symfony/form": "^3.4|^4.0", + "symfony/validator": "^3.4|^4.0", "symfony/serializer": "^2.7.11|^3.0.4|^4.0", - "symfony/yaml": "^2.7|^3.0|^4.0", - "symfony/security-bundle": "^2.7|^3.0|^4.0", - "symfony/web-profiler-bundle": "^2.7|^3.0|^4.0", - "symfony/twig-bundle": "^2.7|^3.0|^4.0", - "symfony/browser-kit": "^2.7|^3.0|^4.0", + "symfony/yaml": "^3.4|^4.0", + "symfony/security-bundle": "^3.4|^4.0", + "symfony/web-profiler-bundle": "^3.4|^4.0", + "symfony/twig-bundle": "^3.4|^4.0", + "symfony/browser-kit": "^3.4|^4.0", "symfony/dependency-injection": "^2.7.20|^3.0|^4.0", "symfony/expression-language": "~2.7|^3.0|^4.0", - "symfony/css-selector": "^2.7|^3.0|^4.0", + "symfony/css-selector": "^3.4|^4.0", "phpoption/phpoption": "^1.1", "jms/serializer-bundle": "^2.0|^3.0", "jms/serializer": "^1.13|^2.0", From 8e009b760a3abef06a43499e660d146afcb7a13f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 14 Dec 2018 12:32:20 +0100 Subject: [PATCH 2/7] replace Controller with AbstractController --- .../Controller/AnnotatedConditionalUsersController.php | 4 ++-- .../Controller/AnnotatedNonPluralizedArticleController.php | 4 ++-- Tests/Fixtures/Controller/AnnotatedPrefixedController.php | 4 ++-- Tests/Fixtures/Controller/AnnotatedUsersController.php | 4 ++-- .../Fixtures/Controller/AnnotatedVersionUserController.php | 4 ++-- Tests/Fixtures/Controller/ArticleController.php | 4 ++-- .../Controller/Directory/UserTopicCommentsController.php | 4 ++-- .../Fixtures/Controller/Directory/UserTopicsController.php | 4 ++-- Tests/Fixtures/Controller/Directory/UsersController.php | 4 ++-- Tests/Fixtures/Controller/InformationController.php | 4 ++-- Tests/Fixtures/Controller/MediaController.php | 4 ++-- Tests/Fixtures/Controller/OrdersController.php | 4 ++-- Tests/Fixtures/Controller/ReportController.php | 4 ++-- Tests/Fixtures/Controller/UserTopicCommentsController.php | 4 ++-- Tests/Fixtures/Controller/UserTopicsController.php | 4 ++-- Tests/Fixtures/Controller/UsersController.php | 4 ++-- .../Bundle/TestBundle/Controller/ArticleController.php | 4 ++-- .../Bundle/TestBundle/Controller/ParamFetcherController.php | 4 ++-- .../Controller/RequestBodyParamConverterController.php | 4 ++-- .../TestBundle/Controller/SerializerErrorController.php | 4 ++-- .../Bundle/TestBundle/Controller/Version2Controller.php | 4 ++-- .../Bundle/TestBundle/Controller/VersionController.php | 4 ++-- Tests/Functional/app/config/default.yml | 1 + Tests/Functional/app/config/services.yaml | 6 ++++++ 24 files changed, 51 insertions(+), 44 deletions(-) create mode 100644 Tests/Functional/app/config/services.yaml diff --git a/Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php b/Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php index 52921cda9..0346dddb3 100644 --- a/Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php +++ b/Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php @@ -22,10 +22,10 @@ use FOS\RestBundle\Controller\Annotations\Put; use FOS\RestBundle\Controller\Annotations\Route; use FOS\RestBundle\Controller\Annotations\Unlink; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use FOS\RestBundle\Tests\Fixtures\User; -class AnnotatedConditionalUsersController extends Controller +class AnnotatedConditionalUsersController extends AbstractController { /** * [OPTIONS] /users. diff --git a/Tests/Fixtures/Controller/AnnotatedNonPluralizedArticleController.php b/Tests/Fixtures/Controller/AnnotatedNonPluralizedArticleController.php index 541f82e9f..3f265904d 100644 --- a/Tests/Fixtures/Controller/AnnotatedNonPluralizedArticleController.php +++ b/Tests/Fixtures/Controller/AnnotatedNonPluralizedArticleController.php @@ -11,13 +11,13 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; +use FOS\RestBundle\Controller\AbstractFOSRestController; use FOS\RestBundle\Controller\Annotations as Rest; -use FOS\RestBundle\Controller\FOSRestController; /** * @Rest\RouteResource("Article", pluralize=false) */ -class AnnotatedNonPluralizedArticleController extends FOSRestController +class AnnotatedNonPluralizedArticleController extends AbstractFOSRestController { /** * [GET] /article. diff --git a/Tests/Fixtures/Controller/AnnotatedPrefixedController.php b/Tests/Fixtures/Controller/AnnotatedPrefixedController.php index b398f023d..03178ee09 100644 --- a/Tests/Fixtures/Controller/AnnotatedPrefixedController.php +++ b/Tests/Fixtures/Controller/AnnotatedPrefixedController.php @@ -12,14 +12,14 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; use FOS\RestBundle\Controller\Annotations\Prefix; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; /** * @author Donald Tyler * @Prefix("aprefix") */ -class AnnotatedPrefixedController extends Controller +class AnnotatedPrefixedController extends AbstractController { /** * [GET] /aprefix/something.{_format}. diff --git a/Tests/Fixtures/Controller/AnnotatedUsersController.php b/Tests/Fixtures/Controller/AnnotatedUsersController.php index 684b9619b..54f08efe6 100644 --- a/Tests/Fixtures/Controller/AnnotatedUsersController.php +++ b/Tests/Fixtures/Controller/AnnotatedUsersController.php @@ -29,9 +29,9 @@ use FOS\RestBundle\Controller\Annotations\Route; use FOS\RestBundle\Controller\Annotations\Unlink; use FOS\RestBundle\Controller\Annotations\Unlock; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class AnnotatedUsersController extends Controller +class AnnotatedUsersController extends AbstractController { /** * @Options diff --git a/Tests/Fixtures/Controller/AnnotatedVersionUserController.php b/Tests/Fixtures/Controller/AnnotatedVersionUserController.php index 226db84b9..c901662b3 100644 --- a/Tests/Fixtures/Controller/AnnotatedVersionUserController.php +++ b/Tests/Fixtures/Controller/AnnotatedVersionUserController.php @@ -13,12 +13,12 @@ use FOS\RestBundle\Controller\Annotations\Version; use FOS\RestBundle\Controller\Annotations\Get; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; /** * @Version({"v1", "v3"}) */ -class AnnotatedVersionUserController extends Controller +class AnnotatedVersionUserController extends AbstractController { /** * [GET, HEAD] /users/{slug}/v2. diff --git a/Tests/Fixtures/Controller/ArticleController.php b/Tests/Fixtures/Controller/ArticleController.php index 625d9bd0b..f8487a5ed 100644 --- a/Tests/Fixtures/Controller/ArticleController.php +++ b/Tests/Fixtures/Controller/ArticleController.php @@ -13,11 +13,11 @@ use FOS\RestBundle\Controller\ControllerTrait; use FOS\RestBundle\Routing\ClassResourceInterface; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Validator\ConstraintViolationList; -class ArticleController extends Controller implements ClassResourceInterface +class ArticleController extends AbstractController implements ClassResourceInterface { use ControllerTrait; diff --git a/Tests/Fixtures/Controller/Directory/UserTopicCommentsController.php b/Tests/Fixtures/Controller/Directory/UserTopicCommentsController.php index 6baf5118c..73bedc3af 100644 --- a/Tests/Fixtures/Controller/Directory/UserTopicCommentsController.php +++ b/Tests/Fixtures/Controller/Directory/UserTopicCommentsController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller\Directory; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class UserTopicCommentsController extends Controller +class UserTopicCommentsController extends AbstractController { public function getCommentsAction($slug, $title) { diff --git a/Tests/Fixtures/Controller/Directory/UserTopicsController.php b/Tests/Fixtures/Controller/Directory/UserTopicsController.php index 27cabc2d0..e9fc8e875 100644 --- a/Tests/Fixtures/Controller/Directory/UserTopicsController.php +++ b/Tests/Fixtures/Controller/Directory/UserTopicsController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller\Directory; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class UserTopicsController extends Controller +class UserTopicsController extends AbstractController { public function getTopicsAction($slug) { diff --git a/Tests/Fixtures/Controller/Directory/UsersController.php b/Tests/Fixtures/Controller/Directory/UsersController.php index 6454a1695..a68271f88 100644 --- a/Tests/Fixtures/Controller/Directory/UsersController.php +++ b/Tests/Fixtures/Controller/Directory/UsersController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller\Directory; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class UsersController extends Controller +class UsersController extends AbstractController { public function getUsersAction() { diff --git a/Tests/Fixtures/Controller/InformationController.php b/Tests/Fixtures/Controller/InformationController.php index 205ee0977..3da7edb44 100644 --- a/Tests/Fixtures/Controller/InformationController.php +++ b/Tests/Fixtures/Controller/InformationController.php @@ -13,9 +13,9 @@ use FOS\RestBundle\Controller\ControllerTrait; use FOS\RestBundle\Routing\ClassResourceInterface; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class InformationController extends Controller implements ClassResourceInterface +class InformationController extends AbstractController implements ClassResourceInterface { use ControllerTrait; diff --git a/Tests/Fixtures/Controller/MediaController.php b/Tests/Fixtures/Controller/MediaController.php index b8bef22b7..eec652d46 100644 --- a/Tests/Fixtures/Controller/MediaController.php +++ b/Tests/Fixtures/Controller/MediaController.php @@ -13,9 +13,9 @@ use FOS\RestBundle\Controller\ControllerTrait; use FOS\RestBundle\Routing\ClassResourceInterface; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class MediaController extends Controller implements ClassResourceInterface +class MediaController extends AbstractController implements ClassResourceInterface { use ControllerTrait; diff --git a/Tests/Fixtures/Controller/OrdersController.php b/Tests/Fixtures/Controller/OrdersController.php index 22074d1ad..9ada23699 100644 --- a/Tests/Fixtures/Controller/OrdersController.php +++ b/Tests/Fixtures/Controller/OrdersController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class OrdersController extends Controller +class OrdersController extends AbstractController { /** * [GET] /foos. diff --git a/Tests/Fixtures/Controller/ReportController.php b/Tests/Fixtures/Controller/ReportController.php index 9e7e28daa..6a30dd5c0 100644 --- a/Tests/Fixtures/Controller/ReportController.php +++ b/Tests/Fixtures/Controller/ReportController.php @@ -13,12 +13,12 @@ use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\ControllerTrait; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; /** * Class ReportController. */ -class ReportController extends Controller +class ReportController extends AbstractController { use ControllerTrait; diff --git a/Tests/Fixtures/Controller/UserTopicCommentsController.php b/Tests/Fixtures/Controller/UserTopicCommentsController.php index df190d569..0dad08e42 100644 --- a/Tests/Fixtures/Controller/UserTopicCommentsController.php +++ b/Tests/Fixtures/Controller/UserTopicCommentsController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class UserTopicCommentsController extends Controller +class UserTopicCommentsController extends AbstractController { /** * [GET] /users/{slug}/topics/{title}/comments. diff --git a/Tests/Fixtures/Controller/UserTopicsController.php b/Tests/Fixtures/Controller/UserTopicsController.php index 910fd6af4..2372f8646 100644 --- a/Tests/Fixtures/Controller/UserTopicsController.php +++ b/Tests/Fixtures/Controller/UserTopicsController.php @@ -11,9 +11,9 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -class UserTopicsController extends Controller +class UserTopicsController extends AbstractController { /** * [GET] /users/{slug}/topics. diff --git a/Tests/Fixtures/Controller/UsersController.php b/Tests/Fixtures/Controller/UsersController.php index adaf6e2ee..a80c54a77 100644 --- a/Tests/Fixtures/Controller/UsersController.php +++ b/Tests/Fixtures/Controller/UsersController.php @@ -11,10 +11,10 @@ namespace FOS\RestBundle\Tests\Fixtures\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; -class UsersController extends Controller +class UsersController extends AbstractController { public function copyUserAction($id) { diff --git a/Tests/Functional/Bundle/TestBundle/Controller/ArticleController.php b/Tests/Functional/Bundle/TestBundle/Controller/ArticleController.php index e6338c8c1..11f24d1e5 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/ArticleController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/ArticleController.php @@ -11,15 +11,15 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; +use FOS\RestBundle\Controller\AbstractFOSRestController; use Symfony\Component\HttpFoundation\Request; use FOS\RestBundle\Controller\Annotations\RouteResource; use FOS\RestBundle\Controller\Annotations\View; -use FOS\RestBundle\Controller\FOSRestController; /** * @RouteResource("Article") */ -class ArticleController extends FOSRestController +class ArticleController extends AbstractFOSRestController { /** * Create a new resource. diff --git a/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php b/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php index d10b65c74..6a6f84322 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/ParamFetcherController.php @@ -11,8 +11,8 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; +use FOS\RestBundle\Controller\AbstractFOSRestController; use FOS\RestBundle\Controller\Annotations\FileParam; -use FOS\RestBundle\Controller\FOSRestController; use FOS\RestBundle\Controller\Annotations\QueryParam; use FOS\RestBundle\Controller\Annotations\RequestParam; use FOS\RestBundle\Request\ParamFetcherInterface; @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Validator\Constraints\IdenticalTo; -class ParamFetcherController extends FOSRestController +class ParamFetcherController extends AbstractFOSRestController { /** * @RequestParam(name="raw", requirements=@IdenticalTo({"foo"="raw", "bar"="foo"}), default="invalid", strict=false) diff --git a/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php b/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php index f4970e543..602413ec9 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/RequestBodyParamConverterController.php @@ -12,10 +12,10 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; -class RequestBodyParamConverterController extends Controller +class RequestBodyParamConverterController extends AbstractController { /** * @ParamConverter("post", converter="fos_rest.request_body") diff --git a/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php b/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php index 9bc2cd2ca..9a806c343 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/SerializerErrorController.php @@ -12,7 +12,7 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; use FOS\RestBundle\Controller\Annotations\View; -use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Validator\Constraints\NotBlank; /** @@ -20,7 +20,7 @@ * * @author Florian Voutzinos */ -class SerializerErrorController extends Controller +class SerializerErrorController extends AbstractController { /** * @View diff --git a/Tests/Functional/Bundle/TestBundle/Controller/Version2Controller.php b/Tests/Functional/Bundle/TestBundle/Controller/Version2Controller.php index 6fb4a600a..430dcb33e 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/Version2Controller.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/Version2Controller.php @@ -11,10 +11,10 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; +use FOS\RestBundle\Controller\AbstractFOSRestController; use FOS\RestBundle\Controller\Annotations\Get; use FOS\RestBundle\Controller\Annotations\Version; use FOS\RestBundle\Controller\Annotations\View; -use FOS\RestBundle\Controller\FOSRestController; use Symfony\Component\HttpFoundation\Request; /** @@ -22,7 +22,7 @@ * * @Version({"1.2"}) */ -class Version2Controller extends FOSRestController +class Version2Controller extends AbstractFOSRestController { /** * @View("TestBundle:Version:version.html.twig") diff --git a/Tests/Functional/Bundle/TestBundle/Controller/VersionController.php b/Tests/Functional/Bundle/TestBundle/Controller/VersionController.php index 3fcf479d9..b3638a8fb 100644 --- a/Tests/Functional/Bundle/TestBundle/Controller/VersionController.php +++ b/Tests/Functional/Bundle/TestBundle/Controller/VersionController.php @@ -11,14 +11,14 @@ namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller; +use FOS\RestBundle\Controller\AbstractFOSRestController; use FOS\RestBundle\Controller\Annotations\View; -use FOS\RestBundle\Controller\FOSRestController; use Symfony\Component\HttpFoundation\Request; /** * @author Ener-Getick */ -class VersionController extends FOSRestController +class VersionController extends AbstractFOSRestController { /** * @View("TestBundle:Version:version.html.twig") diff --git a/Tests/Functional/app/config/default.yml b/Tests/Functional/app/config/default.yml index 8ddd7ed92..949620dab 100644 --- a/Tests/Functional/app/config/default.yml +++ b/Tests/Functional/app/config/default.yml @@ -1,2 +1,3 @@ imports: - { resource: framework.yml } + - { resource: services.yaml } diff --git a/Tests/Functional/app/config/services.yaml b/Tests/Functional/app/config/services.yaml new file mode 100644 index 000000000..7519a2256 --- /dev/null +++ b/Tests/Functional/app/config/services.yaml @@ -0,0 +1,6 @@ +services: + FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\: + resource: '../../Bundle/TestBundle/Controller/*' + public: true + autoconfigure: true + autowire: true From 5526e9cb8436e12e982aa9e542f2f90429d09faa Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 1 Jan 2019 17:51:36 +0100 Subject: [PATCH 3/7] fix lowest supported JMSSerializerBundle release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4e03a0e79..6655937bb 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "symfony/expression-language": "~2.7|^3.0|^4.0", "symfony/css-selector": "^3.4|^4.0", "phpoption/phpoption": "^1.1", - "jms/serializer-bundle": "^2.0|^3.0", + "jms/serializer-bundle": "^2.3.1|^3.0", "jms/serializer": "^1.13|^2.0", "psr/http-message": "^1.0" }, From cea802288991ab41109f81a513c41c95722629fd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 1 Jan 2019 18:06:22 +0100 Subject: [PATCH 4/7] fix risky tests --- Tests/EventListener/BodyListenerTest.php | 4 ++-- Tests/Functional/ConfigurationTest.php | 11 ++++++++--- Tests/Functional/ParamFetcherTest.php | 2 ++ Tests/Functional/SerializerErrorTest.php | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Tests/EventListener/BodyListenerTest.php b/Tests/EventListener/BodyListenerTest.php index 046695183..0002d2bea 100644 --- a/Tests/EventListener/BodyListenerTest.php +++ b/Tests/EventListener/BodyListenerTest.php @@ -36,7 +36,7 @@ class BodyListenerTest extends TestCase * @param string $contentType the request header content type * @param bool $throwExceptionOnUnsupportedContentType * - * @dataProvider testOnKernelRequestDataProvider + * @dataProvider onKernelRequestDataProvider */ public function testOnKernelRequest($decode, Request $request, $method, $expectedParameters, $contentType = null, $throwExceptionOnUnsupportedContentType = false) { @@ -76,7 +76,7 @@ public function testOnKernelRequest($decode, Request $request, $method, $expecte $this->assertEquals($request->request->all(), $expectedParameters); } - public static function testOnKernelRequestDataProvider() + public static function onKernelRequestDataProvider() { return [ 'Empty POST request' => [true, new Request([], [], [], [], [], [], ['foo']), 'POST', ['foo'], 'application/json'], diff --git a/Tests/Functional/ConfigurationTest.php b/Tests/Functional/ConfigurationTest.php index 9a6c01215..f64605a8f 100644 --- a/Tests/Functional/ConfigurationTest.php +++ b/Tests/Functional/ConfigurationTest.php @@ -18,18 +18,23 @@ class ConfigurationTest extends WebTestCase { public function testDisabledTemplating() { - $this->createClient(['test_case' => 'Templating']); + $kernel = self::bootKernel(['test_case' => 'Templating']); + $container = $kernel->getContainer(); + + $this->assertFalse($container->has('fos_rest.templating')); } public function testToolbar() { - $this->createClient(['test_case' => 'Configuration']) - ->request( + $client = $this->createClient(['test_case' => 'Configuration']); + $client->request( 'GET', '/_profiler/empty/search/results?limit=10', [], [], ['HTTP_Accept' => 'application/json'] ); + + $this->assertSame('text/html; charset=UTF-8', $client->getResponse()->headers->get('Content-Type')); } } diff --git a/Tests/Functional/ParamFetcherTest.php b/Tests/Functional/ParamFetcherTest.php index da640b8ea..b69f46464 100644 --- a/Tests/Functional/ParamFetcherTest.php +++ b/Tests/Functional/ParamFetcherTest.php @@ -194,6 +194,8 @@ public function testFileParamImageConstraintArrayException() public function testValidQueryParameter() { $this->client->request('POST', '/params?foz=val1'); + + $this->assertArraySubset(array('foz' => ''), $this->getData()); } public function testIncompatibleQueryParameter() diff --git a/Tests/Functional/SerializerErrorTest.php b/Tests/Functional/SerializerErrorTest.php index 8d90067da..d123843f5 100644 --- a/Tests/Functional/SerializerErrorTest.php +++ b/Tests/Functional/SerializerErrorTest.php @@ -19,7 +19,7 @@ class SerializerErrorTest extends WebTestCase { /** - * @dataProvider testCaseProvider + * @dataProvider invalidFormJsonProvider */ public function testSerializeExceptionJson($testCase) { @@ -88,7 +88,7 @@ public function serializeExceptionXmlProvider() } /** - * @dataProvider testCaseProvider + * @dataProvider invalidFormJsonProvider */ public function testSerializeInvalidFormJson($testCase) { @@ -98,7 +98,7 @@ public function testSerializeInvalidFormJson($testCase) $this->assertEquals('{"code":400,"message":"Validation Failed","errors":{"children":{"name":{"errors":["This value should not be blank."]}}}}', $client->getResponse()->getContent()); } - public function testCaseProvider() + public function invalidFormJsonProvider() { return [ ['Serializer'], From 7b206d6842a661a913650a74f67e775ada9dc023 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 1 Jan 2019 18:15:58 +0100 Subject: [PATCH 5/7] compatibility with symfony/form 4.2+ --- Form/Extension/DisableCSRFExtension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Form/Extension/DisableCSRFExtension.php b/Form/Extension/DisableCSRFExtension.php index 34e8a6487..1e3197051 100644 --- a/Form/Extension/DisableCSRFExtension.php +++ b/Form/Extension/DisableCSRFExtension.php @@ -67,4 +67,9 @@ public function getExtendedType() : 'form' // SF <2.8 BC ; } + + public static function getExtendedTypes() + { + return array(FormType::class); + } } From d4e21d20204499b1965a223fdd137c2cecf107ba Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 1 Jan 2019 19:21:40 +0100 Subject: [PATCH 6/7] never rely on service auto-registration --- Tests/Functional/app/AppKernel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/Functional/app/AppKernel.php b/Tests/Functional/app/AppKernel.php index 57de7a74c..d785d75d1 100644 --- a/Tests/Functional/app/AppKernel.php +++ b/Tests/Functional/app/AppKernel.php @@ -98,6 +98,7 @@ public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->rootConfig); $loader->load(function (ContainerBuilder $container) { + $container->setParameter('container.autowiring.strict_mode', true); $container->register('logger', NullLogger::class); }); } From f9c3bcdf8e9d2e769109c0a9329edeaad2bd9ae5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 2 Jan 2019 11:10:17 +0100 Subject: [PATCH 7/7] use PHPUnit 6.5 on PHP 7.1 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5e2ddc101..512dc8f4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ matrix: env: SYMFONY_LTS='^3' # Symfony 4 - php: 7.1 + env: SYMFONY_PHPUNIT_VERSION='6.5' - php: 7.2 - php: 7.3 # development dependencies