From 9126f6d2342739c18221f5bbec82f71cbe8d3cc0 Mon Sep 17 00:00:00 2001 From: Axel Veber Date: Fri, 9 Jul 2021 17:02:34 +0200 Subject: [PATCH] Breaking : Fix exception when building forms (#12) * fix: exception when building form * fix: update tests twig namespaces * docs: update changelog --- CHANGELOG.md | 4 +++ .../Resources/config/prepend/ezplatform.yaml | 6 +++- bundle/Resources/config/prepend/twig.yaml | 2 +- .../content_fields.html.twig | 0 .../field_template.html.twig | 0 .../content_fields.html.twig | 0 composer.json | 3 +- .../eZColorPickerExtensionTest.php | 28 +++++++++++++------ 8 files changed, 31 insertions(+), 12 deletions(-) rename bundle/Resources/views/{themes/admin/ColorPicker => admin}/content_fields.html.twig (100%) rename bundle/Resources/views/{themes/admin/ColorPicker => admin}/field_template.html.twig (100%) rename bundle/Resources/views/{themes/standard/ColorPicker => standard}/content_fields.html.twig (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d15fa..ef8535a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Fix exception when building forms #12 + ## [1.0.1] - 2020-09-23 ### Fixed - Package no longer require `dev` minimum stability. diff --git a/bundle/Resources/config/prepend/ezplatform.yaml b/bundle/Resources/config/prepend/ezplatform.yaml index b0302d5..2305553 100644 --- a/bundle/Resources/config/prepend/ezplatform.yaml +++ b/bundle/Resources/config/prepend/ezplatform.yaml @@ -1,5 +1,9 @@ system: + admin_group: + field_templates: + - template: '@eZColorPicker/admin/content_fields.html.twig' + priority: 1 default: field_templates: - - template: '@ezdesign/ColorPicker/content_fields.html.twig' + - template: '@eZColorPicker/standard/content_fields.html.twig' priority: 1 diff --git a/bundle/Resources/config/prepend/twig.yaml b/bundle/Resources/config/prepend/twig.yaml index f5ff4f1..cac5d69 100644 --- a/bundle/Resources/config/prepend/twig.yaml +++ b/bundle/Resources/config/prepend/twig.yaml @@ -1,2 +1,2 @@ form_themes: - - '@ezdesign/ColorPicker/field_template.html.twig' \ No newline at end of file + - '@eZColorPicker/admin/field_template.html.twig' diff --git a/bundle/Resources/views/themes/admin/ColorPicker/content_fields.html.twig b/bundle/Resources/views/admin/content_fields.html.twig similarity index 100% rename from bundle/Resources/views/themes/admin/ColorPicker/content_fields.html.twig rename to bundle/Resources/views/admin/content_fields.html.twig diff --git a/bundle/Resources/views/themes/admin/ColorPicker/field_template.html.twig b/bundle/Resources/views/admin/field_template.html.twig similarity index 100% rename from bundle/Resources/views/themes/admin/ColorPicker/field_template.html.twig rename to bundle/Resources/views/admin/field_template.html.twig diff --git a/bundle/Resources/views/themes/standard/ColorPicker/content_fields.html.twig b/bundle/Resources/views/standard/content_fields.html.twig similarity index 100% rename from bundle/Resources/views/themes/standard/ColorPicker/content_fields.html.twig rename to bundle/Resources/views/standard/content_fields.html.twig diff --git a/composer.json b/composer.json index 1eb97d1..a547335 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,7 @@ } }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "v2.3.*" + "matthiasnoback/symfony-dependency-injection-test": "v2.3.*", + "phpunit/phpunit": "^6.5" } } diff --git a/tests/bundle/DependencyInjection/eZColorPickerExtensionTest.php b/tests/bundle/DependencyInjection/eZColorPickerExtensionTest.php index 40102db..e13dad9 100644 --- a/tests/bundle/DependencyInjection/eZColorPickerExtensionTest.php +++ b/tests/bundle/DependencyInjection/eZColorPickerExtensionTest.php @@ -35,17 +35,27 @@ public function testPrependEzpublish() $actualPrependedConfig = array_merge(...$actualPrependedConfig); $expectedPrependedConfig = [ - 'field_templates' => [ - [ - 'template' => '@ezdesign/ColorPicker/content_fields.html.twig', - 'priority' => 1, - ], - ] + 'admin_group' => [ + 'field_templates' => [ + [ + 'template' => '@eZColorPicker/admin/content_fields.html.twig', + 'priority' => 1, + ] + ] + ], + 'default' => [ + 'field_templates' => [ + [ + 'template' => '@eZColorPicker/standard/content_fields.html.twig', + 'priority' => 1, + ], + ] + ], ]; self::assertSame( $expectedPrependedConfig, - $actualPrependedConfig['system']['default'] + $actualPrependedConfig['system'] ); } @@ -59,7 +69,7 @@ public function testPrependTwig() $expectedPrependedConfig = [ 'form_themes' => [ - "@ezdesign/ColorPicker/field_template.html.twig" + "@eZColorPicker/admin/field_template.html.twig" ] ]; @@ -68,4 +78,4 @@ public function testPrependTwig() $actualPrependedConfig ); } -} \ No newline at end of file +}