diff --git a/.drone.yml b/.drone.yml index 91a9b7bb..bb64e862 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,11 +26,10 @@ services: environment: - MYSQL_ALLOW_EMPTY_PASSWORD=yes selenium: - image: registry.fpfis.eu/fpfis/selenium:standalone-chrome-3.141.59-oxygen + image: registry.fpfis.eu/fpfis/selenium:standalone-chrome-4.1.3-20220405 shm_size: 2g environment: - DISPLAY=:99 - - SE_OPTS=-debug - SCREEN_WIDTH=1280 - SCREEN_HEIGHT=800 - NODE_MAX_INSTANCES=5 @@ -43,6 +42,22 @@ services: - DBA_PASSWORD=dba pipeline: + composer-change-patch: + group: warmup + image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci + volumes: + - /cache:/cache + commands: + # Change the patch for 10.1.x. + - > + composer config --merge --json "extra.patches.drupal/core" '{"https://www.drupal.org/project/drupal/issues/2230909": "https://www.drupal.org/files/issues/2022-07-26/2230909-269.patch"}' + - > + composer config --merge --json "extra.patches-ignore.openeuropa/oe_content" '{"drupal/core": {"Drupal 10.2.x only - see README.md for 10.1.x - https://www.drupal.org/project/drupal/issues/2230909": "https://www.drupal.org/files/issues/2023-12-21/2230909-309.patch"}}' + when: + matrix: + CORE_VERSION: "10.1.0" + + composer-install: group: prepare image: registry.fpfis.eu/fpfis/httpd-php:${PHP_VERSION}-ci @@ -85,9 +100,11 @@ pipeline: matrix: include: - - CORE_VERSION: 9.4.0 - PHP_VERSION: 8.0 - - CORE_VERSION: 9.4.0 + - CORE_VERSION: 10.1.0 PHP_VERSION: 8.1 - - CORE_VERSION: 10.0 + - CORE_VERSION: 10.1.0 + PHP_VERSION: 8.2 + - CORE_VERSION: 10.2.0 PHP_VERSION: 8.1 + - CORE_VERSION: 10.2.0 + PHP_VERSION: 8.2 diff --git a/behat.yml.dist b/behat.yml.dist index 48c109f8..06146d7d 100755 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -37,7 +37,30 @@ default: ajax_timeout: 10 selenium2: wd_host: '${selenium.host}:${selenium.port}/wd/hub' - capabilities: { "browser": "chrome", "version": "*" } + capabilities: + browser: chrome + nativeEvents: true + marionette: true + browserName: chrome + version: '*' + extra_capabilities: + chromeOptions: + w3c: false + args: + - '--no-sandbox' + - '--start-maximized' + - '--disable-gpu' + - '--window-size=1440,900' + - '--disable-dev-shm-usage' + - '--disable-setuid-sandbox' + - '--disable-web-security' + - '--DNS-prefetch-disable' + - '--disable-translate' + - '--ignore-certificate-errors' + - '--test-type' + - '--disable-extensions' + - '--incognito' + - '--disable-infobars' base_url: "${drupal.base_url}" files_path: "%paths.base%/tests/fixtures/" Drupal\DrupalExtension: diff --git a/composer.json b/composer.json index b5fa6bd8..1043ff46 100644 --- a/composer.json +++ b/composer.json @@ -6,10 +6,10 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=8.0", - "cweagans/composer-patches": "~1.4", + "php": ">=8.1", + "cweagans/composer-patches": "^1.7 || ^2.0", "drupal/allowed_formats": "^2.0 || ^3.0", - "drupal/core": "^9.4 || ^10", + "drupal/core": "^10", "drupal/paragraphs": "^1.15", "drupal/typed_link": "^2.0" }, @@ -18,24 +18,24 @@ "drupal/address": "^1.9", "drupal/composite_reference": "^2.1", "drupal/config_devel": "^1.9", - "drupal/core-composer-scaffold": "^9.4 || ^10", - "drupal/core-utility": "^9.4 || ^10", + "drupal/core-composer-scaffold": "^10", + "drupal/core-utility": "^10", "drupal/description_list_field": "^1.0", "drupal/drupal-extension": "^5.0", "drupal/entity_browser": "^2.5", "drupal/inline_entity_form": "^1.0-rc12", "drupal/json_field": "^1.1", - "drush/drush": "^11.1", + "drush/drush": "^12", + "nikic/php-parser": "^4", "openeuropa/behat-transformation-context": "^0.1", "openeuropa/code-review": "^2.0", - "openeuropa/oe_content": "^3.0.0-alpha11", + "openeuropa/oe_content": "^3.0.0", "openeuropa/oe_media": "^1.23.1", "openeuropa/oe_webtools": "^1.22", "openeuropa/rdf_skos": "^1.0.0-alpha10", "openeuropa/task-runner-drupal-project-symlink": "^1.0-beta6", "phpspec/prophecy-phpunit": "^2", - "symfony/phpunit-bridge": "^6.0", - "symfony/validator": "~v4.4.48 || ~v6.2.5" + "symfony/phpunit-bridge": "^6.0" }, "suggest": { "openeuropa/oe_media": "Allows usage of paragraphs with different media attached to it." @@ -76,7 +76,7 @@ }, "_readme": [ "Explicit requirement of symfony/phpunit-bridge to replace drupal/core-dev testing classes and traits.", - "Using symfony/validator v6.2.5 for D10 like core-recommended does because 6.3 breaks BC with the signature changes to the ExecutionContextInterface. Remove when 6.3.1 is realased." + "Explicit requirement of nikic/php-parser ^4 as later versions are not compatible with grumphp @see https://github.com/phpro/grumphp/issues/1119" ] }, "repositories": [ diff --git a/docker-compose.yml b/docker-compose.yml index 6427a0c5..f0e7f7b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,22 +30,16 @@ services: - DBA_PASSWORD=dba ports: - "8890:8890" - # Spawn a Selenium server which also includes a VNC server on localhost:5900 (the password is "secret") + # Visit localhost:7900 to access the browser. selenium: - image: selenium/standalone-chrome-debug:3.141.59-oxygen - expose: - - '4444' + image: selenium/standalone-chrome:4.1.3-20220405 environment: - DISPLAY=:99 - - SE_OPTS=-debug - SCREEN_WIDTH=1280 - SCREEN_HEIGHT=800 - VNC_NO_PASSWORD=1 ports: - - '4444:4444' - - '5900:5900' - volumes: - - /dev/shm:/dev/shm + - '7900:7900' shm_size: 2g #### Mac users: uncomment the "volumes" key to enable the NFS file sharing. You can find more information about Docker for Mac here: https://github.com/openeuropa/openeuropa/blob/master/docs/starting/tooling.md#using-docker-on-macos diff --git a/modules/oe_paragraphs_av_media/oe_paragraphs_av_media.info.yml b/modules/oe_paragraphs_av_media/oe_paragraphs_av_media.info.yml index 2f6dab21..6e392ac6 100644 --- a/modules/oe_paragraphs_av_media/oe_paragraphs_av_media.info.yml +++ b/modules/oe_paragraphs_av_media/oe_paragraphs_av_media.info.yml @@ -2,7 +2,7 @@ name: OpenEuropa Paragraphs AV Media type: module description: Provides a Media paragraph that references an image or a video. package: OpenEuropa -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^10 dependencies: - oe_media:oe_media_avportal diff --git a/modules/oe_paragraphs_banner/oe_paragraphs_banner.info.yml b/modules/oe_paragraphs_banner/oe_paragraphs_banner.info.yml index e52ef966..dbc0363f 100644 --- a/modules/oe_paragraphs_banner/oe_paragraphs_banner.info.yml +++ b/modules/oe_paragraphs_banner/oe_paragraphs_banner.info.yml @@ -2,7 +2,7 @@ name: OpenEuropa Paragraphs Banner type: module description: Provides a Banner paragraph that uses media images. package: OpenEuropa -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^10 dependencies: - oe_media:oe_media_avportal diff --git a/modules/oe_paragraphs_banner/oe_paragraphs_banner.post_update.php b/modules/oe_paragraphs_banner/oe_paragraphs_banner.post_update.php index b7f4b046..be1b6edc 100644 --- a/modules/oe_paragraphs_banner/oe_paragraphs_banner.post_update.php +++ b/modules/oe_paragraphs_banner/oe_paragraphs_banner.post_update.php @@ -5,7 +5,7 @@ * Post update functions for the OE Paragraphs Banner module. */ -declare(strict_types = 1); +declare(strict_types=1); use Drupal\Core\Config\FileStorage; diff --git a/modules/oe_paragraphs_banner/oe_paragraphs_banner.services.yml b/modules/oe_paragraphs_banner/oe_paragraphs_banner.services.yml index c4e3dfb5..c1ac3d0e 100644 --- a/modules/oe_paragraphs_banner/oe_paragraphs_banner.services.yml +++ b/modules/oe_paragraphs_banner/oe_paragraphs_banner.services.yml @@ -2,8 +2,3 @@ services: oe_paragraphs_banner.paragraph_updater: class: Drupal\oe_paragraphs_banner\BannerParagraphUpdater arguments: [ '@entity_type.manager' ] - oe_paragraphs_banner.banner_paragraph_update: - class: Drupal\oe_paragraphs_banner\Commands\UpdateBannerData - arguments: [ '@entity_type.manager', '@oe_paragraphs_banner.paragraph_updater', '@messenger' ] - tags: - - { name: drush.command } diff --git a/modules/oe_paragraphs_banner/src/BannerParagraphUpdater.php b/modules/oe_paragraphs_banner/src/BannerParagraphUpdater.php index d46816e3..dd02ec2b 100644 --- a/modules/oe_paragraphs_banner/src/BannerParagraphUpdater.php +++ b/modules/oe_paragraphs_banner/src/BannerParagraphUpdater.php @@ -1,6 +1,6 @@ get('entity_type.manager'), + $container->get('oe_paragraphs_banner.paragraph_updater'), + $container->get('messenger'), + ); + } + + /** + * Triggers the update of the Banner paragraph data. */ + #[CLI\Command(name: 'oe-paragraphs-update-banner-data:run', aliases: [])] + #[CLI\Usage(name: 'oe-paragraphs-update-banner-data:run', description: 'Updates Banner paragraph data.')] public function updateBannerData(): void { $ids = $this->entityTypeManager->getStorage('paragraph')->getQuery() ->condition('type', 'oe_banner') diff --git a/modules/oe_paragraphs_banner/tests/src/Functional/UpdateBannerDataTest.php b/modules/oe_paragraphs_banner/tests/src/Functional/UpdateBannerDataTest.php index fafa168a..aedde823 100644 --- a/modules/oe_paragraphs_banner/tests/src/Functional/UpdateBannerDataTest.php +++ b/modules/oe_paragraphs_banner/tests/src/Functional/UpdateBannerDataTest.php @@ -1,6 +1,6 @@ get('entity_type.manager'), + $container->get('oe_paragraphs_carousel.paragraph_updater'), + $container->get('messenger'), + ); + } + + /** + * Triggers the update of the Carousel paragraph data. */ + #[CLI\Command(name: 'oe-paragraphs-update-carousel-data:run', aliases: [])] + #[CLI\Usage(name: 'oe-paragraphs-update-carousel-data:run', description: 'Updates Carousel paragraph data.')] public function updateCarouselData(): void { $ids = $this->entityTypeManager->getStorage('paragraph')->getQuery() ->condition('type', 'oe_carousel') diff --git a/modules/oe_paragraphs_carousel/src/Plugin/Validation/Constraint/CarouselItemsCardinality.php b/modules/oe_paragraphs_carousel/src/Plugin/Validation/Constraint/CarouselItemsCardinality.php index 128c448b..34e8be04 100644 --- a/modules/oe_paragraphs_carousel/src/Plugin/Validation/Constraint/CarouselItemsCardinality.php +++ b/modules/oe_paragraphs_carousel/src/Plugin/Validation/Constraint/CarouselItemsCardinality.php @@ -1,6 +1,6 @@ - + diff --git a/src/Event/FlagOptionsEvent.php b/src/Event/FlagOptionsEvent.php index b7e3d89b..ba8876e3 100644 --- a/src/Event/FlagOptionsEvent.php +++ b/src/Event/FlagOptionsEvent.php @@ -1,6 +1,6 @@ findParagraph($paragraph_type, $position); $element = $this->getParagraphReferenceField($paragraph, $field); + // The div wrapping the buttons have a different class since 10.2.x. + // @todo Remove this when support for 10.1.x is dropped. + $actions_class = version_compare(\Drupal::VERSION, '10.2', '>') + ? 'field-actions' + : 'form-actions'; // After the multi-value field table, a div is wrapping all the buttons. - $xpath = '/table/following-sibling::div' . $this->xpathHasClassSelector('form-actions') . + $xpath = '/table/following-sibling::div' . $this->xpathHasClassSelector($actions_class) . '//input' . $this->xpathHasClassSelector('field-add-more-submit'); $buttons = $element->findAll('xpath', $xpath); diff --git a/tests/Traits/FieldsTrait.php b/tests/Traits/FieldsTrait.php index 92808d3a..e66e4c79 100644 --- a/tests/Traits/FieldsTrait.php +++ b/tests/Traits/FieldsTrait.php @@ -1,6 +1,6 @@