From 82aa8826f85631f728229689dde9a5b653c7f6fc Mon Sep 17 00:00:00 2001 From: Florent Torregrosa Date: Thu, 6 Jan 2022 19:19:31 +0100 Subject: [PATCH 1/4] WIP PHP 8.1 compatibility. --- src/Drupal/DrupalDriverManager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Drupal/DrupalDriverManager.php b/src/Drupal/DrupalDriverManager.php index 14ce64c6..b2a3d1b7 100644 --- a/src/Drupal/DrupalDriverManager.php +++ b/src/Drupal/DrupalDriverManager.php @@ -64,7 +64,12 @@ public function registerDriver($name, DriverInterface $driver) */ public function getDriver($name = null) { - $name = strtolower($name) ?: $this->defaultDriverName; + if (null === $name) { + $name = $this->defaultDriverName; + } + else { + $name = strtolower($name); + } if (null === $name) { throw new \InvalidArgumentException('Specify a Drupal driver to get.'); From 915e2a6f9a73c9e6b148f7dd1016f120a2df53fc Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Sun, 24 Apr 2022 07:11:46 +0200 Subject: [PATCH 2/4] update phpspec, travis configuration --- .travis.yml | 2 ++ composer.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 035f1380..122f3aed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ language: php php: - 7.3 - 7.4 + - 8.0 + - 8.1 env: global: diff --git a/composer.json b/composer.json index d43caef4..f5bb2c70 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "drupal/core-recommended": "^9.1", "drush/drush": "^10.5", "php-parallel-lint/php-parallel-lint": "^1.3", - "phpspec/phpspec": "^4.0 || ^6.0" + "phpspec/phpspec": "^4.0 || ^6.0 || ^7.0" }, "scripts": { "test": [ From 80cb0c4e8db5237c73c8f10f2ab3110bc1b83202 Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Sun, 24 Apr 2022 07:18:51 +0200 Subject: [PATCH 3/4] Fix coding standards --- .../src/Plugin/Field/FieldWidget/AddressFieldWidget.php | 2 +- .../src/Plugin/Field/FieldWidget/AddressFieldWidget.php | 2 +- src/Drupal/DrupalDriverManager.php | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php b/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php index 5e35ba7c..371e2527 100644 --- a/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php +++ b/fixtures/drupal8/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php @@ -38,7 +38,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element[$key] = [ '#type' => 'textfield', '#title' => $title, - '#default_value' => isset($items[$delta]->$key) ? $items[$delta]->$key : '', + '#default_value' => $items[$delta]->$key ?? '', ]; } diff --git a/fixtures/drupal9/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php b/fixtures/drupal9/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php index 5e35ba7c..371e2527 100644 --- a/fixtures/drupal9/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php +++ b/fixtures/drupal9/modules/behat_test/src/Plugin/Field/FieldWidget/AddressFieldWidget.php @@ -38,7 +38,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $element[$key] = [ '#type' => 'textfield', '#title' => $title, - '#default_value' => isset($items[$delta]->$key) ? $items[$delta]->$key : '', + '#default_value' => $items[$delta]->$key ?? '', ]; } diff --git a/src/Drupal/DrupalDriverManager.php b/src/Drupal/DrupalDriverManager.php index b2a3d1b7..1bcf1130 100644 --- a/src/Drupal/DrupalDriverManager.php +++ b/src/Drupal/DrupalDriverManager.php @@ -64,12 +64,7 @@ public function registerDriver($name, DriverInterface $driver) */ public function getDriver($name = null) { - if (null === $name) { - $name = $this->defaultDriverName; - } - else { - $name = strtolower($name); - } + $name = null === $name ? $this->defaultDriverName : strtolower($name); if (null === $name) { throw new \InvalidArgumentException('Specify a Drupal driver to get.'); From 0b1c5f39c1c654ccb20cd4323d8114539981d9dd Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Sun, 24 Apr 2022 11:42:48 +0200 Subject: [PATCH 4/4] Remove d8 testing, php 8.1 fixes, use friends-of-behat mink extension fork --- .travis.yml | 1 - composer.json | 2 +- ...ost_adress.yml => field.storage.node.field_post_address.yml} | 0 src/Drupal/DrupalExtension/Context/RawDrupalContext.php | 2 +- 4 files changed, 2 insertions(+), 3 deletions(-) rename fixtures/drupal8/modules/behat_test/config/install/{field.storage.node.field_post_adress.yml => field.storage.node.field_post_address.yml} (100%) diff --git a/.travis.yml b/.travis.yml index 122f3aed..3d7a8a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ env: - TRAVIS_NODE_VERSION="4.0.0" matrix: - DRUPAL_VERSION=7 - - DRUPAL_VERSION=8 - DRUPAL_VERSION=9 # Enable Travis containers. diff --git a/composer.json b/composer.json index f5bb2c70..c2b1c3c4 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "behat/behat": "~3.2", "behat/mink": "~1.5", - "behat/mink-extension": "~2.0", + "friends-of-behat/mink-extension": "^2", "behat/mink-goutte-driver": "~1.0", "behat/mink-selenium2-driver": "~1.1", "drupal/drupal-driver": "^2.1.0", diff --git a/fixtures/drupal8/modules/behat_test/config/install/field.storage.node.field_post_adress.yml b/fixtures/drupal8/modules/behat_test/config/install/field.storage.node.field_post_address.yml similarity index 100% rename from fixtures/drupal8/modules/behat_test/config/install/field.storage.node.field_post_adress.yml rename to fixtures/drupal8/modules/behat_test/config/install/field.storage.node.field_post_address.yml diff --git a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php b/src/Drupal/DrupalExtension/Context/RawDrupalContext.php index bf9754fe..81e5d2e0 100644 --- a/src/Drupal/DrupalExtension/Context/RawDrupalContext.php +++ b/src/Drupal/DrupalExtension/Context/RawDrupalContext.php @@ -423,7 +423,7 @@ public function parseEntityFields($entity_type, \stdClass $entity) // Split up multiple values in multi-value fields. $values = []; foreach (str_getcsv($field_value) as $key => $value) { - $value = trim($value); + $value = trim((string) $value); $columns = $value; // Split up field columns if the ' - ' separator is present. if (strstr($value, ' - ') !== false) {