From c717e8386974317c2be2f7e7a40e7646109d91d9 Mon Sep 17 00:00:00 2001 From: Michael Lee <lee.5151@osu.edu> Date: Wed, 7 Aug 2024 11:08:51 -0400 Subject: [PATCH] Upgrading drupal/pathauto (1.12.0 => 1.13.0) --- composer.json | 2 +- composer.lock | 21 ++++---- vendor/composer/installed.json | 21 ++++---- vendor/composer/installed.php | 10 ++-- web/modules/pathauto/.gitlab-ci.yml | 13 +++++ web/modules/pathauto/composer.json | 3 ++ ...stem.action.pathauto_update_alias_node.yml | 1 + ...stem.action.pathauto_update_alias_user.yml | 1 + .../config/schema/pathauto_pattern.schema.yml | 12 ++--- web/modules/pathauto/logo.png | 22 ++++++++ web/modules/pathauto/pathauto.info.yml | 8 +-- web/modules/pathauto/pathauto.install | 4 +- web/modules/pathauto/pathauto.module | 12 +++-- web/modules/pathauto/pathauto.permissions.yml | 8 ++- web/modules/pathauto/pathauto.routing.yml | 4 +- .../pathauto/src/AliasStorageHelper.php | 5 +- web/modules/pathauto/src/AliasUniquifier.php | 20 +++----- .../pathauto/src/Entity/PathautoPattern.php | 11 +++- .../pathauto/src/Form/PathautoAdminDelete.php | 5 +- .../src/Form/PathautoSettingsForm.php | 50 ++++--------------- .../pathauto/src/Form/PatternEditForm.php | 5 +- .../Plugin/Deriver/EntityAliasTypeDeriver.php | 2 +- .../Plugin/migrate/source/PathautoPattern.php | 4 +- .../AliasType/EntityAliasTypeBase.php | 9 ++-- .../pathauto_custom_punctuation_test.info.yml | 6 +-- .../pathauto_string_id_test.info.yml | 6 +-- .../config/install/views.view.articles.yml | 1 - .../pathauto_views_test.info.yml | 6 +-- .../src/Functional/PathautoBulkUpdateTest.php | 10 ++-- .../PathautoEnablingEntityTypesTest.php | 2 + .../src/Functional/PathautoMassDeleteTest.php | 8 ++- .../src/Functional/PathautoNodeWebTest.php | 8 ++- .../PathautoSettingsFormWebTest.php | 2 + .../Functional/PathautoTaxonomyWebTest.php | 2 + .../src/Functional/PathautoUserWebTest.php | 2 + .../PathautoLocaleTest.php | 31 ++++++++---- .../FunctionalJavascript/PathautoUiTest.php | 9 ++-- .../Kernel/PathautoEntityWithStringIdTest.php | 10 ++-- .../tests/src/Kernel/PathautoTokenTest.php | 24 +++++++-- .../tests/src/Unit/VerboseMessengerTest.php | 1 + 40 files changed, 233 insertions(+), 148 deletions(-) create mode 100644 web/modules/pathauto/logo.png diff --git a/composer.json b/composer.json index 49289570ef..4c0e72f991 100644 --- a/composer.json +++ b/composer.json @@ -139,7 +139,7 @@ "drupal/multiple_fields_remove_button": "2.2.0", "drupal/pantheon_advanced_page_cache": "2.2.0", "drupal/paragraphs": "1.17", - "drupal/pathauto": "1.12", + "drupal/pathauto": "1.13", "drupal/queue_mail": "^1.4", "drupal/realname": "^2.0@beta", "drupal/rebuild_cache_access": "^1.8", diff --git a/composer.lock b/composer.lock index 5d579bffaf..2ee86fc903 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d2384c8feb8d2e9a8a6df7b123fdb332", + "content-hash": "a8abbbcb38b5b9189862e21f9261f25f", "packages": [ { "name": "algolia/places", @@ -5167,31 +5167,34 @@ }, { "name": "drupal/pathauto", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/pathauto.git", - "reference": "8.x-1.12" + "reference": "8.x-1.13" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/pathauto-8.x-1.12.zip", - "reference": "8.x-1.12", - "shasum": "b7b6432e315e38e59a7c6cc117134326c580de4c" + "url": "https://ftp.drupal.org/files/projects/pathauto-8.x-1.13.zip", + "reference": "8.x-1.13", + "shasum": "e64b5a82cf1b8ab48bce400b21ae6fc99c8078fd" }, "require": { - "drupal/core": "^9.3 || ^10", + "drupal/core": "^9.4 || ^10 || ^11", "drupal/ctools": "*", "drupal/token": "*" }, + "require-dev": { + "drupal/forum": "*" + }, "suggest": { "drupal/redirect": "When installed Pathauto will provide a new \"Update Action\" in case your URLs change. This is the recommended update action and is considered the best practice for SEO and usability." }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.12", - "datestamp": "1696776683", + "version": "8.x-1.13", + "datestamp": "1722507672", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 4a2c3e3dab..fd12b5a08d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -5434,32 +5434,35 @@ }, { "name": "drupal/pathauto", - "version": "1.12.0", - "version_normalized": "1.12.0.0", + "version": "1.13.0", + "version_normalized": "1.13.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/pathauto.git", - "reference": "8.x-1.12" + "reference": "8.x-1.13" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/pathauto-8.x-1.12.zip", - "reference": "8.x-1.12", - "shasum": "b7b6432e315e38e59a7c6cc117134326c580de4c" + "url": "https://ftp.drupal.org/files/projects/pathauto-8.x-1.13.zip", + "reference": "8.x-1.13", + "shasum": "e64b5a82cf1b8ab48bce400b21ae6fc99c8078fd" }, "require": { - "drupal/core": "^9.3 || ^10", + "drupal/core": "^9.4 || ^10 || ^11", "drupal/ctools": "*", "drupal/token": "*" }, + "require-dev": { + "drupal/forum": "*" + }, "suggest": { "drupal/redirect": "When installed Pathauto will provide a new \"Update Action\" in case your URLs change. This is the recommended update action and is considered the best practice for SEO and usability." }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.12", - "datestamp": "1696776683", + "version": "8.x-1.13", + "datestamp": "1722507672", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index b3271eb369..71a04565c4 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'osu-asc-webservices/d8-upstream', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'd85ef4c34240e822ad3c5a4a0b68dfdd51dec002', + 'reference' => 'de0e709f8607cf86e9f2729ef42a60fcc10ddd0f', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -944,9 +944,9 @@ 'dev_requirement' => false, ), 'drupal/pathauto' => array( - 'pretty_version' => '1.12.0', - 'version' => '1.12.0.0', - 'reference' => '8.x-1.12', + 'pretty_version' => '1.13.0', + 'version' => '1.13.0.0', + 'reference' => '8.x-1.13', 'type' => 'drupal-module', 'install_path' => __DIR__ . '/../../web/modules/pathauto', 'aliases' => array(), @@ -1555,7 +1555,7 @@ 'osu-asc-webservices/d8-upstream' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => 'd85ef4c34240e822ad3c5a4a0b68dfdd51dec002', + 'reference' => 'de0e709f8607cf86e9f2729ef42a60fcc10ddd0f', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/web/modules/pathauto/.gitlab-ci.yml b/web/modules/pathauto/.gitlab-ci.yml index 94b86d0a8f..7d3d799c11 100644 --- a/web/modules/pathauto/.gitlab-ci.yml +++ b/web/modules/pathauto/.gitlab-ci.yml @@ -48,7 +48,20 @@ include: ################ # variables: # SKIP_ESLINT: '1' +variables: + OPT_IN_TEST_PREVIOUS_MINOR: '1' + _PHPUNIT_CONCURRENT: 1 +composer (next major): + variables: + _LENIENT_ALLOW_LIST: "ctools" + PHP_VERSION: $CORE_PHP_MAX + DRUPAL_CORE: $CORE_MAJOR_DEVELOPMENT + IGNORE_PROJECT_DRUPAL_CORE_VERSION: 1 + +phpunit (next major): + variables: + SYMFONY_DEPRECATIONS_HELPER: "disabled" ################################################################################### # diff --git a/web/modules/pathauto/composer.json b/web/modules/pathauto/composer.json index 5f90dfab3a..61175d50de 100644 --- a/web/modules/pathauto/composer.json +++ b/web/modules/pathauto/composer.json @@ -13,6 +13,9 @@ "drupal/token": "*", "drupal/ctools": "*" }, + "require-dev": { + "drupal/forum": "*" + }, "suggest": { "drupal/redirect": "When installed Pathauto will provide a new \"Update Action\" in case your URLs change. This is the recommended update action and is considered the best practice for SEO and usability." }, diff --git a/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_node.yml b/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_node.yml index 65e99a95c3..3e9b9aa183 100644 --- a/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_node.yml +++ b/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_node.yml @@ -10,3 +10,4 @@ dependencies: - node module: - pathauto +configuration: { } diff --git a/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_user.yml b/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_user.yml index f4cc264286..fdec1b8df7 100644 --- a/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_user.yml +++ b/web/modules/pathauto/config/optional/system.action.pathauto_update_alias_user.yml @@ -10,3 +10,4 @@ dependencies: - user module: - pathauto +configuration: { } diff --git a/web/modules/pathauto/config/schema/pathauto_pattern.schema.yml b/web/modules/pathauto/config/schema/pathauto_pattern.schema.yml index 3142ec3cc5..e83c86031b 100644 --- a/web/modules/pathauto/config/schema/pathauto_pattern.schema.yml +++ b/web/modules/pathauto/config/schema/pathauto_pattern.schema.yml @@ -30,9 +30,9 @@ pathauto.pattern.*: type: sequence label: 'Context definitions' sequence: - - type: mapping - label: 'Relationship' - mapping: - label: - type: label - label: 'Label' + type: mapping + label: 'Relationship' + mapping: + label: + type: label + label: 'Label' diff --git a/web/modules/pathauto/logo.png b/web/modules/pathauto/logo.png new file mode 100644 index 0000000000..24d756930b --- /dev/null +++ b/web/modules/pathauto/logo.png @@ -0,0 +1,22 @@ +�PNG + +��� IHDR����������<i���gAMA�����a���sRGB�������iTXtXML:com.adobe.xmp�����<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0"> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="" + xmlns:tiff="http://ns.adobe.com/tiff/1.0/" + xmlns:exif="http://ns.adobe.com/exif/1.0/"> + <tiff:YResolution>72</tiff:YResolution> + <tiff:XResolution>72</tiff:XResolution> + <tiff:Orientation>1</tiff:Orientation> + <exif:PixelXDimension>600</exif:PixelXDimension> + <exif:ColorSpace>1</exif:ColorSpace> + <exif:PixelYDimension>600</exif:PixelYDimension> + </rdf:Description> + </rdf:RDF> +</x:xmpmeta> +:������ pHYs���������� PLTE�(D���લG����%IDATx�흿n�8�%�����<���)�T�*׳Oc 맼$k;�!�"-��C�_�ٵ䏣���l�T������������������������������������������،s]��~���V��5�7SM���m��u����[Y������}�j7�Pӈ�]�9�;��9!p� `���5���'����N|��ᄈk81�N\��ĵ���É�B@M#Ĝ�pb8��{Jz|�+@ۧ�F�n���H�5N�ޠ�ڦ�70�UN��`Y����]�* +�j0w!`�(`��L@SQ��)� ����(`ݜ��]�* +0�jm~�.4��X/@݅��ď���ޏk�u���o��ϟ7��*Gg�㵛���8)0��^I�~�~'�A�o�7%����N=d8˜Iϙ8�n��CM�������=j"Qe�&X��-`�?���Kz8�'�g�C�&dv�M�_=�<���� +�lB�C��^}��������?���x� /ԉ�����KR�V� Y! B5�z��;�۪��S�S��K'��cM�fi��xLE`N�C� �▝��?$"�gz�0�Ґ̉�|����:�~�q���Y�i�^h�T��ʖE " �~W��ڮ�@+\���fu�� �|'�WG v�m�����<^�s����I��U��:'��L�>���d9�?%�~:r|�Ф���q߉;�����M��r��ĮNF���=m���BN�^�o�}��Þfx:}'���2"�<�iF4^2�楳�����OF�� [�}j�='�,cLF��m�*�-z��Ě�]|]�� <'6��D�����Ćg�ˍ��/�F���Z��XS�Hs��~�;�㏫+�y��B?l=�o�������sb%dP~�Hk��p�9qd��0:����s�Ȟ�+���>m&)�/�@t��d�MsS�},�]ډ<'�R}(+�=߅��ăЇ���8�#��,cى���"%}�(�=ߤ���0��(�K���9�ƾR�Nh�#��w��9�N�-��@�����;)|9� s��D��W�B�ECpS���"0� ���8��怎SR���K�!��㉞! ډLI\!���F`Xv�5�� +�X���\��`�Z��V���Y���_�����>��Z���2�i�mƂ2d�h��x�| !�NcẄ��Ѽ�IJ��2��Iiٺ�hR��|����NH�/\����4+���diF��&�Ô�?P�8�֮����tCAڠ(�(٠��#����o����6�l��~�7l��`��m(�a�8Q���t,?��J�-�t��姴U;�#]J@�V-��f� ����@�f5�Oa�~�L�ٮ���y�,z�-iִ���[�pd3��$��Ȧ� ��q� t�lG<�jS�V�9u���Լ��i^}l����҆� �����b'�Ώ� WZ@x��3'�4���� �(�,?��K^�3z|oHF��8� �M��}8�R��H�s]# +(*`t~%���h�wg���x5๚��,�WRگAt���"Կ�;��xqa��2����K��+����(7.]����������D�t맹�m�\�;<�6��L�u@/֒�ersT@I)Wdk�Z���p��=K��"��6�^��4��2��O�?�o`�2E���/h��99Zx�&,��K�蚭�#��JQ����蚭�������B��z�u����6ܱOq�s`&=�)�e�]�_�I��<����r��w}�����]������^p`����E3IT ���D�/h����W<�H���-:Z`L���64NL/�5��{���Ԇ�+\�"/�O A�������v. N�j������"�4�y�� n�γ�������چ����Q�M�D2�}F5.�j�6���� �������?4Ͳ���H_[���{��7��*����८���������������������������������������������������������ߑo�b;}������IEND�B`� \ No newline at end of file diff --git a/web/modules/pathauto/pathauto.info.yml b/web/modules/pathauto/pathauto.info.yml index d9016d99da..12c4eab3a3 100644 --- a/web/modules/pathauto/pathauto.info.yml +++ b/web/modules/pathauto/pathauto.info.yml @@ -1,6 +1,6 @@ name : 'Pathauto' description : 'Provides a mechanism for modules to automatically generate aliases for the content they manage.' -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^9.4 || ^10 || ^11 type: module dependencies: @@ -12,7 +12,7 @@ configure: entity.pathauto_pattern.collection recommends: - redirect:redirect -# Information added by Drupal.org packaging script on 2023-10-08 -version: '8.x-1.12' +# Information added by Drupal.org packaging script on 2024-08-01 +version: '8.x-1.13' project: 'pathauto' -datestamp: 1696776686 +datestamp: 1722507674 diff --git a/web/modules/pathauto/pathauto.install b/web/modules/pathauto/pathauto.install index ae91fdbc1e..f47eabc25e 100644 --- a/web/modules/pathauto/pathauto.install +++ b/web/modules/pathauto/pathauto.install @@ -134,7 +134,7 @@ function pathauto_update_8100() { $language = NULL; preg_match('/^(.*)_([a-z-]*)$/', $bundle, $matches); if (count($matches) == 3) { - list(, $extracted_bundle, $langcode) = $matches; + [, $extracted_bundle, $langcode] = $matches; $language = $language_manager->getLanguage($langcode); } // Validate bundle, langcode and language. @@ -173,7 +173,7 @@ function pathauto_update_8100() { 'negate' => FALSE, 'context_mapping' => [ 'language' => $language_mapping, - ] + ], ]); // Add the context relationship for this language. diff --git a/web/modules/pathauto/pathauto.module b/web/modules/pathauto/pathauto.module index d1faa47c75..b029f944f8 100644 --- a/web/modules/pathauto/pathauto.module +++ b/web/modules/pathauto/pathauto.module @@ -52,7 +52,10 @@ function pathauto_help($route_name, RouteMatchInterface $route_match) { $output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<dd>' . t('Pathauto is accessed from the tabs it adds to the list of <a href=":aliases">URL aliases</a>.', [':aliases' => Url::fromRoute('entity.path_alias.collection')->toString()]) . '</dd>'; $output .= '<dt>' . t('Creating Pathauto Patterns') . '</dt>'; - $output .= '<dd>' . t('The <a href=":pathauto_pattern">"Patterns"</a> page is used to configure automatic path aliasing. New patterns are created here using the <a href=":add_form">Add Pathauto pattern</a> button which presents a form to simplify pattern creation thru the use of <a href="token">available tokens</a>. The patterns page provides a list of all patterns on the site and allows you to edit and reorder them. An alias is generated for the first pattern that applies.', [':pathauto_pattern' => Url::fromRoute('entity.pathauto_pattern.collection')->toString(), ':add_form' => Url::fromRoute('entity.pathauto_pattern.add_form')->toString()]) . '</dd>'; + $output .= '<dd>' . t('The <a href=":pathauto_pattern">"Patterns"</a> page is used to configure automatic path aliasing. New patterns are created here using the <a href=":add_form">Add Pathauto pattern</a> button which presents a form to simplify pattern creation thru the use of <a href="token">available tokens</a>. The patterns page provides a list of all patterns on the site and allows you to edit and reorder them. An alias is generated for the first pattern that applies.', [ + ':pathauto_pattern' => Url::fromRoute('entity.pathauto_pattern.collection')->toString(), + ':add_form' => Url::fromRoute('entity.pathauto_pattern.add_form')->toString(), + ]) . '</dd>'; $output .= '<dt>' . t('Pathauto Settings') . '</dt>'; $output .= '<dd>' . t('The <a href=":settings">"Settings"</a> page is used to customize global Pathauto settings for automated pattern creation.', [':settings' => Url::fromRoute('pathauto.settings.form')->toString()]) . '</dd>'; $output .= '<dd>' . t('The <strong>maximum alias length</strong> and <strong>maximum component length</strong> values default to 100 and have a limit of @max from Pathauto. You should enter a value that is the length of the "alias" column of the path_alias database table minus the length of any strings that might get added to the end of the URL. The recommended and default value is 100.', ['@max' => \Drupal::service('pathauto.alias_storage_helper')->getAliasSchemaMaxlength()]) . '</dd>'; @@ -161,11 +164,14 @@ function pathauto_pattern_validate($element, FormStateInterface $form_state) { } if (!empty($invalid_characters_used)) { - $form_state->setError($element, t('The %element-title is using the following invalid characters: @invalid-characters.', ['%element-title' => $title, '@invalid-characters' => implode(', ', $invalid_characters_used)])); + $form_state->setError($element, t('The %element-title is using the following invalid characters: @invalid-characters.', [ + '%element-title' => $title, + '@invalid-characters' => implode(', ', $invalid_characters_used), + ])); } if (preg_match('/(\s$)+/', $element['#value'])) { - $form_state->setError($element, t('The %element-title doesn\'t allow the patterns ending with whitespace.', ['%element-title' => $title])); + $form_state->setError($element, t("The %element-title doesn't allow the patterns ending with whitespace.", ['%element-title' => $title])); } } diff --git a/web/modules/pathauto/pathauto.permissions.yml b/web/modules/pathauto/pathauto.permissions.yml index ede9f288c3..4602041ee9 100644 --- a/web/modules/pathauto/pathauto.permissions.yml +++ b/web/modules/pathauto/pathauto.permissions.yml @@ -1,6 +1,12 @@ administer pathauto: title: 'Administer pathauto' - description: 'Allows a user to configure patterns for automated aliases and bulk delete URL-aliases.' + description: 'Allows a user to configure pathauto settings, configure patterns for automated aliases, bulk update and delete URL-aliases.' notify of path changes: title: 'Notify of Path Changes' description: 'Determines whether or not users are notified.' +bulk update aliases: + title: 'Bulk update aliases' + description: 'Allows a user to bulk update aliases.' +bulk delete aliases: + title: 'Bulk delete aliases' + description: 'Allows a user to bulk delete aliases.' diff --git a/web/modules/pathauto/pathauto.routing.yml b/web/modules/pathauto/pathauto.routing.yml index 1cb56f987c..1bbdbee58d 100644 --- a/web/modules/pathauto/pathauto.routing.yml +++ b/web/modules/pathauto/pathauto.routing.yml @@ -52,7 +52,7 @@ pathauto.bulk.update.form: _form: '\Drupal\pathauto\Form\PathautoBulkUpdateForm' _title: 'Bulk generate' requirements: - _permission: 'administer url aliases' + _permission: 'administer pathauto+bulk update aliases' pathauto.admin.delete: path: '/admin/config/search/path/delete_bulk' @@ -60,4 +60,4 @@ pathauto.admin.delete: _form: '\Drupal\pathauto\Form\PathautoAdminDelete' _title: 'Delete aliases' requirements: - _permission: 'administer url aliases' + _permission: 'administer pathauto+bulk delete aliases' diff --git a/web/modules/pathauto/src/AliasStorageHelper.php b/web/modules/pathauto/src/AliasStorageHelper.php index c415e22012..ad8869d988 100644 --- a/web/modules/pathauto/src/AliasStorageHelper.php +++ b/web/modules/pathauto/src/AliasStorageHelper.php @@ -242,7 +242,10 @@ public function countAll() { * {@inheritdoc} */ public function deleteMultiple($pids) { - $this->entityTypeManager->getStorage('path_alias')->delete($this->entityTypeManager->getStorage('path_alias')->loadMultiple($pids)); + // Avoid hitting memory limit by deleting a chunk at a time. + foreach (array_chunk($pids, 100) as $chunk) { + $this->entityTypeManager->getStorage('path_alias')->delete($this->entityTypeManager->getStorage('path_alias')->loadMultiple($chunk)); + } } } diff --git a/web/modules/pathauto/src/AliasUniquifier.php b/web/modules/pathauto/src/AliasUniquifier.php index caf12702ba..fd92bc52ec 100644 --- a/web/modules/pathauto/src/AliasUniquifier.php +++ b/web/modules/pathauto/src/AliasUniquifier.php @@ -119,19 +119,13 @@ public function isReserved($alias, $source, $langcode = LanguageInterface::LANGC $source, $langcode, ]; - if (method_exists($this->moduleHandler, 'invokeAllWith')) { - $implementations = []; - $this->moduleHandler->invokeAllWith( - 'pathauto_is_alias_reserved', - function (callable $hook, string $module) use (&$implementations) { - $implementations[] = $module; - } - ); - } - else { - // Use the deprecated getImplementations() for Drupal < 9.4. - $implementations = $this->moduleHandler->getImplementations('pathauto_is_alias_reserved'); - } + $implementations = []; + $this->moduleHandler->invokeAllWith( + 'pathauto_is_alias_reserved', + function (callable $hook, string $module) use (&$implementations) { + $implementations[] = $module; + } + ); foreach ($implementations as $module) { $result = $this->moduleHandler->invoke($module, 'pathauto_is_alias_reserved', $args); diff --git a/web/modules/pathauto/src/Entity/PathautoPattern.php b/web/modules/pathauto/src/Entity/PathautoPattern.php index 2bcfe0d649..9e4a58ebb9 100644 --- a/web/modules/pathauto/src/Entity/PathautoPattern.php +++ b/web/modules/pathauto/src/Entity/PathautoPattern.php @@ -16,6 +16,7 @@ use Drupal\Core\TypedData\DataReferenceInterface; use Drupal\Core\TypedData\ListDataDefinitionInterface; use Drupal\Core\TypedData\ListInterface; +use Drupal\Core\Utility\Error; use Drupal\pathauto\PathautoPatternInterface; /** @@ -369,7 +370,13 @@ public function applies($object) { $context_handler->applyContextMapping($condition, $contexts); } catch (ContextException $e) { - watchdog_exception('pathauto', $e); + if (method_exists(Error::class, 'logException')) { + Error::logException(\Drupal::logger('pathauto'), $e); + } + else { + /* @phpstan-ignore-next-line */ + watchdog_exception('pathauto', $e); + } return FALSE; } } @@ -415,7 +422,7 @@ public function convertTokenToContext(string $token, array $contexts) { return $contexts[$token]; } else { - list($base, $property_path) = explode(':', $token, 2); + [$base, $property_path] = explode(':', $token, 2); // A base must always be set. This method recursively calls itself // setting bases for this reason. if (!empty($contexts[$base])) { diff --git a/web/modules/pathauto/src/Form/PathautoAdminDelete.php b/web/modules/pathauto/src/Form/PathautoAdminDelete.php index 2a660b238e..22079c065d 100644 --- a/web/modules/pathauto/src/Form/PathautoAdminDelete.php +++ b/web/modules/pathauto/src/Form/PathautoAdminDelete.php @@ -87,7 +87,10 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'checkbox', '#title' => (string) $definition['label'], '#default_value' => FALSE, - '#description' => $this->t('Delete aliases for all @label. Number of aliases which will be deleted: %count.', ['@label' => (string) $definition['label'], '%count' => $count]), + '#description' => $this->t('Delete aliases for all @label. Number of aliases which will be deleted: %count.', [ + '@label' => (string) $definition['label'], + '%count' => $count, + ]), ]; } diff --git a/web/modules/pathauto/src/Form/PathautoSettingsForm.php b/web/modules/pathauto/src/Form/PathautoSettingsForm.php index 4ff01f299e..c6df22a20a 100644 --- a/web/modules/pathauto/src/Form/PathautoSettingsForm.php +++ b/web/modules/pathauto/src/Form/PathautoSettingsForm.php @@ -64,47 +64,18 @@ class PathautoSettingsForm extends ConfigFormBase { */ protected $aliasTypeManager; - /** - * Constructs a PathautoSettingsForm. - * - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * Defines the configuration object factory. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * Manages entity type plugin definitions. - * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager - * Manages the discovery of entity fields. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * Manage drupal modules. - * @param \Drupal\pathauto\AliasCleanerInterface $pathauto_alias_cleaner - * Provides an alias cleaner. - * @param \Drupal\pathauto\AliasStorageHelperInterface $pathauto_alias_storage_helper - * Provides helper methods for accessing alias storage. - * @param \Drupal\pathauto\AliasTypeManager $alias_type_manager - * Manages pathauto alias type plugins. - */ - public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, ModuleHandlerInterface $module_handler, AliasCleanerInterface $pathauto_alias_cleaner, AliasStorageHelperInterface $pathauto_alias_storage_helper, AliasTypeManager $alias_type_manager) { - parent::__construct($config_factory); - $this->entityTypeManager = $entity_type_manager; - $this->entityFieldManager = $entity_field_manager; - $this->moduleHandler = $module_handler; - $this->aliasCleaner = $pathauto_alias_cleaner; - $this->aliasStorageHelper = $pathauto_alias_storage_helper; - $this->aliasTypeManager = $alias_type_manager; - } - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('entity_type.manager'), - $container->get('entity_field.manager'), - $container->get('module_handler'), - $container->get('pathauto.alias_cleaner'), - $container->get('pathauto.alias_storage_helper'), - $container->get('plugin.manager.alias_type') - ); + $form = parent::create($container); + $form->entityTypeManager = $container->get('entity_type.manager'); + $form->entityFieldManager = $container->get('entity_field.manager'); + $form->moduleHandler = $container->get('module_handler'); + $form->aliasCleaner = $container->get('pathauto.alias_cleaner'); + $form->aliasStorageHelper = $container->get('pathauto.alias_storage_helper'); + $form->aliasTypeManager = $container->get('plugin.manager.alias_type'); + return $form; } /** @@ -147,10 +118,11 @@ public function buildForm(array $form, FormStateInterface $form_state) { if (is_subclass_of($entity_type->getClass(), FieldableEntityInterface::class) && $entity_type->hasLinkTemplate('canonical')) { $field_definitions = $this->entityFieldManager->getBaseFieldDefinitions($entity_type_id); + $enabled_entity_types = $config->get('enabled_entity_types') ?? []; $form['enabled_entity_types'][$entity_type_id] = [ '#type' => 'checkbox', '#title' => $entity_type->getLabel(), - '#default_value' => isset($field_definitions['path']) || in_array($entity_type_id, $config->get('enabled_entity_types')), + '#default_value' => isset($field_definitions['path']) || in_array($entity_type_id, $enabled_entity_types), '#disabled' => isset($field_definitions['path']) && ($field_definitions['path']->getProvider() != 'pathauto' || $patterns_count), ]; } @@ -252,7 +224,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['safe_tokens'] = [ '#type' => 'textarea', '#title' => $this->t('Safe tokens'), - '#default_value' => implode(', ', $config->get('safe_tokens')), + '#default_value' => $config->get('safe_tokens') ? implode(', ', $config->get('safe_tokens')) : NULL, '#description' => $this->t('List of tokens that are safe to use in alias patterns and do not need to be cleaned. For example urls, aliases, machine names. Separated with a comma.'), ]; diff --git a/web/modules/pathauto/src/Form/PatternEditForm.php b/web/modules/pathauto/src/Form/PatternEditForm.php index a8dbf8ed8f..b763a1b45d 100644 --- a/web/modules/pathauto/src/Form/PatternEditForm.php +++ b/web/modules/pathauto/src/Form/PatternEditForm.php @@ -100,7 +100,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#ajax' => [ 'callback' => '::ajaxReplacePatternForm', 'wrapper' => 'pathauto-pattern', - 'method' => 'replace', ], ]; @@ -237,7 +236,7 @@ public function buildEntity(array $form, FormStateInterface $form_state) { 'negate' => FALSE, 'context_mapping' => [ $entity_type => $entity_type, - ] + ], ] ); } @@ -252,7 +251,7 @@ public function buildEntity(array $form, FormStateInterface $form_state) { 'negate' => FALSE, 'context_mapping' => [ 'language' => $language_mapping, - ] + ], ] ); $entity->addRelationship($language_mapping, $this->t('Language')); diff --git a/web/modules/pathauto/src/Plugin/Deriver/EntityAliasTypeDeriver.php b/web/modules/pathauto/src/Plugin/Deriver/EntityAliasTypeDeriver.php index 37f751c1d8..bde643ac6f 100644 --- a/web/modules/pathauto/src/Plugin/Deriver/EntityAliasTypeDeriver.php +++ b/web/modules/pathauto/src/Plugin/Deriver/EntityAliasTypeDeriver.php @@ -86,7 +86,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives[$entity_type_id]['types'] = [$this->tokenEntityMapper->getTokenTypeForEntityType($entity_type_id)]; $this->derivatives[$entity_type_id]['provider'] = $entity_type->getProvider(); $this->derivatives[$entity_type_id]['context_definitions'] = [ - $entity_type_id => new EntityContextDefinition("entity:$entity_type_id", $this->t('@label being aliased', ['@label' => $entity_type->getLabel()])) + $entity_type_id => new EntityContextDefinition("entity:$entity_type_id", $this->t('@label being aliased', ['@label' => $entity_type->getLabel()])), ]; } } diff --git a/web/modules/pathauto/src/Plugin/migrate/source/PathautoPattern.php b/web/modules/pathauto/src/Plugin/migrate/source/PathautoPattern.php index c30bddec99..9b51971092 100644 --- a/web/modules/pathauto/src/Plugin/migrate/source/PathautoPattern.php +++ b/web/modules/pathauto/src/Plugin/migrate/source/PathautoPattern.php @@ -95,7 +95,7 @@ public function prepareRow(Row $row) { $row->setSourceProperty('id', $entity_type); $row->setSourceProperty('label', (string) $definition->getLabel() . ' - default'); $row->setSourceProperty('type', 'canonical_entities:' . $entity_type); - $row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'))); + $row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'), ['allowed_classes' => FALSE])); return parent::prepareRow($row); } elseif (strpos($name, 'pathauto_' . $entity_type . '_') === 0) { @@ -114,7 +114,7 @@ public function prepareRow(Row $row) { $row->setSourceProperty('id', $entity_type . '_' . $bundle); $row->setSourceProperty('label', (string) $definition->getLabel() . ' - ' . $bundles[$bundle]['label']); $row->setSourceProperty('type', 'canonical_entities:' . $entity_type); - $row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'))); + $row->setSourceProperty('pattern', unserialize($row->getSourceProperty('value'), ['allowed_classes' => FALSE])); $selection_criteria = [ 'id' => 'entity_bundle:' . $entity_type, diff --git a/web/modules/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php b/web/modules/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php index efd4430d95..1e12a17e9f 100644 --- a/web/modules/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php +++ b/web/modules/pathauto/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php @@ -190,7 +190,10 @@ public function batchUpdate($action, &$context) { $context['sandbox']['count'] += count($ids); $context['sandbox']['current'] = !empty($ids) ? max($ids) : 0; $context['results']['updates'] += $updates; - $context['message'] = $this->t('Updated alias for %label @id.', ['%label' => $entity_type->getLabel(), '@id' => end($ids)]); + $context['message'] = $this->t('Updated alias for %label @id.', [ + '%label' => $entity_type->getLabel(), + '@id' => end($ids), + ]); if ($context['sandbox']['count'] != $context['sandbox']['total']) { $context['finished'] = $context['sandbox']['count'] / $context['sandbox']['total']; @@ -281,8 +284,8 @@ protected function bulkUpdate(array $ids, array $options = []) { if (!empty($options['message'])) { $this->messenger->addMessage($this->formatPlural(count($ids), 'Updated 1 %label URL alias.', 'Updated @count %label URL aliases.'), [ - '%label' => $this->getLabel(), - ]); + '%label' => $this->getLabel(), + ]); } return $updates; diff --git a/web/modules/pathauto/tests/modules/pathauto_custom_punctuation_test/pathauto_custom_punctuation_test.info.yml b/web/modules/pathauto/tests/modules/pathauto_custom_punctuation_test/pathauto_custom_punctuation_test.info.yml index 093b519cd4..e6a82af1de 100644 --- a/web/modules/pathauto/tests/modules/pathauto_custom_punctuation_test/pathauto_custom_punctuation_test.info.yml +++ b/web/modules/pathauto/tests/modules/pathauto_custom_punctuation_test/pathauto_custom_punctuation_test.info.yml @@ -3,7 +3,7 @@ type: module description: 'Add some uncommon punctuation to the replacement list.' package: Testing -# Information added by Drupal.org packaging script on 2023-10-08 -version: '8.x-1.12' +# Information added by Drupal.org packaging script on 2024-08-01 +version: '8.x-1.13' project: 'pathauto' -datestamp: 1696776686 +datestamp: 1722507674 diff --git a/web/modules/pathauto/tests/modules/pathauto_string_id_test/pathauto_string_id_test.info.yml b/web/modules/pathauto/tests/modules/pathauto_string_id_test/pathauto_string_id_test.info.yml index 76c69f89b6..f9a98437d8 100644 --- a/web/modules/pathauto/tests/modules/pathauto_string_id_test/pathauto_string_id_test.info.yml +++ b/web/modules/pathauto/tests/modules/pathauto_string_id_test/pathauto_string_id_test.info.yml @@ -5,7 +5,7 @@ package: Testing dependencies: - token:token -# Information added by Drupal.org packaging script on 2023-10-08 -version: '8.x-1.12' +# Information added by Drupal.org packaging script on 2024-08-01 +version: '8.x-1.13' project: 'pathauto' -datestamp: 1696776686 +datestamp: 1722507674 diff --git a/web/modules/pathauto/tests/modules/pathauto_views_test/config/install/views.view.articles.yml b/web/modules/pathauto/tests/modules/pathauto_views_test/config/install/views.view.articles.yml index 249516f5c1..ac754af174 100644 --- a/web/modules/pathauto/tests/modules/pathauto_views_test/config/install/views.view.articles.yml +++ b/web/modules/pathauto/tests/modules/pathauto_views_test/config/install/views.view.articles.yml @@ -180,7 +180,6 @@ display: default_argument_type: fixed default_argument_options: argument: '' - default_argument_skip_url: false summary_options: base_path: '' count: true diff --git a/web/modules/pathauto/tests/modules/pathauto_views_test/pathauto_views_test.info.yml b/web/modules/pathauto/tests/modules/pathauto_views_test/pathauto_views_test.info.yml index 9feab74b44..153404387a 100644 --- a/web/modules/pathauto/tests/modules/pathauto_views_test/pathauto_views_test.info.yml +++ b/web/modules/pathauto/tests/modules/pathauto_views_test/pathauto_views_test.info.yml @@ -5,7 +5,7 @@ package: Testing dependencies: - drupal:views -# Information added by Drupal.org packaging script on 2023-10-08 -version: '8.x-1.12' +# Information added by Drupal.org packaging script on 2024-08-01 +version: '8.x-1.13' project: 'pathauto' -datestamp: 1696776686 +datestamp: 1722507674 diff --git a/web/modules/pathauto/tests/src/Functional/PathautoBulkUpdateTest.php b/web/modules/pathauto/tests/src/Functional/PathautoBulkUpdateTest.php index a7193720b5..a60e0c769e 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoBulkUpdateTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoBulkUpdateTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\pathauto\Functional; -use Drupal\Component\Render\FormattableMarkup; use Drupal\pathauto\PathautoGeneratorInterface; use Drupal\pathauto\PathautoState; use Drupal\Tests\BrowserTestBase; @@ -59,6 +58,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'administer forums', ]; @@ -113,7 +114,7 @@ public function testBulkUpdate() { // Make sure existing aliases can be overridden. $this->drupalGet('admin/config/search/path/settings'); - $this->submitForm(['update_action' => PathautoGeneratorInterface::UPDATE_ACTION_DELETE], 'Save configuration'); + $this->submitForm(['update_action' => (string) PathautoGeneratorInterface::UPDATE_ACTION_DELETE], 'Save configuration'); // Patterns did not change, so no aliases should be regenerated. $edit['action'] = 'all'; @@ -134,10 +135,7 @@ public function testBulkUpdate() { // Prevent existing aliases to be overridden. The bulk generate page should // only offer to create an alias for paths which have none. $this->drupalGet('admin/config/search/path/settings'); - $this->submitForm( - ['update_action' => PathautoGeneratorInterface::UPDATE_ACTION_NO_NEW], - 'Save configuration' - ); + $this->submitForm(['update_action' => (string) PathautoGeneratorInterface::UPDATE_ACTION_NO_NEW], 'Save configuration'); $this->drupalGet('admin/config/search/path/update_bulk'); $this->assertSession()->fieldValueEquals('action', 'create'); diff --git a/web/modules/pathauto/tests/src/Functional/PathautoEnablingEntityTypesTest.php b/web/modules/pathauto/tests/src/Functional/PathautoEnablingEntityTypesTest.php index 6d76294497..13eb251c6c 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoEnablingEntityTypesTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoEnablingEntityTypesTest.php @@ -47,6 +47,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'administer nodes', 'post comments', diff --git a/web/modules/pathauto/tests/src/Functional/PathautoMassDeleteTest.php b/web/modules/pathauto/tests/src/Functional/PathautoMassDeleteTest.php index 6142fee4ed..0b033e3bec 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoMassDeleteTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoMassDeleteTest.php @@ -64,6 +64,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', ]; $this->adminUser = $this->drupalCreateUser($permissions); @@ -97,7 +99,11 @@ public function testDeleteAll() { // 2. Test deleting only specific (entity type) aliases. $manager = $this->container->get('plugin.manager.alias_type'); - $pathauto_plugins = ['canonical_entities:node' => 'nodes', 'canonical_entities:taxonomy_term' => 'terms', 'canonical_entities:user' => 'accounts']; + $pathauto_plugins = [ + 'canonical_entities:node' => 'nodes', + 'canonical_entities:taxonomy_term' => 'terms', + 'canonical_entities:user' => 'accounts', + ]; foreach ($pathauto_plugins as $pathauto_plugin => $attribute) { $this->generateAliases(); $edit = [ diff --git a/web/modules/pathauto/tests/src/Functional/PathautoNodeWebTest.php b/web/modules/pathauto/tests/src/Functional/PathautoNodeWebTest.php index 6748c26db2..2c78d355c2 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoNodeWebTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoNodeWebTest.php @@ -49,6 +49,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'bypass node access', 'access content overview', @@ -288,7 +290,11 @@ public function testCustomAliasWithoutPattern() { $this->assertSession()->statusCodeEquals(200); // Now create a node through the API. - $node = Node::create(['type' => 'article', 'title' => 'Sample article API', 'path' => ['alias' => '/sample-article-api']]); + $node = Node::create([ + 'type' => 'article', + 'title' => 'Sample article API', + 'path' => ['alias' => '/sample-article-api'], + ]); $node->save(); // Test the alias. diff --git a/web/modules/pathauto/tests/src/Functional/PathautoSettingsFormWebTest.php b/web/modules/pathauto/tests/src/Functional/PathautoSettingsFormWebTest.php index 4090278141..540665163c 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoSettingsFormWebTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoSettingsFormWebTest.php @@ -101,6 +101,8 @@ protected function setUp(): void { 'administer pathauto', 'notify of path changes', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'bypass node access', ]; diff --git a/web/modules/pathauto/tests/src/Functional/PathautoTaxonomyWebTest.php b/web/modules/pathauto/tests/src/Functional/PathautoTaxonomyWebTest.php index 8804596d8c..60bb42310f 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoTaxonomyWebTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoTaxonomyWebTest.php @@ -42,6 +42,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'administer taxonomy', ]; diff --git a/web/modules/pathauto/tests/src/Functional/PathautoUserWebTest.php b/web/modules/pathauto/tests/src/Functional/PathautoUserWebTest.php index 38b6c7cf7d..7c19ab6d8d 100644 --- a/web/modules/pathauto/tests/src/Functional/PathautoUserWebTest.php +++ b/web/modules/pathauto/tests/src/Functional/PathautoUserWebTest.php @@ -43,6 +43,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'administer users', ]; diff --git a/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoLocaleTest.php b/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoLocaleTest.php index cff107fcd3..dedb7fcfe2 100644 --- a/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoLocaleTest.php +++ b/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoLocaleTest.php @@ -98,13 +98,15 @@ public function testLanguagePatterns() { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'bypass node access', 'access content overview', 'administer languages', 'translate any entity', 'administer content translation', - 'create content translations' + 'create content translations', ]; $admin_user = $this->drupalCreateUser($permissions); $this->drupalLogin($admin_user); @@ -181,8 +183,7 @@ public function testLanguagePatterns() { ]; $this->drupalGet('admin/config/search/path/update_bulk'); $this->submitForm($edit, 'Update'); - $this->assertSession()->assertWaitOnAjaxRequest(); - $this->assertSession()->pageTextContains('Generated 2 URL aliases.'); + $this->assertSession()->waitForText('Generated 2 URL aliases.'); $this->assertAlias('/node/' . $node->id(), '/the-articles/english-node', 'en'); $this->assertAlias('/node/' . $node->id(), '/les-articles/french-node', 'fr'); } @@ -199,7 +200,11 @@ public function testLanguageNotApplicable() { $pattern->save(); // Create a node with language Not Applicable. - $node = $this->createNode(['type' => 'article', 'title' => 'Test node', 'langcode' => LanguageInterface::LANGCODE_NOT_APPLICABLE]); + $node = $this->createNode([ + 'type' => 'article', + 'title' => 'Test node', + 'langcode' => LanguageInterface::LANGCODE_NOT_APPLICABLE, + ]); // Check that the generated alias has language Not Specified. $alias = \Drupal::service('pathauto.alias_storage_helper')->loadBySource('/node/' . $node->id()); @@ -216,12 +221,18 @@ public function testLanguageNotApplicable() { protected function enableArticleTranslation() { // Enable content translation on articles. $this->drupalGet('admin/config/regional/content-language'); - $edit = [ - 'entity_types[node]' => TRUE, - 'settings[node][article][translatable]' => TRUE, - 'settings[node][article][settings][language][language_alterable]' => TRUE, - ]; - $this->submitForm($edit, 'Save configuration'); + + // Enable translation for node. + $this->assertSession()->fieldExists('entity_types[node]')->check(); + // Open details for Content settings in Drupal 10.2. + $nodeSettings = $this->getSession()->getPage()->find('css', '#edit-settings-node summary'); + if ($nodeSettings) { + $nodeSettings->click(); + } + $this->assertSession()->fieldExists('settings[node][article][translatable]')->check(); + $this->assertSession()->fieldExists('settings[node][article][settings][language][language_alterable]')->check(); + + $this->getSession()->getPage()->pressButton('Save configuration'); } } diff --git a/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoUiTest.php b/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoUiTest.php index 6644977f19..c8807ba206 100644 --- a/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoUiTest.php +++ b/web/modules/pathauto/tests/src/FunctionalJavascript/PathautoUiTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\pathauto\FunctionalJavascript; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; use Drupal\pathauto\Entity\PathautoPattern; @@ -49,6 +48,8 @@ protected function setUp(): void { $permissions = [ 'administer pathauto', 'administer url aliases', + 'bulk delete aliases', + 'bulk update aliases', 'create url aliases', 'administer nodes', 'bypass node access', @@ -202,9 +203,9 @@ public function testPatternsWorkflow() { $this->clickLink('Delete'); $this->assertSession()->assertWaitOnAjaxRequest(); if (version_compare(\Drupal::VERSION, '10.1', '>=')) { - $this->assertSession()->pageTextContains('This action cannot be undone.'); - $this->getSession()->getPage()->find('css', '.ui-dialog-buttonpane')->findButton('Delete')->press(); - $this->assertSession()->assertWaitOnAjaxRequest(); + $this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#drupal-modal')); + $this->assertSession()->elementContains('css', '#drupal-modal', 'This action cannot be undone.'); + $this->assertSession()->elementExists('css', '.ui-dialog-buttonpane')->pressButton('Delete'); } else { $address = Url::fromRoute('entity.pathauto_pattern.delete_form', ['pathauto_pattern' => 'page_pattern'], [$destination_query]); diff --git a/web/modules/pathauto/tests/src/Kernel/PathautoEntityWithStringIdTest.php b/web/modules/pathauto/tests/src/Kernel/PathautoEntityWithStringIdTest.php index 02891ececf..26034b5bb6 100644 --- a/web/modules/pathauto/tests/src/Kernel/PathautoEntityWithStringIdTest.php +++ b/web/modules/pathauto/tests/src/Kernel/PathautoEntityWithStringIdTest.php @@ -111,19 +111,19 @@ public function testEntityWithStringId($id, $expected_key) { public function entityWithStringIdProvider() { return [ 'ascii with less or equal 128 chars' => [ - str_repeat('a', 128), str_repeat('a', 128) + str_repeat('a', 128), str_repeat('a', 128), ], 'ascii with over 128 chars' => [ - str_repeat('a', 191), Crypt::hashBase64(str_repeat('a', 191)) + str_repeat('a', 191), Crypt::hashBase64(str_repeat('a', 191)), ], 'non-ascii with less or equal 128 chars' => [ - str_repeat('社', 128), Crypt::hashBase64(str_repeat('社', 128)) + str_repeat('社', 128), Crypt::hashBase64(str_repeat('社', 128)), ], 'non-ascii with over 128 chars' => [ - str_repeat('社', 191), Crypt::hashBase64(str_repeat('社', 191)) + str_repeat('社', 191), Crypt::hashBase64(str_repeat('社', 191)), ], 'simulating an integer id' => [ - 123, '123' + 123, '123', ], ]; } diff --git a/web/modules/pathauto/tests/src/Kernel/PathautoTokenTest.php b/web/modules/pathauto/tests/src/Kernel/PathautoTokenTest.php index faf03cc019..811b85bae6 100644 --- a/web/modules/pathauto/tests/src/Kernel/PathautoTokenTest.php +++ b/web/modules/pathauto/tests/src/Kernel/PathautoTokenTest.php @@ -89,16 +89,32 @@ public function assertTokens($type, array $data, array $tokens, array $options = foreach ($tokens as $name => $expected) { $token = $input[$name]; if (!isset($expected)) { - $this->assertTrue(!isset($values[$token]), new FormattableMarkup("Token value for @token was not generated.", ['@type' => $type, '@token' => $token])); + $this->assertTrue(!isset($values[$token]), new FormattableMarkup("Token value for @token was not generated.", [ + '@type' => $type, + '@token' => $token, + ])); } elseif (!isset($replacements[$token])) { - $this->fail(new FormattableMarkup("Token value for @token was not generated.", ['@type' => $type, '@token' => $token])); + $this->fail(new FormattableMarkup("Token value for @token was not generated.", [ + '@type' => $type, + '@token' => $token, + ])); } elseif (!empty($options['regex'])) { - $this->assertTrue(preg_match('/^' . $expected . '$/', $replacements[$token]), new FormattableMarkup("Token value for @token was '@actual', matching regular expression pattern '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected])); + $this->assertTrue(preg_match('/^' . $expected . '$/', $replacements[$token]), new FormattableMarkup("Token value for @token was '@actual', matching regular expression pattern '@expected'.", [ + '@type' => $type, + '@token' => $token, + '@actual' => $replacements[$token], + '@expected' => $expected, + ])); } else { - $this->assertSame($expected, $replacements[$token], new FormattableMarkup("Token value for @token was '@actual', expected value '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected])); + $this->assertSame($expected, $replacements[$token], new FormattableMarkup("Token value for @token was '@actual', expected value '@expected'.", [ + '@type' => $type, + '@token' => $token, + '@actual' => $replacements[$token], + '@expected' => $expected, + ])); } } diff --git a/web/modules/pathauto/tests/src/Unit/VerboseMessengerTest.php b/web/modules/pathauto/tests/src/Unit/VerboseMessengerTest.php index 1fd29ef4a7..113fff08b8 100644 --- a/web/modules/pathauto/tests/src/Unit/VerboseMessengerTest.php +++ b/web/modules/pathauto/tests/src/Unit/VerboseMessengerTest.php @@ -24,6 +24,7 @@ class VerboseMessengerTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp(): void { + parent::setUp(); $config_factory = $this->getConfigFactoryStub(['pathauto.settings' => ['verbose' => TRUE]]); $account = $this->createMock(AccountInterface::class); $account->expects($this->once()) -- GitLab