From bd76cd05dcf27701197f1e4fba28a5c21493d93d Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 4 Mar 2020 14:39:27 +0100 Subject: [PATCH 1/7] Symfony 5 compatibility --- composer.json | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 6cd7ce5b..81ef15f7 100644 --- a/composer.json +++ b/composer.json @@ -5,22 +5,25 @@ "type": "ezplatform-bundle", "minimum-stability": "dev", "prefer-stable": true, + "repositories": [ + {"type": "vcs", "url": "https://github.com/webhdx/Routing.git"} + ], "require": { "php": "^7.3", - "ezsystems/ezpublish-kernel": "^8.0@dev", - "symfony/dependency-injection": "^4.2", - "symfony/http-kernel": "^4.3", - "symfony/http-foundation": "^4.3", - "symfony/options-resolver": "^4.3", - "symfony/config": "^4.3", - "symfony/yaml": "^4.3", - "symfony/filesystem": "^4.3", - "symfony/form": "^4.3", - "symfony/event-dispatcher": "^4.3", - "symfony/validator": "^4.3", - "symfony/routing": "^4.3", - "symfony/translation": " ^4.3", - "jms/translation-bundle": "^1.4" + "ezsystems/ezpublish-kernel": "dev-symfony5 as 8.0.x-dev", + "symfony/dependency-injection": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/http-foundation": "^5.0", + "symfony/options-resolver": "^5.0", + "symfony/config": "^5.0", + "symfony/yaml": "^5.0", + "symfony/filesystem": "^5.0", + "symfony/form": "^5.0", + "symfony/event-dispatcher": "^5.0", + "symfony/validator": "^5.0", + "symfony/routing": "^5.0", + "symfony/translation": " ^5.0", + "jms/translation-bundle": "^1.5" }, "require-dev": { "phpunit/phpunit": "^8.2", From 1a148641f80bb2ad883f7a135b83cd70d8b09ab6 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Mon, 16 Mar 2020 11:28:38 +0100 Subject: [PATCH 2/7] Added symfony-cmf/routing fork --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 81ef15f7..3457035f 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "minimum-stability": "dev", "prefer-stable": true, "repositories": [ - {"type": "vcs", "url": "https://github.com/webhdx/Routing.git"} + {"type": "vcs", "url": "https://github.com/ezsystems/Routing.git"} ], "require": { "php": "^7.3", From 2cf1e6e39252f9f549a4e77b40672f8b16fb0cea Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Mon, 16 Mar 2020 15:47:34 +0100 Subject: [PATCH 3/7] Removed obsolete repositories --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index 3457035f..34746240 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,6 @@ "type": "ezplatform-bundle", "minimum-stability": "dev", "prefer-stable": true, - "repositories": [ - {"type": "vcs", "url": "https://github.com/ezsystems/Routing.git"} - ], "require": { "php": "^7.3", "ezsystems/ezpublish-kernel": "dev-symfony5 as 8.0.x-dev", From 3da79c956e05213eacdbb3455462b1ec8ad07e26 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Mon, 16 Mar 2020 23:07:51 +0100 Subject: [PATCH 4/7] Removed obsolete @injectService syntax --- .../EzPlatformContentFormsExtension.php | 5 +++++ .../Resources/config/feature_contexts.yaml | 21 +++++++++++++++++++ src/lib/Behat/Context/ContentTypeContext.php | 4 ---- src/lib/Behat/Context/PagelayoutContext.php | 3 --- .../Behat/Context/UserRegistrationContext.php | 6 ------ 5 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 src/bundle/Resources/config/feature_contexts.yaml diff --git a/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php b/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php index 0fe5d4a4..03515efd 100644 --- a/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php +++ b/src/bundle/DependencyInjection/EzPlatformContentFormsExtension.php @@ -19,5 +19,10 @@ public function load(array $configs, ContainerBuilder $container) { $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yaml'); + + $environment = $container->getParameter('kernel.environment'); + if (in_array($environment, ['behat', 'test'])) { + $loader->load('feature_contexts.yaml'); + } } } diff --git a/src/bundle/Resources/config/feature_contexts.yaml b/src/bundle/Resources/config/feature_contexts.yaml new file mode 100644 index 00000000..1727d569 --- /dev/null +++ b/src/bundle/Resources/config/feature_contexts.yaml @@ -0,0 +1,21 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: true + + EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext: + arguments: + $permissionResolver: '@=service("ezpublish.api.repository").getPermissionResolver()' + $contentTypeService: '@ezpublish.api.service.content_type' + + EzSystems\EzPlatformContentForms\Behat\Context\PagelayoutContext: + arguments: + $configResolver: '@ezpublish.config.resolver' + + EzSystems\EzPlatformContentForms\Behat\Context\UserRegistrationContext: + arguments: + $permissionResolver: '@=service("ezpublish.api.repository").getPermissionResolver()' + $roleService: '@ezpublish.api.service.role' + $userService: '@ezpublish.api.service.user' + $contentTypeService: '@ezpublish.api.service.content_type' diff --git a/src/lib/Behat/Context/ContentTypeContext.php b/src/lib/Behat/Context/ContentTypeContext.php index 18c04bd3..bee0b763 100644 --- a/src/lib/Behat/Context/ContentTypeContext.php +++ b/src/lib/Behat/Context/ContentTypeContext.php @@ -40,10 +40,6 @@ final class ContentTypeContext extends RawMinkContext implements Context, Snippe */ private $adminUserId = 14; - /** - * @injectService $permissionResolver @eZ\Publish\API\Repository\PermissionResolver - * @injectService $contentTypeService @ezpublish.api.service.content_type - */ public function __construct(PermissionResolver $permissionResolver, ContentTypeService $contentTypeService) { $permissionResolver->setCurrentUserReference(new UserReference($this->adminUserId)); diff --git a/src/lib/Behat/Context/PagelayoutContext.php b/src/lib/Behat/Context/PagelayoutContext.php index 8131ddf9..85462773 100644 --- a/src/lib/Behat/Context/PagelayoutContext.php +++ b/src/lib/Behat/Context/PagelayoutContext.php @@ -26,9 +26,6 @@ class PagelayoutContext extends RawMinkContext implements Context, SnippetAccept */ private $configResolver; - /** - * @injectService $configResolver @ezpublish.config.resolver - */ public function __construct(ConfigResolverInterface $configResolver) { $this->configResolver = $configResolver; diff --git a/src/lib/Behat/Context/UserRegistrationContext.php b/src/lib/Behat/Context/UserRegistrationContext.php index fe067c92..c3c0754e 100644 --- a/src/lib/Behat/Context/UserRegistrationContext.php +++ b/src/lib/Behat/Context/UserRegistrationContext.php @@ -74,12 +74,6 @@ class UserRegistrationContext extends RawMinkContext implements Context, Snippet /** @var \eZ\Publish\API\Repository\ContentTypeService */ private $contentTypeService; - /** - * @injectService $permissionResolver @eZ\Publish\API\Repository\PermissionResolver - * @injectService $roleService @ezpublish.api.service.role - * @injectService $userService @ezpublish.api.service.user - * @injectService $contentTypeService @ezpublish.api.service.content_type - */ public function __construct( PermissionResolver $permissionResolver, RoleService $roleService, From c26ea068b5bca27dd4c534addfacd250e52f650a Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Tue, 17 Mar 2020 15:10:27 +0100 Subject: [PATCH 5/7] Tagged tests as `@broken` due to DebugTemplate issue --- features/ContentEdit/create_without_draft.feature | 1 + features/User/Registration/user_registration.feature | 1 + 2 files changed, 2 insertions(+) diff --git a/features/ContentEdit/create_without_draft.feature b/features/ContentEdit/create_without_draft.feature index 58b3c3d2..7751d490 100644 --- a/features/ContentEdit/create_without_draft.feature +++ b/features/ContentEdit/create_without_draft.feature @@ -23,6 +23,7 @@ Scenario: Content validation errors are reported back Then I am shown the content creation form And there is a relevant error message linked to the invalid field +@broken Scenario: Content edit forms are rendered with the configured pagelayout Given a pagelayout is configured When a content creation form is displayed diff --git a/features/User/Registration/user_registration.feature b/features/User/Registration/user_registration.feature index 8cc4592d..3f3808e1 100644 --- a/features/User/Registration/user_registration.feature +++ b/features/User/Registration/user_registration.feature @@ -33,6 +33,7 @@ Scenario: The user group where registered users are created can be customized When I register a user account Then the user is created in this user group +@broken Scenario: The user registration templates can be customized Given I do have the user/register policy And the following user registration templates configuration: From 66afe4a15321d3b8cc931561f04fbb80905c04b5 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 18 Mar 2020 09:02:52 +0100 Subject: [PATCH 6/7] Changed UploadedFile::getClientSize calls to getSize --- .../FieldType/DataTransformer/AbstractBinaryBaseTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php b/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php index 7e753025..0fadc4db 100644 --- a/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php +++ b/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php @@ -76,7 +76,7 @@ public function getReverseTransformedValue($value) $properties = [ 'inputUri' => $value['file']->getRealPath(), 'fileName' => $value['file']->getClientOriginalName(), - 'fileSize' => $value['file']->getClientSize(), + 'fileSize' => $value['file']->getSize(), ]; return new $this->valueClass($properties); From ef006c836873f942bb9fe006fa75a283d889c0dd Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 18 Mar 2020 21:02:28 +0100 Subject: [PATCH 7/7] Prepared composer.json for release --- composer.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 34746240..608bc00b 100644 --- a/composer.json +++ b/composer.json @@ -3,11 +3,9 @@ "description": "Use Symfony Forms with eZ Platform Content & User objects", "license": "GPL-2.0-only", "type": "ezplatform-bundle", - "minimum-stability": "dev", - "prefer-stable": true, "require": { "php": "^7.3", - "ezsystems/ezpublish-kernel": "dev-symfony5 as 8.0.x-dev", + "ezsystems/ezpublish-kernel": "^8.0@dev", "symfony/dependency-injection": "^5.0", "symfony/http-kernel": "^5.0", "symfony/http-foundation": "^5.0",