From e99db44bd261ff3661ac66fc81e90ec3be58a022 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Mon, 1 Jul 2024 16:33:48 +0700 Subject: [PATCH 1/5] Init --- .circleci/config.yml | 21 ++++++++++----------- composer.dev.json | 6 +++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 82f8427..d2fb0ba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -172,26 +172,25 @@ workflows: filters: tags: only: /.*/ -# Enable D11 once https://www.drupal.org/project/config_filter/issues/3428542 is resolved -# - test-php-8.2-next: -# filters: -# tags: -# only: /.*/ + - test-php-8.2-next: + filters: + tags: + only: /.*/ - test-php-8.3: filters: tags: only: /.*/ -# - test-php-8.3-next: -# filters: -# tags: -# only: /.*/ + - test-php-8.3-next: + filters: + tags: + only: /.*/ - deploy: requires: - test-php-8.2 - test-php-8.2-legacy - #- test-php-8.2-next + - test-php-8.2-next - test-php-8.3 - #- test-php-8.3-next + - test-php-8.3-next filters: tags: only: /.*/ diff --git a/composer.dev.json b/composer.dev.json index 84ae244..f1694be 100644 --- a/composer.dev.json +++ b/composer.dev.json @@ -18,6 +18,10 @@ }, "extra": { "phpcodesniffer-search-depth": 10, - "patches": {} + "patches": { + "drupal/config_filter": { + "Automated Drupal 11 compatibility fixes for config_filter": "https://git.drupalcode.org/project/config_filter/-/merge_requests/9.patch" + } + } } } From f5916707e82b407f91962dde343bc07ecdc16066 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Mon, 1 Jul 2024 16:36:36 +0700 Subject: [PATCH 2/5] Init --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d2fb0ba..876f4c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -172,18 +172,18 @@ workflows: filters: tags: only: /.*/ - - test-php-8.2-next: - filters: - tags: - only: /.*/ + - test-php-8.2-next: + filters: + tags: + only: /.*/ - test-php-8.3: filters: tags: only: /.*/ - - test-php-8.3-next: - filters: - tags: - only: /.*/ + - test-php-8.3-next: + filters: + tags: + only: /.*/ - deploy: requires: - test-php-8.2 From d93219473c9936f2c0c57d66f2642e8096f26c68 Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Thu, 4 Jul 2024 10:08:49 +0700 Subject: [PATCH 3/5] Setup drupal lenient for config filter module. --- composer.dev.json | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/composer.dev.json b/composer.dev.json index f1694be..692883a 100644 --- a/composer.dev.json +++ b/composer.dev.json @@ -8,20 +8,27 @@ "phpmd/phpmd": "^2.15", "phpspec/prophecy-phpunit": "^2", "phpstan/extension-installer": "^1.3", + "mglaman/composer-drupal-lenient": "^1", "vincentlanglet/twig-cs-fixer": "^2.8" }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "mglaman/composer-drupal-lenient": true } }, "extra": { + "drupal-lenient": { + "allowed-list": [ + "drupal/config_filter" + ] + }, "phpcodesniffer-search-depth": 10, "patches": { - "drupal/config_filter": { - "Automated Drupal 11 compatibility fixes for config_filter": "https://git.drupalcode.org/project/config_filter/-/merge_requests/9.patch" - } + "drupal/config_filter": { + "Automated Drupal 11 compatibility fixes for config_filter": "https://git.drupalcode.org/project/config_filter/-/merge_requests/9.patch" + } } } } From 02d78a15e657a2e62d9a14a827f8a04493f1d97f Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Thu, 4 Jul 2024 10:46:36 +0700 Subject: [PATCH 4/5] Lint D11 --- .circleci/config.yml | 14 ----- .../Traits/GeneratedContentTestMockTrait.php | 60 ------------------- 2 files changed, 74 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 876f4c2..8756bf1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,15 +117,6 @@ jobs: DRUPAL_PROJECT_SHA: 10.x <<: *job-test - test-php-8.2-next: - <<: *container_config - docker: - - image: cimg/php:8.2-browsers - environment: - DRUPAL_VERSION: 11@alpha - DRUPAL_PROJECT_SHA: 11.x - <<: *job-test - test-php-8.3: <<: *container_config docker: @@ -172,10 +163,6 @@ workflows: filters: tags: only: /.*/ - - test-php-8.2-next: - filters: - tags: - only: /.*/ - test-php-8.3: filters: tags: @@ -188,7 +175,6 @@ workflows: requires: - test-php-8.2 - test-php-8.2-legacy - - test-php-8.2-next - test-php-8.3 - test-php-8.3-next filters: diff --git a/tests/src/Traits/GeneratedContentTestMockTrait.php b/tests/src/Traits/GeneratedContentTestMockTrait.php index 66e18cb..6ec5a6c 100644 --- a/tests/src/Traits/GeneratedContentTestMockTrait.php +++ b/tests/src/Traits/GeneratedContentTestMockTrait.php @@ -4,8 +4,6 @@ namespace Drupal\Tests\generated_content\Traits; -use PHPUnit\Framework\MockObject\Stub\Stub; - /** * Trait GeneratedContentTestHelperTrait. * @@ -80,64 +78,6 @@ protected static function getProtectedValue(object $object, string $property) { return $property->getValue($class); } - /** - * Helper to prepare class mock. - * - * @param class-string|object $class - * Class name to generate the mock. - * @param array $methodsMap - * Optional array of methods and values, keyed by method name. - * @param array $args - * Optional array of constructor arguments. If omitted, a constructor will - * not be called. - * - * @return \PHPUnit\Framework\MockObject\MockObject|string - * Mocked class. - * - * @throws \ReflectionException - */ - protected function prepareMock($class, array $methodsMap = [], array $args = []) { - $methods = array_keys($methodsMap); - - $reflectionClass = new \ReflectionClass($class); - - $class_name = is_object($class) ? get_class($class) : $class; - - if ($reflectionClass->isAbstract()) { - $mock = $this->getMockForAbstractClass( - $class_name, $args, '', !empty($args), TRUE, TRUE, $methods - ); - } - else { - $mock = $this->getMockBuilder($class_name); - if (!empty($args)) { - $mock = $mock->enableOriginalConstructor() - ->setConstructorArgs($args); - } - else { - $mock = $mock->disableOriginalConstructor(); - } - $mock = $mock->onlyMethods($methods) - ->getMock(); - } - - foreach ($methodsMap as $method => $value) { - // Handle callback values differently. - if ($value instanceof Stub && strpos(get_class($value), 'Callback') !== FALSE) { - $mock->expects($this->any()) - ->method($method) - ->will($value); - } - else { - $mock->expects($this->any()) - ->method($method) - ->willReturn($value); - } - } - - return $mock; - } - /** * Check if testing framework was ran with --debug option. */ From 3c6693171ba7e6c9dafdc9bdb7031d5a934d9abc Mon Sep 17 00:00:00 2001 From: "tan.nguyen" Date: Thu, 4 Jul 2024 11:09:37 +0700 Subject: [PATCH 5/5] Lint --- .../generated_content_example1.info.yml | 2 +- .../generated_content_example2.info.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/generated_content_example1/generated_content_example1.info.yml b/modules/generated_content_example1/generated_content_example1.info.yml index 6aad523..65106c6 100644 --- a/modules/generated_content_example1/generated_content_example1.info.yml +++ b/modules/generated_content_example1/generated_content_example1.info.yml @@ -1,7 +1,7 @@ name: Generated Content Example 1 type: module description: Example 1 to programmatically generate content. -core_version_requirement: ^9 || ^10 +core_version_requirement: ^9 || ^10 || ^11 package: Other dependencies: - generated_content:generated_content diff --git a/modules/generated_content_example2/generated_content_example2.info.yml b/modules/generated_content_example2/generated_content_example2.info.yml index 39708ed..a7cc849 100644 --- a/modules/generated_content_example2/generated_content_example2.info.yml +++ b/modules/generated_content_example2/generated_content_example2.info.yml @@ -1,7 +1,7 @@ name: Generated Content Example 2 type: module description: Example 2 to programmatically generate content. -core_version_requirement: ^9 || ^10 +core_version_requirement: ^9 || ^10 || ^11 package: Other dependencies: - generated_content:generated_content