From 5a986743510e8ce1e83c981436b3c33ac932926f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 7 Oct 2022 01:57:44 +1100 Subject: [PATCH 01/21] Added Rector and Drupal check. --- .gitignore | 3 +++ composer.json | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 50dd546..102fcde 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,8 @@ composer.lock reports vendor drush +/drupal .phpunit.result.cache +/.editorconfig +/.gitattributes diff --git a/composer.json b/composer.json index 21d2e23..f5f4071 100644 --- a/composer.json +++ b/composer.json @@ -15,25 +15,35 @@ "php": ">=7.4", "symfony/process": "~2.5|~3.0|~4.4|^6", "symfony/dependency-injection": "~2.6|~3.0|~4.4|^6", - "drupal/core-utility": "^8.4 || ^9 || ^10.0.0-alpha1" + "drupal/core-utility": "^8.4 || ^9 || ^10@beta" }, "require-dev": { + "composer/installers": "^2.1", "drupal/coder": "~8.3.0", "phpspec/phpspec": "~2.0 || ~4.0 || ~6.1 || dev-main", "phpunit/phpunit": "~6.0 || ~7.0 || ^9", "mockery/mockery": "^0.9.4", + "drupal/core-composer-scaffold": "^10@beta", + "drupal/core-recommended": "^10@beta", + "drupal/mailsystem": "^4.4", "drush-ops/behat-drush-endpoint": "*", "php-parallel-lint/php-parallel-lint": "^1.0", - "dms/phpunit-arraysubset-asserts": "^0.4.0" + "dms/phpunit-arraysubset-asserts": "^0.4.0", + "mglaman/drupal-check": "^1", + "palantirnet/drupal-rector": "^0.13" }, "scripts": { + "post-install-cmd": [ + "cp ./vendor/palantirnet/drupal-rector/rector.php drupal/." + ], "test": [ "composer validate --no-interaction", "parallel-lint src spec tests", "phpunit", "phpspec run -f pretty --no-interaction", - "phpcs --standard=./phpcs-ruleset.xml ." - + "phpcs --standard=./phpcs-ruleset.xml --ignore=drupal .", + "./vendor/bin/drupal-check --drupal-root=drupal ./src/Drupal/Driver/Cores/Drupal8.php ./src/Drupal/Driver/Fields/Drupal8", + "cd drupal && ../vendor/bin/rector process ../src/Drupal/Driver/Cores/Drupal8.php ../src/Drupal/Driver/Fields/Drupal8 --dry-run" ] }, "autoload": { @@ -42,14 +52,37 @@ "Drupal\\Tests\\Driver" : "tests/" } }, + "repositories": { + "drupal": { + "type": "composer", + "url": "https://packages.drupal.org/8" + } + }, + "prefer-stable": true, + "minimum-stability": "beta", "extra": { "branch-alias": { "dev-master": "2.3.x-dev" + }, + "installer-paths": { + "drupal/core": [ + "type:drupal-core" + ], + "drupal/modules/{$name}": [ + "type:drupal-module" + ] + }, + "drupal-scaffold": { + "locations": { + "web-root": "drupal/" + } } }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "drupal/core-composer-scaffold": true, + "composer/installers": true } } } From 8177f645a229f40ba88b4c20daffe1a124c54445 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 7 Oct 2022 02:31:56 +1100 Subject: [PATCH 02/21] Fixed Drupal 10 code compatibility. --- src/Drupal/Driver/Cores/Drupal7.php | 2 +- src/Drupal/Driver/Cores/Drupal8.php | 17 ++++++++++++----- .../Driver/Fields/Drupal8/AbstractHandler.php | 2 +- .../Driver/Fields/Drupal8/ImageHandler.php | 4 +--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Drupal/Driver/Cores/Drupal7.php b/src/Drupal/Driver/Cores/Drupal7.php index 7c8d133..4736104 100644 --- a/src/Drupal/Driver/Cores/Drupal7.php +++ b/src/Drupal/Driver/Cores/Drupal7.php @@ -346,7 +346,7 @@ public function languageCreate(\stdClass $language) { // If the language code is not valid then throw an InvalidArgumentException. if (!isset($predefined_languages[$language->langcode])) { - throw new InvalidArgumentException("There is no predefined language with langcode '{$language->langcode}'."); + throw new \InvalidArgumentException("There is no predefined language with langcode '{$language->langcode}'."); } // Enable a language only if it has not been enabled already. diff --git a/src/Drupal/Driver/Cores/Drupal8.php b/src/Drupal/Driver/Cores/Drupal8.php index 4379c16..4f021ab 100644 --- a/src/Drupal/Driver/Cores/Drupal8.php +++ b/src/Drupal/Driver/Cores/Drupal8.php @@ -4,6 +4,7 @@ use Drupal\Core\DrupalKernel; use Drupal\Core\Field\BaseFieldDefinition; +use Drupal\Core\Routing\RouteObjectInterface; use Drupal\Driver\Exception\BootstrapException; use Drupal\field\Entity\FieldStorageConfig; use Drupal\language\Entity\ConfigurableLanguage; @@ -15,7 +16,6 @@ use Drupal\taxonomy\TermInterface; use Drupal\user\Entity\Role; use Drupal\user\Entity\User; -use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; @@ -75,6 +75,7 @@ public function clearCache() { */ public function nodeCreate($node) { // Throw an exception if the node type is missing or does not exist. + /** @var \Drupal\node\Entity\Node $node */ if (!isset($node->type) || !$node->type) { throw new \Exception("Cannot create content because it is missing the required property 'type'."); } @@ -83,11 +84,12 @@ public function nodeCreate($node) { $bundle_info = \Drupal::service('entity_type.bundle.info'); $bundles = $bundle_info->getBundleInfo('node'); if (!in_array($node->type, array_keys($bundles))) { - throw new \Exception("Cannot create content because provided content type '$node->type' does not exist."); + throw new \Exception(sprintf('Cannot create content because provided content type %s does not exist.', $node->type)); } // If 'author' is set, remap it to 'uid'. if (isset($node->author)) { $user = user_load_by_name($node->author); + /** @var \Drupal\user\Entity\User $user */ if ($user) { $node->uid = $user->id(); } @@ -329,8 +331,13 @@ public function termCreate(\stdClass $term) { $term->vid = $term->vocabulary_machine_name; if (isset($term->parent)) { - $parent = \taxonomy_term_load_multiple_by_name($term->parent, $term->vocabulary_machine_name); + $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(FALSE) + ->condition('id', $term->parent) + ->condition('vid', $term->vocabulary_machine_name); + $parent = $query->execute(); if (!empty($parent)) { + /** @var \Drupal\taxonomy\Entity\Term $parent */ $parent = reset($parent); $term->parent = $parent->id(); } @@ -385,7 +392,7 @@ public function getExtensionPathList() { * @param array $base_fields * Base fields to be expanded in addition to user defined fields. */ - public function expandEntityBaseFields($entity_type, \stdClass $entity, array $base_fields) { + public function expandEntityBaseFields($entity_type, $entity, array $base_fields) { $this->expandEntityFields($entity_type, $entity, $base_fields); } @@ -436,7 +443,7 @@ public function languageCreate(\stdClass $language) { if (!ConfigurableLanguage::load($langcode)) { $created_language = ConfigurableLanguage::createFromLangcode($language->langcode); if (!$created_language) { - throw new InvalidArgumentException("There is no predefined language with langcode '{$langcode}'."); + throw new \InvalidArgumentException("There is no predefined language with langcode '{$langcode}'."); } $created_language->save(); return $language; diff --git a/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php b/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php index cda97d5..395a703 100644 --- a/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php +++ b/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php @@ -35,7 +35,7 @@ abstract class AbstractHandler implements FieldHandlerInterface { * @throws \Exception * Thrown when the given field name does not exist on the entity. */ - public function __construct(\stdClass $entity, $entity_type, $field_name) { + public function __construct($entity, $entity_type, $field_name) { if (empty($entity_type)) { throw new \Exception("You must specify an entity type in order to parse entity fields."); } diff --git a/src/Drupal/Driver/Fields/Drupal8/ImageHandler.php b/src/Drupal/Driver/Fields/Drupal8/ImageHandler.php index d042bfb..b314fcc 100644 --- a/src/Drupal/Driver/Fields/Drupal8/ImageHandler.php +++ b/src/Drupal/Driver/Fields/Drupal8/ImageHandler.php @@ -17,9 +17,7 @@ public function expand($values) { } /** @var \Drupal\file\FileInterface $file */ - $file = file_save_data( - $data, - 'public://' . uniqid() . '.jpg'); + $file = \Drupal::service('file.repository')->writeData($data, 'public://' . uniqid() . '.jpg'); if (FALSE === $file) { throw new \Exception("Error saving file"); From 3e746a289615583a4383c74e575af01dadbdc2a3 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 7 Oct 2022 02:36:04 +1100 Subject: [PATCH 03/21] Updated CI matrix to use only PHP 8.1 supported by Drupal 10. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 69e2c7c..40ffc30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: php php: - - 7.4 - - 8.0 - 8.1 install: From aee6f67628b1150c2fa6b352c04cb7a920b1f959 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 7 Oct 2022 02:39:06 +1100 Subject: [PATCH 04/21] Updated mockery version. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f5f4071..c0709cf 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "drupal/coder": "~8.3.0", "phpspec/phpspec": "~2.0 || ~4.0 || ~6.1 || dev-main", "phpunit/phpunit": "~6.0 || ~7.0 || ^9", - "mockery/mockery": "^0.9.4", + "mockery/mockery": "^1.5", "drupal/core-composer-scaffold": "^10@beta", "drupal/core-recommended": "^10@beta", "drupal/mailsystem": "^4.4", From e45edffe50b1841f8bc2d925431a4e659a04b015 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 7 Oct 2022 02:42:40 +1100 Subject: [PATCH 05/21] Fixed Recotr config. --- composer.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c0709cf..424ab94 100644 --- a/composer.json +++ b/composer.json @@ -33,9 +33,6 @@ "palantirnet/drupal-rector": "^0.13" }, "scripts": { - "post-install-cmd": [ - "cp ./vendor/palantirnet/drupal-rector/rector.php drupal/." - ], "test": [ "composer validate --no-interaction", "parallel-lint src spec tests", @@ -43,7 +40,9 @@ "phpspec run -f pretty --no-interaction", "phpcs --standard=./phpcs-ruleset.xml --ignore=drupal .", "./vendor/bin/drupal-check --drupal-root=drupal ./src/Drupal/Driver/Cores/Drupal8.php ./src/Drupal/Driver/Fields/Drupal8", - "cd drupal && ../vendor/bin/rector process ../src/Drupal/Driver/Cores/Drupal8.php ../src/Drupal/Driver/Fields/Drupal8 --dry-run" + "cp ./vendor/palantirnet/drupal-rector/rector.php drupal/.", + "cd drupal && ../vendor/bin/rector process ../src/Drupal/Driver/Cores/Drupal8.php --dry-run", + "cd drupal && ../vendor/bin/rector process ../src/Drupal/Driver/Fields/Drupal8 --dry-run" ] }, "autoload": { From 0fda7a9366b339a4fdbbc42578374ec254a2b5e3 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 12 Oct 2022 14:54:41 +1100 Subject: [PATCH 06/21] [#251] Fixed compatibility with Symfony\Process v4+ for Drush driver. --- src/Drupal/Driver/DrushDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Drupal/Driver/DrushDriver.php b/src/Drupal/Driver/DrushDriver.php index 2086e8a..bc50179 100644 --- a/src/Drupal/Driver/DrushDriver.php +++ b/src/Drupal/Driver/DrushDriver.php @@ -414,7 +414,7 @@ public function drush($command, array $arguments = [], array $options = []) { // Add any global arguments. $global = $this->getArguments(); - $process = new Process("{$this->binary} {$alias} {$string_options} {$global} {$command} {$arguments}"); + $process = Process::fromShellCommandline("{$this->binary} {$alias} {$string_options} {$global} {$command} {$arguments}"); $process->setTimeout(3600); $process->run(); From 16963d86db6f3f2f9aa7e5f6f530842ea545ec30 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 14 Oct 2022 09:37:47 +1100 Subject: [PATCH 07/21] Moved PHPCS exclusion to the phpcs config file. --- composer.json | 2 +- phpcs-ruleset.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 424ab94..055110b 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "parallel-lint src spec tests", "phpunit", "phpspec run -f pretty --no-interaction", - "phpcs --standard=./phpcs-ruleset.xml --ignore=drupal .", + "phpcs --standard=./phpcs-ruleset.xml .", "./vendor/bin/drupal-check --drupal-root=drupal ./src/Drupal/Driver/Cores/Drupal8.php ./src/Drupal/Driver/Fields/Drupal8", "cp ./vendor/palantirnet/drupal-rector/rector.php drupal/.", "cd drupal && ../vendor/bin/rector process ../src/Drupal/Driver/Cores/Drupal8.php --dry-run", diff --git a/phpcs-ruleset.xml b/phpcs-ruleset.xml index 97abe68..f87e72f 100644 --- a/phpcs-ruleset.xml +++ b/phpcs-ruleset.xml @@ -24,5 +24,6 @@ */vendor/* */CHANGELOG.md */README.md + ./drupal/* From 4bfaa47c52d4624faaa87468b4a856fb7e6d306f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 14 Oct 2022 09:39:29 +1100 Subject: [PATCH 08/21] Added conflict to composer.json to indicate incompatibility with old Drupal versions. --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 055110b..e6367c6 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,9 @@ "mglaman/drupal-check": "^1", "palantirnet/drupal-rector": "^0.13" }, + "conflict": { + "drupal/core": ">=8.0 <9.3" + }, "scripts": { "test": [ "composer validate --no-interaction", From 4499c712c815106433c63fcc11f77a5461eaf93e Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 14 Oct 2022 09:43:24 +1100 Subject: [PATCH 09/21] Reverted argument type changes and updated docblocks. --- src/Drupal/Driver/Cores/Drupal8.php | 4 ++-- src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Drupal/Driver/Cores/Drupal8.php b/src/Drupal/Driver/Cores/Drupal8.php index 4f021ab..f3ce528 100644 --- a/src/Drupal/Driver/Cores/Drupal8.php +++ b/src/Drupal/Driver/Cores/Drupal8.php @@ -387,12 +387,12 @@ public function getExtensionPathList() { * * @param string $entity_type * The entity type for which to return the field types. - * @param object $entity + * @param \StdClass $entity * Entity object. * @param array $base_fields * Base fields to be expanded in addition to user defined fields. */ - public function expandEntityBaseFields($entity_type, $entity, array $base_fields) { + public function expandEntityBaseFields($entity_type, \StdClass $entity, array $base_fields) { $this->expandEntityFields($entity_type, $entity, $base_fields); } diff --git a/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php b/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php index 395a703..62bb0f3 100644 --- a/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php +++ b/src/Drupal/Driver/Fields/Drupal8/AbstractHandler.php @@ -25,7 +25,7 @@ abstract class AbstractHandler implements FieldHandlerInterface { /** * Constructs an AbstractHandler object. * - * @param object $entity + * @param \StdClass $entity * The simulated entity object containing field information. * @param string $entity_type * The entity type. @@ -35,7 +35,7 @@ abstract class AbstractHandler implements FieldHandlerInterface { * @throws \Exception * Thrown when the given field name does not exist on the entity. */ - public function __construct($entity, $entity_type, $field_name) { + public function __construct(\StdClass $entity, $entity_type, $field_name) { if (empty($entity_type)) { throw new \Exception("You must specify an entity type in order to parse entity fields."); } From 2143a5061a205df35ef243cc5941fa8618e43ac2 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 14 Oct 2022 09:55:57 +1100 Subject: [PATCH 10/21] Added back testing using PHP 8.0. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 40ffc30..151f78f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: + - 8.0 - 8.1 install: From 6da53e8cf3a393c7a816980ee10d5c150b320152 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Fri, 14 Oct 2022 10:20:56 +1100 Subject: [PATCH 11/21] Revert "Added back testing using PHP 8.0." This reverts commit 2143a5061a205df35ef243cc5941fa8618e43ac2. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 151f78f..40ffc30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 8.0 - 8.1 install: From 0eb3908549f1213a020b3477a7d5c66ced3ea333 Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Mon, 17 Oct 2022 18:22:11 +0300 Subject: [PATCH 12/21] Support Drupal 10 --- src/Drupal/Driver/Cores/Drupal8.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Drupal/Driver/Cores/Drupal8.php b/src/Drupal/Driver/Cores/Drupal8.php index 4379c16..727cd80 100644 --- a/src/Drupal/Driver/Cores/Drupal8.php +++ b/src/Drupal/Driver/Cores/Drupal8.php @@ -15,7 +15,6 @@ use Drupal\taxonomy\TermInterface; use Drupal\user\Entity\Role; use Drupal\user\Entity\User; -use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; @@ -53,9 +52,12 @@ public function bootstrap() { $request = Request::createFromGlobals(); $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod'); $kernel->boot(); - // A route is required for route matching. - $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('')); - $request->attributes->set(RouteObjectInterface::ROUTE_NAME, ''); + // A route is required for route matching. In order to support Drupal 10 + // along with 8/9, we use the hadcoded values of RouteObjectInterface + // constants ROUTE_NAME and ROUTE_OBJECT. + // @see https://www.drupal.org/node/3151009 + $request->attributes->set('_route_object', new Route('')); + $request->attributes->set('_route', ''); $kernel->preHandle($request); // Initialise an anonymous session. required for the bootstrap. From 5ba2a4210e8438837ad9ebc62ab1cde57e00bfae Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Mon, 17 Oct 2022 19:04:02 +0300 Subject: [PATCH 13/21] Typo --- src/Drupal/Driver/Cores/Drupal8.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Drupal/Driver/Cores/Drupal8.php b/src/Drupal/Driver/Cores/Drupal8.php index 727cd80..05d6e19 100644 --- a/src/Drupal/Driver/Cores/Drupal8.php +++ b/src/Drupal/Driver/Cores/Drupal8.php @@ -53,7 +53,7 @@ public function bootstrap() { $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod'); $kernel->boot(); // A route is required for route matching. In order to support Drupal 10 - // along with 8/9, we use the hadcoded values of RouteObjectInterface + // along with 8/9, we use the hardcoded values of RouteObjectInterface // constants ROUTE_NAME and ROUTE_OBJECT. // @see https://www.drupal.org/node/3151009 $request->attributes->set('_route_object', new Route('')); From eb018dd1f1411d7f67c805c861aa94f22a150713 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 25 Oct 2022 10:25:12 +1100 Subject: [PATCH 14/21] Revert "Revert "Added back testing using PHP 8.0."" This reverts commit 6da53e8cf3a393c7a816980ee10d5c150b320152. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 40ffc30..151f78f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: + - 8.0 - 8.1 install: From 282ff13a16a7edefa681f6e1ac5278c062aa4b0f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Tue, 25 Oct 2022 10:26:24 +1100 Subject: [PATCH 15/21] Updated core and recommended packages to allow lower versions. --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e6367c6..cc67e23 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ "phpspec/phpspec": "~2.0 || ~4.0 || ~6.1 || dev-main", "phpunit/phpunit": "~6.0 || ~7.0 || ^9", "mockery/mockery": "^1.5", - "drupal/core-composer-scaffold": "^10@beta", - "drupal/core-recommended": "^10@beta", + "drupal/core-composer-scaffold": "^8.4 || ^9 || ^10@beta", + "drupal/core-recommended": "^8.4 || ^9 || ^10@beta", "drupal/mailsystem": "^4.4", "drush-ops/behat-drush-endpoint": "*", "php-parallel-lint/php-parallel-lint": "^1.0", From 6d6b41e8308d754207ea0e29e89bba307b2af151 Mon Sep 17 00:00:00 2001 From: Claudiu Cristea Date: Mon, 14 Nov 2022 09:31:48 +1100 Subject: [PATCH 16/21] Replaced Travis with GitHub actions. --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 12 ------------ docker-compose.yml | 17 +++++++++++++++++ 3 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml create mode 100644 docker-compose.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b46e1bc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: ci +on: [push, pull_request_target] +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php_version: ["7.4", "8.0", "8.1"] + drupal_version: ["9"] + exclude: + - php_version: "7.4" + drupal_version: "10" + - php_version: "8.0" + drupal_version: "10" + env: + PHP_VERSION: ${{ matrix.php_version }} + DRUPAL_VERSION: ${{ matrix.drupal_version }} + DOCKER_USER_ID: "1001" + steps: + - name: clone + uses: actions/checkout@v3 + - name: docker-compose up -d + run: docker-compose up -d + - name: composer self-update + run: docker-compose exec -T php composer self-update + - name: composer require + run: docker-compose exec -u ${DOCKER_USER_ID} -T php composer require --no-interaction --dev --no-update drupal/core:^${DRUPAL_VERSION} + - name: composer install + run: docker-compose exec -T php composer install + - name: composer test + run: docker-compose exec -T php composer test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 69e2c7c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php - -php: - - 7.4 - - 8.0 - - 8.1 - -install: - - composer install - -script: - - composer test diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..38dd332 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: "2" +services: + + php: + image: wodby/drupal-php:${PHP_VERSION} + environment: + PHP_FPM_USER: wodby + PHP_FPM_GROUP: wodby + PHP_FPM_CLEAR_ENV: "yes" + PHP_OPCACHE_PRELOAD_USER: wodby + PHP_XDEBUG_MODE: "off" + PHP_XDEBUG_REMOTE_CONNECT_BACK: 1 + PHP_XDEBUG_REMOTE_HOST: "10.254.254.254" + PHP_XDEBUG_IDEKEY: "PHPSTORM" + PHP_IDE_CONFIG: "serverName=drupaldriver" + volumes: + - ./:/var/www/html From 805be2f39a0eac71c485bbd4825540b2e15757d5 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 23 Nov 2022 08:09:05 +1100 Subject: [PATCH 17/21] Update .github/workflows/ci.yml Co-authored-by: Claudiu Cristea --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b46e1bc..0132916 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: ci -on: [push, pull_request_target] +on: [push, pull_request] jobs: tests: runs-on: ubuntu-latest From e033ac956d447480147a4408973684cfe320b7e5 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 23 Nov 2022 17:35:39 +1100 Subject: [PATCH 18/21] Updated GH actions to include D10 version. --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0132916..425f6f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,12 +7,10 @@ jobs: fail-fast: false matrix: php_version: ["7.4", "8.0", "8.1"] - drupal_version: ["9"] + drupal_version: ["9", "10"] exclude: - php_version: "7.4" drupal_version: "10" - - php_version: "8.0" - drupal_version: "10" env: PHP_VERSION: ${{ matrix.php_version }} DRUPAL_VERSION: ${{ matrix.drupal_version }} From b17388f1c254dd51f0fc246e808c3cb25a569be6 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 23 Nov 2022 17:46:44 +1100 Subject: [PATCH 19/21] Added phpunit-bridge. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cc67e23..e2f660b 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,8 @@ "php-parallel-lint/php-parallel-lint": "^1.0", "dms/phpunit-arraysubset-asserts": "^0.4.0", "mglaman/drupal-check": "^1", - "palantirnet/drupal-rector": "^0.13" + "palantirnet/drupal-rector": "^0.13", + "symfony/phpunit-bridge": "^6.1" }, "conflict": { "drupal/core": ">=8.0 <9.3" From 03ae7c9ea5a0071ea6d49a8868f5ad5ae0163bb6 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 23 Nov 2022 17:48:32 +1100 Subject: [PATCH 20/21] Exclude D10 from building on 8.0. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 425f6f5..5ec2adb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,8 @@ jobs: exclude: - php_version: "7.4" drupal_version: "10" + - php_version: "8.0" + drupal_version: "10" env: PHP_VERSION: ${{ matrix.php_version }} DRUPAL_VERSION: ${{ matrix.drupal_version }} From 3a9350923001d630ebee58b0dea38d0f67d60fbf Mon Sep 17 00:00:00 2001 From: Jonathan Hedstrom Date: Wed, 23 Nov 2022 11:01:38 -0800 Subject: [PATCH 21/21] Prep for 2.2.1 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52956b6..1e57de1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [2.2.1] + * [#250](https://github.com/jhedstrom/DrupalDriver/pull/250) Drupal 10 compatibility. ## [2.2.0] ### Fixed * [#232](https://github.com/jhedstrom/DrupalDriver/pull/232) Fixes typo in ImageHandler.