From c335221ac9b5c6fc4c6149ee4292fc79d18a6fc3 Mon Sep 17 00:00:00 2001 From: project update bot <66574-Project-Update-Bot@users.noreply.drupalcode.org> Date: Mon, 4 Nov 2024 15:10:22 +0000 Subject: [PATCH] Issue #3434076 by bluegeek9, project update bot, grevil, sourav_paul, gg24: Automated Drupal 11 compatibility fixes for quick_node_clone --- .gitignore | 2 ++ .gitlab-ci.yml | 16 +++++++--------- quick_node_clone.info.yml | 2 +- src/Form/QuickNodeCloneEntitySettingsForm.php | 12 ++++++++---- .../QuickNodeCloneExcludeNodeFieldsTest.php | 4 ++-- .../QuickNodeCloneExcludeParagraphFieldsTest.php | 6 +++--- tests/src/Functional/QuickNodeCloneTest.php | 4 ++-- 7 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b41ae3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +web +vendor diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index edb32a3..449e6bd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,18 +48,16 @@ include: # # Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml ################ -# variables: -# SKIP_ESLINT: '1' -# SKIP_PHPUNIT: 1 - -phpcs: - allow_failure: false -phpstan: - allow_failure: false +variables: + OPT_IN_TEST_PREVIOUS_MAJOR: 1 + OPT_IN_TEST_PREVIOUS_MINOR: 1 + OPT_IN_TEST_NEXT_MINOR: 1 + OPT_IN_TEST_NEXT_MAJOR: 1 + OPT_IN_TEST_MAX_PHP: 1 # Additional testing of older group versions, the latest version is tested in the default launch. group_integration: - extends: phpunit + extends: phpunit (previous major) before_script: - composer require drupal/group:$GROUP_VERSION --dev variables: diff --git a/quick_node_clone.info.yml b/quick_node_clone.info.yml index 856eb51..05fc4dc 100644 --- a/quick_node_clone.info.yml +++ b/quick_node_clone.info.yml @@ -1,7 +1,7 @@ name: Quick Node Clone type: module description: 'Quickly clone a node with regular fields.' -core_version_requirement: ^8.8 || ^9 || ^10 +core_version_requirement: ^10 || ^11 configure: quick_node_clone.settingsform dependencies: - drupal:node diff --git a/src/Form/QuickNodeCloneEntitySettingsForm.php b/src/Form/QuickNodeCloneEntitySettingsForm.php index 6b18a48..8344f83 100644 --- a/src/Form/QuickNodeCloneEntitySettingsForm.php +++ b/src/Form/QuickNodeCloneEntitySettingsForm.php @@ -3,6 +3,7 @@ namespace Drupal\quick_node_clone\Form; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -62,7 +63,8 @@ abstract class QuickNodeCloneEntitySettingsForm extends ConfigFormBase implement $container->get('config.factory'), $container->get('entity_field.manager'), $container->get('entity_type.bundle.info'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('config.typed') ?? NULL ); } @@ -98,9 +100,11 @@ abstract class QuickNodeCloneEntitySettingsForm extends ConfigFormBase implement * The entity type bundle info provider. * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler * The module handler service. + * @param \Drupal\Core\Config\TypedConfigManagerInterface|null $typedConfigManager + * The typed config manager. */ - public function __construct(ConfigFactoryInterface $configFactory, EntityFieldManagerInterface $entityFieldManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo, ModuleHandlerInterface $moduleHandler) { - parent::__construct($configFactory); + public function __construct(ConfigFactoryInterface $configFactory, EntityFieldManagerInterface $entityFieldManager, EntityTypeBundleInfoInterface $entityTypeBundleInfo, ModuleHandlerInterface $moduleHandler, $typedConfigManager) { + parent::__construct($configFactory, $typedConfigManager); $this->configFactory = $configFactory; $this->entityFieldManager = $entityFieldManager; $this->entityTypeBundleInfo = $entityTypeBundleInfo; @@ -148,7 +152,7 @@ abstract class QuickNodeCloneEntitySettingsForm extends ConfigFormBase implement '#ajax' => [ 'callback' => 'Drupal\quick_node_clone\Form\QuickNodeCloneEntitySettingsForm::fieldsCallback', 'wrapper' => 'fields-list-' . $this->getEntityTypeId(), - 'method' => 'replace', + 'method' => 'replaceWith', ], ]; diff --git a/tests/src/Functional/QuickNodeCloneExcludeNodeFieldsTest.php b/tests/src/Functional/QuickNodeCloneExcludeNodeFieldsTest.php index 39bafaf..4480356 100644 --- a/tests/src/Functional/QuickNodeCloneExcludeNodeFieldsTest.php +++ b/tests/src/Functional/QuickNodeCloneExcludeNodeFieldsTest.php @@ -69,8 +69,8 @@ class QuickNodeCloneExcludeNodeFieldsTest extends BrowserTestBase { $this->submitForm($edit, 'Save'); // Create a basic page. - $title_value = $this->randomGenerator->word(10); - $body_value = $this->randomGenerator->sentences(10); + $title_value = 'The Original Page'; + $body_value = '<p>This is the original page.</p>'; $edit = [ 'title[0][value]' => $title_value, 'body[0][value]' => $body_value, diff --git a/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php b/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php index bc60f13..cbda38b 100644 --- a/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php +++ b/tests/src/Functional/QuickNodeCloneExcludeParagraphFieldsTest.php @@ -84,9 +84,9 @@ class QuickNodeCloneExcludeParagraphFieldsTest extends ParagraphsTestBase { // Create a node and add two Paragraphs. $this->drupalGet('node/add/paragraphed_test'); - $title_value = $this->randomGenerator->word(10); - $text1 = $this->randomGenerator->word(10); - $text2 = $this->randomGenerator->word(10); + $title_value = 'The Original Page'; + $text1 = 'This is text 1'; + $text2 = 'This is text 2'; $edit = [ 'title[0][value]' => $title_value, 'field_paragraphs[0][subform][field_text1][0][value]' => $text1, diff --git a/tests/src/Functional/QuickNodeCloneTest.php b/tests/src/Functional/QuickNodeCloneTest.php index 8ebae0d..f18cb66 100644 --- a/tests/src/Functional/QuickNodeCloneTest.php +++ b/tests/src/Functional/QuickNodeCloneTest.php @@ -59,8 +59,8 @@ class QuickNodeCloneTest extends BrowserTestBase { $this->submitForm($edit, 'Save configuration'); // Create a basic page. - $title_value = $this->randomGenerator->word(10); - $body_value = $this->randomGenerator->sentences(10); + $title_value = 'The Original Page'; + $body_value = '<p>This is the original page.</p>'; $edit = [ 'title[0][value]' => $title_value, 'body[0][value]' => $body_value, -- GitLab