From 20ea02de466457e4a49f3d80e1600dad8da665f6 Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Tue, 1 Feb 2022 18:24:48 +0300 Subject: [PATCH 1/4] EWPP-1914: Run grumphp through docker container instead of host. --- grumphp.yml.dist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grumphp.yml.dist b/grumphp.yml.dist index ec725bc..fc456d5 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -12,3 +12,6 @@ parameters: - php - theme - yml +grumphp: + git_hook_variables: + EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T web' From 7678c368576b757579884816cb3e5d5eb4b8198a Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Tue, 1 Feb 2022 18:27:25 +0300 Subject: [PATCH 2/4] EWPP-1914: Use composer2. --- .drone.yml | 11 ++++++----- composer.json | 9 ++++++++- docker-compose.yml | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index f2a421a..64963fd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,6 +17,7 @@ services: image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci environment: - DOCUMENT_ROOT=/test/entity_meta_relation + - COMPOSERVER=--2 mysql: image: registry.fpfis.eu/fpfis/sql:percona-5.7 command: --innodb-log-file-size=1G --max_allowed_packet=1G --innodb-buffer-pool-size=512M --wait_timeout=3000 --net_write_timeout=3000 --log_error_verbosity=3 @@ -30,10 +31,8 @@ pipeline: volumes: - /cache:/cache commands: - # @todo remove "composer install" step once the following issue is fixed. - # @link https://webgate.ec.europa.eu/CITnet/jira/browse/OPENEUROPA-1234 - - composer install --ansi --no-suggest --no-progress - - composer update --prefer-lowest --prefer-stable --ansi --no-suggest --no-progress + - composer self-update --2 + - composer update --prefer-lowest --prefer-stable --ansi --no-progress when: matrix: COMPOSER_BOUNDARY: lowest @@ -44,7 +43,8 @@ pipeline: volumes: - /cache:/cache commands: - - composer install --ansi --no-suggest --no-progress + - composer self-update --2 + - composer install --ansi --no-progress when: matrix: COMPOSER_BOUNDARY: highest @@ -52,6 +52,7 @@ pipeline: site-install: image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci commands: + - while ! mysqladmin ping -h mysql --silent; do sleep 1; done - ./vendor/bin/run drupal:site-install grumphp: diff --git a/composer.json b/composer.json index ac2b8f3..c9ba784 100644 --- a/composer.json +++ b/composer.json @@ -58,6 +58,13 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "composer/installers": true, + "cweagans/composer-patches": true, + "dealerdirect/phpcodesniffer-composer-installer": true, + "drupal/core-composer-scaffold": true, + "phpro/grumphp": true + } } } diff --git a/docker-compose.yml b/docker-compose.yml index 8e59798..e822c23 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: - .:/var/www/html # Non Mac users. # - nfsmount:/var/www/html # Mac Users with the nfsmount volume. environment: + COMPOSERVER: "--2" XDEBUG_CONFIG: "client_host=172.17.0.1" # Non-Mac users. # XDEBUG_CONFIG: "client_host=host.docker.internal" # Mac users. XDEBUG_MODE: "develop, debug" From 2c735f929b01257c61c0fbf8f2f7a920f50e09df Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Mon, 7 Feb 2022 13:46:04 +0300 Subject: [PATCH 3/4] EWPP-1914: Update to PHP7.4/8 and Drupal 9.2. --- .drone.yml | 3 ++- composer.json | 18 +++++++++++------- docker-compose.yml | 2 +- emr.info.yml | 2 +- modules/emr_node/emr_node.info.yml | 2 +- .../entity_meta_example.info.yml | 2 +- .../entity_meta_audio.info.yml | 2 +- .../entity_meta_force.info.yml | 2 +- .../entity_meta_speed.info.yml | 2 +- .../entity_meta_visual.info.yml | 2 +- src/EntityMetaRelationInstaller.php | 2 +- .../EntityMetaRelationContentFormTest.php | 4 ++-- .../EntityMetaRelationAttachByDefaultTest.php | 0 .../Kernel/EntityMetaRelationRevisionTest.php | 0 .../Kernel/EntityMetaRelationTest.php | 0 15 files changed, 24 insertions(+), 19 deletions(-) rename tests/{ => src}/Functional/EntityMetaRelationContentFormTest.php (99%) rename tests/{ => src}/Kernel/EntityMetaRelationAttachByDefaultTest.php (100%) rename tests/{ => src}/Kernel/EntityMetaRelationRevisionTest.php (100%) rename tests/{ => src}/Kernel/EntityMetaRelationTest.php (100%) diff --git a/.drone.yml b/.drone.yml index 64963fd..c223347 100644 --- a/.drone.yml +++ b/.drone.yml @@ -78,4 +78,5 @@ matrix: - lowest - highest PHP_VERSION: - - 7.3 + - 7.4 + - 8.0 diff --git a/composer.json b/composer.json index c9ba784..a311fe7 100644 --- a/composer.json +++ b/composer.json @@ -6,22 +6,26 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=7.3", - "drupal/core": "^8.9 || ^9.1", + "php": ">=7.4", + "drupal/core": "^9.2", "drupal/entity_reference_revisions": "^1.6", "drupal/inline_entity_form": "^1.0" }, "require-dev": { "composer/installers": "~1.5", - "drupal/core-composer-scaffold": "^8.9 || ^9.1", + "drupal/core-composer-scaffold": "^9.2", "drupal/config_devel": "^1.2", + "drupal/core-dev": "^9.2", "drupal/drupal-extension": "^4.0", "drush/drush": "^10.3", - "openeuropa/code-review": "^1.6", - "openeuropa/drupal-core-require-dev": "^8.9 || ^9.1", - "openeuropa/task-runner-drupal-project-symlink": "^1.0", + "egulias/email-validator": "^2.1.22 || ^3.0", + "openeuropa/code-review": "^2.0", + "openeuropa/task-runner-drupal-project-symlink": "^1.0.0-beta5", "phpspec/prophecy-phpunit": "^1 || ^2" }, + "_readme": [ + "Explicit requirement for egulias/email-validator due to https://www.drupal.org/project/drupal/issues/3061074#comment-14300579. It can be removed when Drupal core 9.2 support is droppped." + ], "scripts": { "post-install-cmd": "./vendor/bin/run drupal:site-setup", "post-update-cmd": "./vendor/bin/run drupal:site-setup" @@ -39,7 +43,7 @@ }, "autoload-dev": { "psr-4": { - "Drupal\\Tests\\emr\\": "./tests/" + "Drupal\\Tests\\emr\\": "./tests/src/" } }, "extra": { diff --git a/docker-compose.yml b/docker-compose.yml index e822c23..adb122e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: web: - image: fpfis/httpd-php-dev:7.3 + image: fpfis/httpd-php-dev:8.0 working_dir: /var/www/html ports: - 8080:8080 diff --git a/emr.info.yml b/emr.info.yml index ad0925e..64f5631 100644 --- a/emr.info.yml +++ b/emr.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Relation type: module description: 'Provides an entity meta relation entity and associated behaviors for relations.' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_reference_revisions:entity_reference_revisions diff --git a/modules/emr_node/emr_node.info.yml b/modules/emr_node/emr_node.info.yml index 97cec6e..6244f9f 100644 --- a/modules/emr_node/emr_node.info.yml +++ b/modules/emr_node/emr_node.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Relation Node type: module description: 'Configure entity meta relations for nodes.' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr diff --git a/modules/entity_meta_example/entity_meta_example.info.yml b/modules/entity_meta_example/entity_meta_example.info.yml index 4f6531c..1f8e88e 100644 --- a/modules/entity_meta_example/entity_meta_example.info.yml +++ b/modules/entity_meta_example/entity_meta_example.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Example type: module description: 'Defines an example meta entity to be related with nodes' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr_node diff --git a/modules/entity_meta_example/modules/entity_meta_audio/entity_meta_audio.info.yml b/modules/entity_meta_example/modules/entity_meta_audio/entity_meta_audio.info.yml index e4ba91d..00802db 100644 --- a/modules/entity_meta_example/modules/entity_meta_audio/entity_meta_audio.info.yml +++ b/modules/entity_meta_example/modules/entity_meta_audio/entity_meta_audio.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Audio type: module description: 'Defines an example meta entity for audio information' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr diff --git a/modules/entity_meta_example/modules/entity_meta_force/entity_meta_force.info.yml b/modules/entity_meta_example/modules/entity_meta_force/entity_meta_force.info.yml index e3d0985..9981c05 100644 --- a/modules/entity_meta_example/modules/entity_meta_force/entity_meta_force.info.yml +++ b/modules/entity_meta_example/modules/entity_meta_force/entity_meta_force.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Force type: module description: 'Defines an example meta entity for force information' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr diff --git a/modules/entity_meta_example/modules/entity_meta_speed/entity_meta_speed.info.yml b/modules/entity_meta_example/modules/entity_meta_speed/entity_meta_speed.info.yml index 99fa39d..7a44379 100644 --- a/modules/entity_meta_example/modules/entity_meta_speed/entity_meta_speed.info.yml +++ b/modules/entity_meta_example/modules/entity_meta_speed/entity_meta_speed.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Speed type: module description: 'Defines an example meta entity for speed information' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr_node diff --git a/modules/entity_meta_example/modules/entity_meta_visual/entity_meta_visual.info.yml b/modules/entity_meta_example/modules/entity_meta_visual/entity_meta_visual.info.yml index 4e0b55e..0eff141 100644 --- a/modules/entity_meta_example/modules/entity_meta_visual/entity_meta_visual.info.yml +++ b/modules/entity_meta_example/modules/entity_meta_visual/entity_meta_visual.info.yml @@ -2,7 +2,7 @@ name: Entity Meta Visual type: module description: 'Defines an example meta entity for visual information' package: Entity Meta Relation -core_version_requirement: ^8.9 || ^9.1 +core_version_requirement: ^9.2 dependencies: - entity_meta_relation:emr_node diff --git a/src/EntityMetaRelationInstaller.php b/src/EntityMetaRelationInstaller.php index 9695b92..3b0380a 100644 --- a/src/EntityMetaRelationInstaller.php +++ b/src/EntityMetaRelationInstaller.php @@ -116,7 +116,7 @@ protected function updateTargetBundlesInField(string $emr_bundle, string $field_ throw new FieldException("Field config 'entity_meta_relation.{$emr_bundle}.{$field_name}' not found. Without this field, we cannot properly configure Entity Meta type."); } $handler_settings = $field_config->getSetting('handler_settings'); - $old_target_bundles = isset($handler_settings['target_bundles']) ? $handler_settings['target_bundles'] : []; + $old_target_bundles = $handler_settings['target_bundles'] ?? []; $handler_settings['target_bundles'] = array_unique(array_merge($old_target_bundles, $target_bundles)); $field_config->setSetting('handler_settings', $handler_settings); $field_config->save(); diff --git a/tests/Functional/EntityMetaRelationContentFormTest.php b/tests/src/Functional/EntityMetaRelationContentFormTest.php similarity index 99% rename from tests/Functional/EntityMetaRelationContentFormTest.php rename to tests/src/Functional/EntityMetaRelationContentFormTest.php index b523e37..837b213 100644 --- a/tests/Functional/EntityMetaRelationContentFormTest.php +++ b/tests/src/Functional/EntityMetaRelationContentFormTest.php @@ -37,10 +37,10 @@ class EntityMetaRelationContentFormTest extends BrowserTestBase { 'access administration pages', 'administer content types', 'administer nodes', + 'create entity_meta_example_ct content', + 'create entity_meta_multi_example_ct content', 'edit any entity_meta_example_ct content', - 'edit own entity_meta_example_ct content', 'edit any entity_meta_multi_example_ct content', - 'edit own entity_meta_multi_example_ct content', 'access content overview', ]; diff --git a/tests/Kernel/EntityMetaRelationAttachByDefaultTest.php b/tests/src/Kernel/EntityMetaRelationAttachByDefaultTest.php similarity index 100% rename from tests/Kernel/EntityMetaRelationAttachByDefaultTest.php rename to tests/src/Kernel/EntityMetaRelationAttachByDefaultTest.php diff --git a/tests/Kernel/EntityMetaRelationRevisionTest.php b/tests/src/Kernel/EntityMetaRelationRevisionTest.php similarity index 100% rename from tests/Kernel/EntityMetaRelationRevisionTest.php rename to tests/src/Kernel/EntityMetaRelationRevisionTest.php diff --git a/tests/Kernel/EntityMetaRelationTest.php b/tests/src/Kernel/EntityMetaRelationTest.php similarity index 100% rename from tests/Kernel/EntityMetaRelationTest.php rename to tests/src/Kernel/EntityMetaRelationTest.php From 09cbdeb2436883945f70da744cfe53e70bcf5979 Mon Sep 17 00:00:00 2001 From: Evgenii Nikitin Date: Mon, 7 Feb 2022 18:35:39 +0300 Subject: [PATCH 4/4] EWPP-1914: Move _readme into extra. --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index a311fe7..64322f8 100644 --- a/composer.json +++ b/composer.json @@ -23,9 +23,6 @@ "openeuropa/task-runner-drupal-project-symlink": "^1.0.0-beta5", "phpspec/prophecy-phpunit": "^1 || ^2" }, - "_readme": [ - "Explicit requirement for egulias/email-validator due to https://www.drupal.org/project/drupal/issues/3061074#comment-14300579. It can be removed when Drupal core 9.2 support is droppped." - ], "scripts": { "post-install-cmd": "./vendor/bin/run drupal:site-setup", "post-update-cmd": "./vendor/bin/run drupal:site-setup" @@ -59,7 +56,10 @@ "locations": { "web-root": "./build" } - } + }, + "_readme": [ + "Explicit requirement for egulias/email-validator due to https://www.drupal.org/project/drupal/issues/3061074#comment-14300579. It can be removed when Drupal core 9.2 support is droppped." + ] }, "config": { "sort-packages": true,