From de0e709f8607cf86e9f2729ef42a60fcc10ddd0f Mon Sep 17 00:00:00 2001 From: Michael Lee <lee.5151@osu.edu> Date: Wed, 7 Aug 2024 11:08:18 -0400 Subject: [PATCH] Upgrading drupal/metatag (2.0.0 => 2.0.2) --- composer.lock | 25 +- vendor/composer/installed.json | 27 +- vendor/composer/installed.php | 10 +- web/modules/metatag/.cspell-project-words.txt | 95 ++++ web/modules/metatag/.eslintrc | 2 +- web/modules/metatag/.gitlab-ci.yml | 121 +++++ web/modules/metatag/CHANGELOG.txt | 32 ++ web/modules/metatag/README.md | 10 + web/modules/metatag/composer.json | 25 +- web/modules/metatag/css/firehose_widget.css | 2 +- web/modules/metatag/metatag.info.yml | 10 +- web/modules/metatag/metatag.module | 23 +- web/modules/metatag/metatag.post_update.php | 32 +- .../metatag_app_links.info.yml | 8 +- .../metatag/metatag_dc/metatag_dc.info.yml | 8 +- .../metatag_dc_advanced.info.yml | 8 +- .../metatag/metatag_extended_perms/README.txt | 6 +- .../metatag_extended_perms.info.yml | 8 +- .../tests/src/Functional/PermissionsTest.php | 14 +- .../metatag_facebook.info.yml | 8 +- .../metatag_favicons.info.yml | 8 +- .../src/Plugin/metatag/Tag/MaskIcon.php | 2 +- .../tests/src/Functional/TagsTest.php | 13 +- .../metatag_google_cse.info.yml | 8 +- .../metatag_google_plus.info.yml | 8 +- .../metatag_hreflang.info.yml | 8 +- .../metatag/Tag/HreflangPerLanguage.php | 27 +- .../metatag_mobile/metatag_mobile.info.yml | 8 +- .../metatag_mobile/metatag_mobile.module | 6 +- .../src/Functional/TestCoreTagRemoval.php | 19 +- .../metatag_open_graph.info.yml | 8 +- .../metatag_open_graph_products.info.yml | 8 +- .../metatag_page_manager.info.yml | 8 +- .../metatag_page_manager.module | 44 +- .../metatag_pinterest.info.yml | 8 +- .../metatag_routes/metatag_routes.info.yml | 8 +- .../src/Form/MetatagCustomCreateForm.php | 8 +- .../metatag_twitter_cards.info.yml | 8 +- .../Plugin/metatag/Tag/TwitterCardsType.php | 2 +- .../metatag_verification.info.yml | 8 +- .../metatag_views/metatag_views.info.yml | 8 +- .../MetatagViewsTranslationController.php | 2 +- .../src/Form/MetatagViewsTranslationForm.php | 6 +- .../src/MetatagViewsCacheWrapper.php | 42 +- .../MetatagDisplayExtender.php | 4 +- .../src/Functional/MetatagViewsBasicsTest.php | 3 - web/modules/metatag/phpstan.neon | 11 + .../src/Controller/MetatagController.php | 2 +- .../metatag/src/Form/MetatagDefaultsForm.php | 28 + .../src/Form/MetatagDefaultsRevertForm.php | 8 +- .../metatag/src/Form/MetatagSettingsForm.php | 16 +- web/modules/metatag/src/MetatagManager.php | 11 +- web/modules/metatag/src/MetatagSeparator.php | 2 +- web/modules/metatag/src/MetatagToken.php | 4 +- .../FieldFormatter/MetatagEmptyFormatter.php | 2 +- .../Field/MetatagEntityFieldItemList.php | 2 +- .../Plugin/diff/Field/MetatagFieldBuilder.php | 4 +- .../src/Plugin/metatag/Tag/MetaNameBase.php | 10 +- .../metatag/src/Plugin/metatag/Tag/Robots.php | 2 +- .../migrate/process/d6/NodewordsEntities.php | 3 - .../migrate/process/d7/MetatagEntities.php | 4 +- .../migrate/source/d7/MetatagFieldDeriver.php | 2 +- .../src/TypedData/ComputedItemListTrait.php | 1 + .../metatag/tests/fixtures/d8_metatag_v1.php | 497 +++++++++--------- .../metatag_test_custom_route.info.yml | 6 +- .../MetatagTestCustomRouteController.php | 2 +- .../metatag_test_integration.info.yml | 6 +- .../metatag_test_tag.info.yml | 6 +- .../{DefaultTags.php => DefaultTagsTest.php} | 2 +- .../EnsureDevelWebProfilerWorks.php | 36 -- .../tests/src/Functional/EnsureDevelWorks.php | 63 --- .../src/Functional/EntityTestMetatagTest.php | 3 +- ...enanceMode.php => MaintenanceModeTest.php} | 2 +- .../tests/src/Functional/MetatagAdminTest.php | 27 +- ...tagTagTypesTest.php => MetatagApiTest.php} | 54 +- .../MetatagConfigTranslationTest.php | 9 +- .../src/Functional/MetatagCustomRouteTest.php | 2 +- .../src/Functional/MetatagFieldNodeTest.php | 2 +- .../src/Functional/MetatagFieldTermTest.php | 8 +- .../src/Functional/MetatagFieldTestBase.php | 25 +- .../src/Functional/MetatagFieldTestTest.php | 2 +- .../src/Functional/MetatagFieldUserTest.php | 2 +- .../tests/src/Functional/MetatagForumTest.php | 4 +- .../src/Functional/MetatagFrontpageTest.php | 32 +- .../src/Functional/MetatagHelperTrait.php | 2 +- .../src/Functional/MetatagIntegrationTest.php | 2 +- .../Functional/MetatagNodeTranslationTest.php | 101 ++-- .../src/Functional/MetatagStringTest.php | 30 +- ...nStatus.php => MetatagTokenStatusTest.php} | 2 +- .../tests/src/Functional/MetatagTokenTest.php | 2 +- .../tests/src/Functional/MetatagXssTest.php | 16 +- ...eJsonOutput.php => NodeJsonOutputTest.php} | 2 +- .../tests/src/Functional/NodeTranslation.php | 81 --- .../tests/src/Functional/TagsTestBase.php | 22 +- .../{TestV2Updates.php => V2UpdatesTest.php} | 2 +- .../tests/src/Functional/WithRedirect.php | 37 -- .../MetatagAvailableTokensTest.php | 2 +- .../src/Kernel/MetatagSerializationTest.php | 5 +- .../Migrate/d6/NodewordsEntitiesTest.php | 32 +- .../Kernel/Migrate/d7/MetatagEntitiesTest.php | 35 +- .../source/d6/NodewordsFieldInstanceTest.php | 2 +- .../source/d7/MetatagFieldInstanceTest.php | 2 +- .../tests/src/Unit/MetaNameBaseTest.php | 2 +- .../tests/src/Unit/MetatagTrimmerTest.php | 4 +- 104 files changed, 1045 insertions(+), 996 deletions(-) create mode 100644 web/modules/metatag/.cspell-project-words.txt create mode 100644 web/modules/metatag/.gitlab-ci.yml create mode 100644 web/modules/metatag/phpstan.neon rename web/modules/metatag/tests/src/Functional/{DefaultTags.php => DefaultTagsTest.php} (99%) delete mode 100644 web/modules/metatag/tests/src/Functional/EnsureDevelWebProfilerWorks.php delete mode 100644 web/modules/metatag/tests/src/Functional/EnsureDevelWorks.php rename web/modules/metatag/tests/src/Functional/{MaintenanceMode.php => MaintenanceModeTest.php} (96%) rename web/modules/metatag/tests/src/Functional/{MetatagTagTypesTest.php => MetatagApiTest.php} (78%) rename web/modules/metatag/tests/src/Functional/{MetatagTokenStatus.php => MetatagTokenStatusTest.php} (94%) rename web/modules/metatag/tests/src/Functional/{NodeJsonOutput.php => NodeJsonOutputTest.php} (98%) delete mode 100644 web/modules/metatag/tests/src/Functional/NodeTranslation.php rename web/modules/metatag/tests/src/Functional/Update/{TestV2Updates.php => V2UpdatesTest.php} (99%) delete mode 100644 web/modules/metatag/tests/src/Functional/WithRedirect.php diff --git a/composer.lock b/composer.lock index 6134bb7ead..5d579bffaf 100644 --- a/composer.lock +++ b/composer.lock @@ -4721,42 +4721,45 @@ }, { "name": "drupal/metatag", - "version": "2.0.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://git.drupalcode.org/project/metatag.git", - "reference": "2.0.0" + "reference": "2.0.2" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/metatag-2.0.0.zip", - "reference": "2.0.0", - "shasum": "2966c854d982b7069b1c0111519427990ebbad40" + "url": "https://ftp.drupal.org/files/projects/metatag-2.0.2.zip", + "reference": "2.0.2", + "shasum": "748013c50a0ed5e10359413bb3481392a0bf0d3f" }, "require": { - "drupal/core": "^9.4 || ^10", + "drupal/core": "^9.4 || ^10 || ^11", "drupal/token": "^1.0", "php": ">=8.0" }, "require-dev": { - "drupal/devel": "^4.0 || ^5.0", - "drupal/hal": "^9 || ^1 || ^2", + "drupal/hal": "^1 || ^2 || ^9", "drupal/metatag_dc": "*", "drupal/metatag_open_graph": "*", "drupal/page_manager": "^4.0", "drupal/redirect": "^1.0", - "drupal/webprofiler": "^9 || ^10", + "ergebnis/composer-normalize": "*", "mpyw/phpunit-patch-serializable-comparison": "*" }, "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.0", - "datestamp": "1692368265", + "version": "2.0.2", + "datestamp": "1722869772", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" } + }, + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" } }, "notification-url": "https://packages.drupal.org/8/downloads", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 94915c5f62..4a2c3e3dab 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -4967,43 +4967,46 @@ }, { "name": "drupal/metatag", - "version": "2.0.0", - "version_normalized": "2.0.0.0", + "version": "2.0.2", + "version_normalized": "2.0.2.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/metatag.git", - "reference": "2.0.0" + "reference": "2.0.2" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/metatag-2.0.0.zip", - "reference": "2.0.0", - "shasum": "2966c854d982b7069b1c0111519427990ebbad40" + "url": "https://ftp.drupal.org/files/projects/metatag-2.0.2.zip", + "reference": "2.0.2", + "shasum": "748013c50a0ed5e10359413bb3481392a0bf0d3f" }, "require": { - "drupal/core": "^9.4 || ^10", + "drupal/core": "^9.4 || ^10 || ^11", "drupal/token": "^1.0", "php": ">=8.0" }, "require-dev": { - "drupal/devel": "^4.0 || ^5.0", - "drupal/hal": "^9 || ^1 || ^2", + "drupal/hal": "^1 || ^2 || ^9", "drupal/metatag_dc": "*", "drupal/metatag_open_graph": "*", "drupal/page_manager": "^4.0", "drupal/redirect": "^1.0", - "drupal/webprofiler": "^9 || ^10", + "ergebnis/composer-normalize": "*", "mpyw/phpunit-patch-serializable-comparison": "*" }, "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.0", - "datestamp": "1692368265", + "version": "2.0.2", + "datestamp": "1722869772", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" } + }, + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" } }, "installation-source": "dist", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 13f2c64c0e..b3271eb369 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' => '95bc84d8582ade2a962640f92cd1496d54d37c56', + 'reference' => 'd85ef4c34240e822ad3c5a4a0b68dfdd51dec002', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -881,9 +881,9 @@ 'dev_requirement' => false, ), 'drupal/metatag' => array( - 'pretty_version' => '2.0.0', - 'version' => '2.0.0.0', - 'reference' => '2.0.0', + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'reference' => '2.0.2', 'type' => 'drupal-module', 'install_path' => __DIR__ . '/../../web/modules/metatag', 'aliases' => array(), @@ -1555,7 +1555,7 @@ 'osu-asc-webservices/d8-upstream' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '95bc84d8582ade2a962640f92cd1496d54d37c56', + 'reference' => 'd85ef4c34240e822ad3c5a4a0b68dfdd51dec002', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/web/modules/metatag/.cspell-project-words.txt b/web/modules/metatag/.cspell-project-words.txt new file mode 100644 index 0000000000..20137da000 --- /dev/null +++ b/web/modules/metatag/.cspell-project-words.txt @@ -0,0 +1,95 @@ +Acquia +alexa +applinks +Barfoo +bla'bleblu +blable +bleblu +breen +CDTF +checkall +cilefen +cleartype +ctools +Cxense +DCMI +DCMITYPE +dcterms +deeplinking +donottrack +dont +eengi +encodeded +ergebnis +ERRORPAGE +esource +Geertruyen +getentity +getroute +Globant +googleplay +handheldfriendly +Inheritence +inkscape +Juampy +Kandelaars +Kenna +LAUJ +linkcheckerlink +Maxlenth +Mediacurrent +metatagd +Metatagtrimmer +mobileoptimized +msapplication +Mscw +msvalidate +mtid +navbutton +neede +Nikhilesh +noarchive +nodeword +nodewords +nodewordsd +nohover +noimageindex +noodp +nopagereadaloud +Nopin +nopin +nosearch +nositelinkssearchbox +Novillo +noydir +Olivas +opengraph +precomposed +Rakesh +Requena +Rowlands +safeweb +scrollheight +scrollheightvalue +shorturl +sitelinks +siwecos +siwecostoken +starturl +straem +Tagtrimmer +tilecolor +tileimage +tnid +tobe +trid +trimlengths +trimmable +unaliased +Uzcw +waldomero +webform +xdefault +YFMEKD +Yoast +Yxuz diff --git a/web/modules/metatag/.eslintrc b/web/modules/metatag/.eslintrc index 9faa37508e..c59a275e23 100644 --- a/web/modules/metatag/.eslintrc +++ b/web/modules/metatag/.eslintrc @@ -57,7 +57,7 @@ rules: no-case-declarations: 2 no-div-regex: 2 no-else-return: 0 - no-empty-label: 2 + no-empty-label: 0 no-empty-pattern: 2 no-eq-null: 2 no-eval: 2 diff --git a/web/modules/metatag/.gitlab-ci.yml b/web/modules/metatag/.gitlab-ci.yml new file mode 100644 index 0000000000..372f1f85be --- /dev/null +++ b/web/modules/metatag/.gitlab-ci.yml @@ -0,0 +1,121 @@ +################ +# DrupalCI GitLabCI template +# +# Gitlab-ci.yml to replicate DrupalCI testing for Contrib +# +# With thanks to: +# * The GitLab Acceleration Initiative participants +# * DrupalSpoons +################ + +################ +# Guidelines +# +# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained. +# +# However, you can modify this template if you have additional needs for your project. +################ + +################ +# Includes +# +# Additional configuration can be provided through includes. +# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include. +# +# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml +# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values +################ + +include: + ################ + # DrupalCI includes: + # As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically. + # View these include files at https://git.drupalcode.org/project/gitlab_templates/ + ################ + - project: $_GITLAB_TEMPLATES_REPO + # "ref" value can be: + # - Recommended (default) - `ref: $_GITLAB_TEMPLATES_REF` - The Drupal Association will update this value to the recommended tag for contrib. + # - Latest - `ref: main` - Get the latest additions and bug fixes as they are merged into the templates. + # - Minor or Major latests - `ref: 1.x-latest` or `ref: 1.0.x-latest` - Get the latest additions within a minor (mostly bugfixes) or major (bugs and new features). + # - Fixed tag - `ref: 1.0.1` - Set the value to a known tag. This will not get any updates. + # If you change the default value of ref, you should set the _CURL_TEMPLATES_REF variable in the variables section to be the same as set here. + ref: $_GITLAB_TEMPLATES_REF + file: + - "/includes/include.drupalci.main.yml" + # For Drupal 7, remove the above line and uncomment the below. + # - "/includes/include.drupalci.main-d7.yml" + - "/includes/include.drupalci.variables.yml" + - "/includes/include.drupalci.workflows.yml" +# +################ +# Pipeline configuration variables +# +# These are the variables provided to the Run Pipeline form that a user may want to override. +# +# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml +################ + +variables: + # Run tests in parallel. + _PHPUNIT_CONCURRENT: 1 + # Run tests against the previous and next core minor releases, to help make + # sure small changes don't break anything too quickly. + OPT_IN_TEST_NEXT_MINOR: 1 + OPT_IN_TEST_PREVIOUS_MINOR: 1 + +# Don't allow failures from coding standards tests. +cspell: + allow_failure: false +phpcs: + allow_failure: false +# @todo Fix all phpstan issues. +# phstan: +# allow_failure: false +stylelint: + allow_failure: false + +################################################################################### +# +# * +# /( +# ((((, +# /((((((( +# ((((((((((* +# ,((((((((((((((( +# ,((((((((((((((((((( +# ((((((((((((((((((((((((* +# *((((((((((((((((((((((((((((( +# ((((((((((((((((((((((((((((((((((* +# *(((((((((((((((((( .(((((((((((((((((( +# ((((((((((((((((((. /(((((((((((((((((* +# /((((((((((((((((( .(((((((((((((((((, +# ,(((((((((((((((((( (((((((((((((((((( +# .(((((((((((((((((((( .((((((((((((((((( +# ((((((((((((((((((((((( ((((((((((((((((/ +# (((((((((((((((((((((((((((/ ,(((((((((((((((* +# .((((((((((((((/ /(((((((((((((. ,((((((((((((((( +# *(((((((((((((( ,(((((((((((((/ *((((((((((((((. +# ((((((((((((((, /(((((((((((((. ((((((((((((((, +# (((((((((((((/ ,(((((((((((((* ,(((((((((((((, +# *((((((((((((( .((((((((((((((( ,((((((((((((( +# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/ +# ((((((((((((( *(((((((((((((((((((((((* *(((((((((((( +# ((((((((((((( ,(((((((((((((..((((((((((((( *(((((((((((( +# ((((((((((((, /((((((((((((* /((((((((((((/ (((((((((((( +# ((((((((((((( /((((((((((((/ (((((((((((((* (((((((((((( +# (((((((((((((/ /(((((((((((( ,((((((((((((, *(((((((((((( +# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/ +# *((((((((((((((((((((((((((, /((((((((((((((((((((((((( +# ((((((((((((((((((((((((( ((((((((((((((((((((((((, +# .(((((((((((((((((((((((/ ,((((((((((((((((((((((( +# ((((((((((((((((((((((/ ,(((((((((((((((((((((/ +# *((((((((((((((((((((( (((((((((((((((((((((, +# ,(((((((((((((((((((((, ((((((((((((((((((((/ +# ,(((((((((((((((((((((* /(((((((((((((((((((( +# ((((((((((((((((((((((, ,/((((((((((((((((((((, +# ,((((((((((((((((((((((((((((((((((((((((((((((((((( +# .((((((((((((((((((((((((((((((((((((((((((((( +# .((((((((((((((((((((((((((((((((((((,. +# .,(((((((((((((((((((((((((. +# +################################################################################ diff --git a/web/modules/metatag/CHANGELOG.txt b/web/modules/metatag/CHANGELOG.txt index 1814c30644..9a167e7128 100644 --- a/web/modules/metatag/CHANGELOG.txt +++ b/web/modules/metatag/CHANGELOG.txt @@ -1,3 +1,35 @@ +Metatag 2.0.2, 2024-08-05 +------------------------- +#3465991 by podarok, DamienMcKenna: Allow installation on Drupal 11 via + composer.json. + + +Metatag 2.0.1, 2024-08-05 +------------------------- +#3370486 by DamienMcKenna, arti_parmar: Use second argument on all unserialize() + calls. +#3386862 by DamienMcKenna: Additional entity types to ignore. +#3390226 by DamienMcKenna: Normalize the composer.json file using + ergebnis/composer-normalize. +#3408825 by DamienMcKenna: Remove Devel, WebProfiler tests. +#3413633 by Nikolay Shapovalov, DamienMcKenna, Mingsong: Fix tests for, + compatibility with Drupal 10.2. +#3404463 by pilot3, DamienMcKenna, Nikolay Shapovalov, naveenvalecha: Add Gitlab + CI test file. +#3421648 by morgannc, DamienMcKenna: Fixed some coding standards issues. +#3423881 by DamienMcKenna: Merge NodeTranslation into + MetatagNodeTranslationTest. +#3433055 by DamienMcKenna: Fixed test filenames. +#3447058 by DamienMcKenna: Update info files for Drupal 11. +#3462134 by ankitv18, DamienMcKenna: Fix phpcs and cspell issues. +#3454762 by johnjw59@gmail.com, DamienMcKenna: Page Manager meta tags added + twice. +#3460593 by DamienMcKenna, porchlight, acbramley: Update MetatagFieldBuilder + ::build for compatibility with Diff v2. +#3423428 by DamienMcKenna, naveenvalecha: cspell, stylelint coding standards + fixes. + + Metatag 2.0.0, 2023-06-27 ------------------------- #3364475 by DamienMcKenna: Update scripts to convert JSON data on revision diff --git a/web/modules/metatag/README.md b/web/modules/metatag/README.md index 6993eac4e1..5c1f750256 100644 --- a/web/modules/metatag/README.md +++ b/web/modules/metatag/README.md @@ -361,6 +361,16 @@ the page check, to see if the html.html.twig instead contains this: To fix this, simply change that line back to `{{ page }}` and it should work. +## Contributing + +The `composer.json` file should be kept normalized using +`ergebnis/composer-normalize`: + +* `composer require --dev ergebnis/composer-normalize` +* `composer normalize modules/contrib/metatag/composer.json` + + + ## Maintainers / credits / contact Currently maintained by [Damien diff --git a/web/modules/metatag/composer.json b/web/modules/metatag/composer.json index 3041a90c39..5c807d8acd 100644 --- a/web/modules/metatag/composer.json +++ b/web/modules/metatag/composer.json @@ -1,13 +1,12 @@ { "name": "drupal/metatag", "description": "Manage meta tags for all entities.", - "type": "drupal-module", "license": "GPL-2.0-or-later", + "type": "drupal-module", "keywords": [ "Drupal", "seo" ], - "homepage": "https://www.drupal.org/project/metatag", "authors": [ { "name": "See contributors", @@ -15,23 +14,29 @@ "role": "Developer" } ], - "minimum-stability": "dev", + "homepage": "https://www.drupal.org/project/metatag", "support": { "issues": "https://www.drupal.org/project/issues/metatag", "source": "https://git.drupalcode.org/project/metatag", "docs": "https://www.drupal.org/docs/8/modules/metatag" }, "require": { - "drupal/core": "^9.4 || ^10", - "drupal/token": "^1.0", - "php": ">=8.0" + "php": ">=8.0", + "drupal/core": "^9.4 || ^10 || ^11", + "drupal/token": "^1.0" }, "require-dev": { - "drupal/devel": "^4.0 || ^5.0", - "drupal/hal": "^9 || ^1 || ^2", - "drupal/redirect": "^1.0", + "drupal/hal": "^1 || ^2 || ^9", "drupal/page_manager": "^4.0", - "drupal/webprofiler": "^9 || ^10", + "drupal/redirect": "^1.0", + "ergebnis/composer-normalize": "*", "mpyw/phpunit-patch-serializable-comparison": "*" + }, + "minimum-stability": "dev", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } } } diff --git a/web/modules/metatag/css/firehose_widget.css b/web/modules/metatag/css/firehose_widget.css index c601bce586..1c28a28a25 100644 --- a/web/modules/metatag/css/firehose_widget.css +++ b/web/modules/metatag/css/firehose_widget.css @@ -4,6 +4,6 @@ */ .metatags { - max-height: 500px; overflow-y: overlay; + max-height: 500px; } diff --git a/web/modules/metatag/metatag.info.yml b/web/modules/metatag/metatag.info.yml index 7f26ca02ba..1a6395b8f6 100644 --- a/web/modules/metatag/metatag.info.yml +++ b/web/modules/metatag/metatag.info.yml @@ -1,17 +1,15 @@ name: Metatag type: module description: Manage meta tags for all entities. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO php: 8.0 configure: entity.metatag_defaults.collection dependencies: - drupal:field - token:token -test_dependencies: - - devel:devel -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag.module b/web/modules/metatag/metatag.module index c9a2fcead1..ba90c386ba 100644 --- a/web/modules/metatag/metatag.module +++ b/web/modules/metatag/metatag.module @@ -5,6 +5,7 @@ * Contains metatag.module. */ +use Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\ProductDisplay; use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Serialization\Json; @@ -16,6 +17,7 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\migrate\Plugin\migrate\destination\EntityContentBase; use Drupal\migrate\Plugin\MigrateSourceInterface; @@ -28,8 +30,6 @@ use Drupal\taxonomy\TermInterface; use Drupal\user\Plugin\migrate\source\d6\User as User6; use Drupal\user\Plugin\migrate\source\d7\User as User7; -use Drupal\Core\StringTranslation\TranslatableMarkup; -use Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\ProductDisplay; /** * Implements hook_help(). @@ -95,6 +95,10 @@ function metatag_form_field_config_edit_form_alter(&$form, FormStateInterface $f $form['default_value']['#access'] = FALSE; $form['default_value']['#disabled'] = TRUE; + // Hide the cardinality field. + $form['cardinality_container']['#access'] = FALSE; + $form['cardinality_container']['#disabled'] = TRUE; + // Step through the default value structure and erase any '#default_value' // items that are found. foreach ($form['default_value']['widget'][0] as &$outer) { @@ -950,6 +954,21 @@ function _metatag_is_migration_plugin_supported(array $definition) { 'shortcut_set_users', 'url_alias', 'user_data', + // Various contrib modules. + 'entity:commerce_order', + 'entity:commerce_payment', + 'entity:commerce_payment_method', + 'entity:commerce_promotion', + 'entity:commerce_promotion_coupon', + 'entity:commerce_shipment', + 'entity:commerce_shipping_method', + 'entity:commerce_stock_location', + 'entity:commerce_store', + 'entity:linkcheckerlink', + 'entity:path_alias', + 'entity:redirect', + 'entity:salesforce_mapped_object', + 'entity:webform_submission', ]; if (in_array($definition['destination']['plugin'], $destinations_to_ignore)) { return FALSE; diff --git a/web/modules/metatag/metatag.post_update.php b/web/modules/metatag/metatag.post_update.php index b34eee7a98..78bc0f4546 100644 --- a/web/modules/metatag/metatag.post_update.php +++ b/web/modules/metatag/metatag.post_update.php @@ -130,7 +130,6 @@ function metatag_post_update_convert_author_config(&$sandbox) { * The author meta tag was moved into the main module: entity data. */ function metatag_post_update_convert_author_data(&$sandbox) { - $entity_type_manager = \Drupal::entityTypeManager(); $database = \Drupal::database(); // This whole top section only needs to be done the first time. @@ -195,7 +194,7 @@ function metatag_post_update_convert_author_data(&$sandbox) { // Strip any empty tags or ones matching the field's defaults and leave // only the overridden tags in $new_tags. - $tags = unserialize($record->$field_value_field); + $tags = unserialize($record->$field_value_field, ['allowed_classes' => FALSE]); if (isset($tags['google_plus_author'])) { $tags['author'] = $tags['google_plus_author']; $tags_string = serialize($tags); @@ -247,7 +246,6 @@ function metatag_post_update_convert_author_data(&$sandbox) { * Remove 'noydir', 'noodp' ROBOTS options from meta tag entity fields. */ function metatag_post_update_remove_robots_noydir_noodp(&$sandbox) { - $entity_type_manager = \Drupal::entityTypeManager(); $database = \Drupal::database(); // This whole top section only needs to be done the first time. @@ -377,7 +375,6 @@ function metatag_post_update_remove_robots_noydir_noodp(&$sandbox) { * Convert all fields to use JSON storage. */ function metatag_post_update_v2_01_change_fields_to_json(&$sandbox) { - $entity_type_manager = \Drupal::entityTypeManager(); $database = \Drupal::database(); // This whole top section only needs to be done the first time. @@ -444,23 +441,23 @@ function metatag_post_update_v2_01_change_fields_to_json(&$sandbox) { // @todo Remove tags matching the defaults and leave overridden values. if (substr($record->$field_value_field, 0, 2) === 'a:') { $tags = @unserialize($record->$field_value_field, ['allowed_classes' => FALSE]); + + if (is_array($tags)) { + $tags_string = Json::encode($tags); + $database->update($field_table) + ->fields([ + $field_value_field => $tags_string, + ]) + ->condition('entity_id', $record->entity_id) + ->condition('revision_id', $record->revision_id) + ->condition('langcode', $record->langcode) + ->execute(); + } + $counter++; } else { throw new UpdateException("It seems like there was a problem with the data. The update script should probably be improved to better handle these scenarios."); } - - if (is_array($tags)) { - $tags_string = Json::encode($tags); - $database->update($field_table) - ->fields([ - $field_value_field => $tags_string, - ]) - ->condition('entity_id', $record->entity_id) - ->condition('revision_id', $record->revision_id) - ->condition('langcode', $record->langcode) - ->execute(); - } - $counter++; } if (empty($counter)) { $sandbox['current_field']++; @@ -493,7 +490,6 @@ function metatag_post_update_v2_01_change_fields_to_json(&$sandbox) { * Remove meta tags entity values that were removed in v2. */ function metatag_post_update_v2_02_remove_entity_values(array &$sandbox) { - $entity_type_manager = \Drupal::entityTypeManager(); $database = \Drupal::database(); $metatags_to_remove = [ diff --git a/web/modules/metatag/metatag_app_links/metatag_app_links.info.yml b/web/modules/metatag/metatag_app_links/metatag_app_links.info.yml index ba4676022e..0902e143e3 100644 --- a/web/modules/metatag/metatag_app_links/metatag_app_links.info.yml +++ b/web/modules/metatag/metatag_app_links/metatag_app_links.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: App Links' type: module description: Provides support for applinks.org meta tags. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_dc/metatag_dc.info.yml b/web/modules/metatag/metatag_dc/metatag_dc.info.yml index ee799e9f3e..4ed2e3b490 100644 --- a/web/modules/metatag/metatag_dc/metatag_dc.info.yml +++ b/web/modules/metatag/metatag_dc/metatag_dc.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Dublin Core' type: module description: Provides the fifteen <a href="https://dublincore.org/documents/dces/">Dublin Core Metadata Element Set 1.1</a> meta tags from the <a href="https://dublincore.org/">Dublin Core Metadata Institute</a>. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_dc_advanced/metatag_dc_advanced.info.yml b/web/modules/metatag/metatag_dc_advanced/metatag_dc_advanced.info.yml index b3f66994ba..5606be4d29 100644 --- a/web/modules/metatag/metatag_dc_advanced/metatag_dc_advanced.info.yml +++ b/web/modules/metatag/metatag_dc_advanced/metatag_dc_advanced.info.yml @@ -1,13 +1,13 @@ name: 'Metatag: Dublin Core Advanced' type: module description: 'Provides forty additional meta tags from the <a href="https://dublincore.org/">Dublin Core Metadata Institute</a>.' -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag - metatag:metatag_dc -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_extended_perms/README.txt b/web/modules/metatag/metatag_extended_perms/README.txt index a742dc2836..2e7e902c76 100644 --- a/web/modules/metatag/metatag_extended_perms/README.txt +++ b/web/modules/metatag/metatag_extended_perms/README.txt @@ -49,7 +49,11 @@ function mysite_update_9001() { // Look for permissions that started with the old permission string. if (strpos($perm, 'access metatag tag') !== FALSE) { // Grand the new permission. - $role->grantPermission(str_replace('access metatag tag', 'access metatag', $perm)); + $role->grantPermission( + str_replace( + 'access metatag tag', 'access metatag', $perm + ) + ); // Track that the role's permissions changed. $changed = TRUE; diff --git a/web/modules/metatag/metatag_extended_perms/metatag_extended_perms.info.yml b/web/modules/metatag/metatag_extended_perms/metatag_extended_perms.info.yml index d32f53ab77..3228cf4f06 100644 --- a/web/modules/metatag/metatag_extended_perms/metatag_extended_perms.info.yml +++ b/web/modules/metatag/metatag_extended_perms/metatag_extended_perms.info.yml @@ -1,12 +1,12 @@ name: Metatag Extended Permissions type: module description: "Adds individual permissions for each meta tag, allowing for fine-grained access to the meta tags. Note: this may lead to performance issues on the permissions admin page, please see the included README.txt file for details." -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_extended_perms/tests/src/Functional/PermissionsTest.php b/web/modules/metatag/metatag_extended_perms/tests/src/Functional/PermissionsTest.php index 569e3eb2cf..a304d1d17f 100644 --- a/web/modules/metatag/metatag_extended_perms/tests/src/Functional/PermissionsTest.php +++ b/web/modules/metatag/metatag_extended_perms/tests/src/Functional/PermissionsTest.php @@ -2,9 +2,10 @@ namespace Drupal\Tests\metatag_extended_perms\Functional; +use Drupal\node\Entity\NodeType; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\Tests\metatag\Functional\MetatagHelperTrait; -use Drupal\node\Entity\NodeType; /** * Verify the new permissions are added. @@ -14,6 +15,7 @@ class PermissionsTest extends BrowserTestBase { // Contains helper methods. + use FieldUiTestTrait; use MetatagHelperTrait; /** @@ -198,15 +200,7 @@ protected function createContentType(array $values = []): NodeType { $this->drupalGet('node/add/page'); // Add a metatag field to the entity type test_entity. - $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, 'Save and continue'); - $this->submitForm([], 'Save field settings'); + $this->fieldUIAddNewField('admin/structure/types/manage/page', 'metatag', 'Metatag', 'metatag'); // Clear all settings. $this->container->get('entity_field.manager')->clearCachedFieldDefinitions(); diff --git a/web/modules/metatag/metatag_facebook/metatag_facebook.info.yml b/web/modules/metatag/metatag_facebook/metatag_facebook.info.yml index 75c721de73..f436eee7b0 100644 --- a/web/modules/metatag/metatag_facebook/metatag_facebook.info.yml +++ b/web/modules/metatag/metatag_facebook/metatag_facebook.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Facebook' type: module description: A set of meta tags specially for controlling advanced functionality with Facebook. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_favicons/metatag_favicons.info.yml b/web/modules/metatag/metatag_favicons/metatag_favicons.info.yml index f0891bfe0b..a2eca8d7db 100644 --- a/web/modules/metatag/metatag_favicons/metatag_favicons.info.yml +++ b/web/modules/metatag/metatag_favicons/metatag_favicons.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Favicons' type: module description: Provides support for many different favicons. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_favicons/src/Plugin/metatag/Tag/MaskIcon.php b/web/modules/metatag/metatag_favicons/src/Plugin/metatag/Tag/MaskIcon.php index b9d6c0d11f..2facd048b9 100644 --- a/web/modules/metatag/metatag_favicons/src/Plugin/metatag/Tag/MaskIcon.php +++ b/web/modules/metatag/metatag_favicons/src/Plugin/metatag/Tag/MaskIcon.php @@ -2,8 +2,8 @@ namespace Drupal\metatag_favicons\Plugin\metatag\Tag; -use Drupal\metatag\Plugin\metatag\Tag\LinkRelBase; use Drupal\Component\Utility\Random; +use Drupal\metatag\Plugin\metatag\Tag\LinkRelBase; /** * The Favicons "mask-icon" meta tag. diff --git a/web/modules/metatag/metatag_favicons/tests/src/Functional/TagsTest.php b/web/modules/metatag/metatag_favicons/tests/src/Functional/TagsTest.php index 7a9a06b1c0..3767a09800 100644 --- a/web/modules/metatag/metatag_favicons/tests/src/Functional/TagsTest.php +++ b/web/modules/metatag/metatag_favicons/tests/src/Functional/TagsTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\metatag_favicons\Functional; use Drupal\Component\Serialization\Json; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\Tests\metatag\Functional\TagsTestBase; /** @@ -12,6 +13,8 @@ */ class TagsTest extends TagsTestBase { + use FieldUiTestTrait; + /** * {@inheritdoc} */ @@ -25,15 +28,7 @@ public function testMaskIconLegacy() { // Add a metatag field to the entity type test_entity. $this->createContentType(['type' => 'page']); - $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, 'Save and continue'); - $this->submitForm([], 'Save field settings'); + $this->fieldUIAddNewField('admin/structure/types/manage/page', 'metatag', 'Metatag', 'metatag'); // Create a demo node of this content type so it can be tested. $this->drupalGet('node/add/page'); diff --git a/web/modules/metatag/metatag_google_cse/metatag_google_cse.info.yml b/web/modules/metatag/metatag_google_cse/metatag_google_cse.info.yml index f62400f8ed..637ebe3473 100644 --- a/web/modules/metatag/metatag_google_cse/metatag_google_cse.info.yml +++ b/web/modules/metatag/metatag_google_cse/metatag_google_cse.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Google Custom Search Engine (CSE)' type: module description: Provides support for meta tags used for Google Custom Search Engine. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_google_plus/metatag_google_plus.info.yml b/web/modules/metatag/metatag_google_plus/metatag_google_plus.info.yml index a1d9234225..eb6fcb681e 100644 --- a/web/modules/metatag/metatag_google_plus/metatag_google_plus.info.yml +++ b/web/modules/metatag/metatag_google_plus/metatag_google_plus.info.yml @@ -1,13 +1,13 @@ name: 'Metatag: Google Plus' type: module description: Deprecated module, do not use. Will be removed in 3.0.0. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO hidden: true dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_hreflang/metatag_hreflang.info.yml b/web/modules/metatag/metatag_hreflang/metatag_hreflang.info.yml index 57c8e83cf6..cecf97713b 100644 --- a/web/modules/metatag/metatag_hreflang/metatag_hreflang.info.yml +++ b/web/modules/metatag/metatag_hreflang/metatag_hreflang.info.yml @@ -1,12 +1,12 @@ name: "Metatag: Hreflang" type: module description: Provides support for the hreflang meta tag with some extra logic to simplify it. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_hreflang/src/Plugin/metatag/Tag/HreflangPerLanguage.php b/web/modules/metatag/metatag_hreflang/src/Plugin/metatag/Tag/HreflangPerLanguage.php index 8c0477d6f0..954df7b6c1 100644 --- a/web/modules/metatag/metatag_hreflang/src/Plugin/metatag/Tag/HreflangPerLanguage.php +++ b/web/modules/metatag/metatag_hreflang/src/Plugin/metatag/Tag/HreflangPerLanguage.php @@ -2,8 +2,6 @@ namespace Drupal\metatag_hreflang\Plugin\metatag\Tag; -use Drupal\Component\Utility\Random; - /** * A new hreflang tag will be made available for each language. * @@ -42,14 +40,25 @@ public function getTestFormXpath(): array { * {@inheritdoc} */ public function getTestFormData(): array { - $random = new Random(); + return []; - return [ - // @todo Submitting this value results in the following error: - // Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for metatag.metatag_defaults.global with the following errors: metatag.metatag_defaults.global:tags.hreflang_per_language:hreflang_en missing schema in Drupal\Core\Config\Development\ConfigSchemaChecker->onConfigSave() (line 94 of core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php). - - // 'hreflang_per_language:hreflang_en' => 'https://www.example.com/' . $random->word(6) . '.html', - ]; + // @todo Submitting this value results in the following error: + // Drupal\Core\Config\Schema\SchemaIncompleteException: + // Schema errors for metatag.metatag_defaults.global + // with the following errors: + // metatag.metatag_defaults.global:tags.hreflang_per_language:hreflang_en + // missing schema in + // Drupal\Core\Config\Development\ConfigSchemaChecker->onConfigSave() + // Line 94 of + // core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php + // @code + // $random = new Random(); + // $hreflang = 'https://www.example.com/' . $random->word(6) . '.html'; + // + // return [ + // 'hreflang_per_language:hreflang_en' => $hreflang, + // ]; + // @endcode } /** diff --git a/web/modules/metatag/metatag_mobile/metatag_mobile.info.yml b/web/modules/metatag/metatag_mobile/metatag_mobile.info.yml index 4a25264f22..1254f6fba8 100644 --- a/web/modules/metatag/metatag_mobile/metatag_mobile.info.yml +++ b/web/modules/metatag/metatag_mobile/metatag_mobile.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Mobile & UI Adjustments' type: module description: Provides support for meta tags used to control the mobile browser experience. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_mobile/metatag_mobile.module b/web/modules/metatag/metatag_mobile/metatag_mobile.module index 1ac1f72797..0ce517c65a 100644 --- a/web/modules/metatag/metatag_mobile/metatag_mobile.module +++ b/web/modules/metatag/metatag_mobile/metatag_mobile.module @@ -53,11 +53,7 @@ function metatag_mobile_page_attachments_alter(array &$attachments) { // found so it can be picked up as the dupe; this is important for the // "viewport" meta tag where both core and Metatag use the same name. if (in_array($item[1], $meta_tags) && !isset($found[$core_tag])) { - foreach ($meta_tags as $meta_tag) { - if (!isset($found[$core_tag])) { - $found[$core_tag] = $key; - } - } + $found[$core_tag] = $key; } elseif ($item[1] == $core_tag && isset($found[$core_tag])) { // @todo This ought to work, but doesn't? diff --git a/web/modules/metatag/metatag_mobile/tests/src/Functional/TestCoreTagRemoval.php b/web/modules/metatag/metatag_mobile/tests/src/Functional/TestCoreTagRemoval.php index 6c90ae2f25..8eb137cce5 100644 --- a/web/modules/metatag/metatag_mobile/tests/src/Functional/TestCoreTagRemoval.php +++ b/web/modules/metatag/metatag_mobile/tests/src/Functional/TestCoreTagRemoval.php @@ -3,8 +3,8 @@ namespace Drupal\Tests\metatag_mobile\Functional; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\Tests\metatag\Functional\MetatagHelperTrait; -use Drupal\user\Entity\User; /** * Verify that the configured defaults load as intended. @@ -14,6 +14,7 @@ class TestCoreTagRemoval extends BrowserTestBase { // Contains helper methods. + use FieldUiTestTrait; use MetatagHelperTrait; /** @@ -30,6 +31,8 @@ class TestCoreTagRemoval extends BrowserTestBase { /** * Use the full install profile, with the full theme. + * + * @var string */ protected $profile = 'standard'; @@ -43,23 +46,13 @@ protected function setUp(): void { $this->loginUser1(); // Add the Metatag field to the content type. - $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, 'Save and continue'); - $this->submitForm([], 'Save field settings'); - $this->assertSession()->statusCodeEquals(200); + $this->fieldUIAddNewField('admin/structure/types/manage/page', 'metatag', 'Metatag', 'metatag'); } - /** * Verify that core's duplicate meta tags are removed. */ - public function testCoreTagRemoval() { + public function testRemovalCoreTag() { // Create a node that does not override core's meta tags. $this->drupalGet('node/add/page'); $this->assertSession()->statusCodeEquals(200); diff --git a/web/modules/metatag/metatag_open_graph/metatag_open_graph.info.yml b/web/modules/metatag/metatag_open_graph/metatag_open_graph.info.yml index 0972705899..889f001538 100644 --- a/web/modules/metatag/metatag_open_graph/metatag_open_graph.info.yml +++ b/web/modules/metatag/metatag_open_graph/metatag_open_graph.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Open Graph' type: module description: Provides support for Open Graph Protocol meta tags. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_open_graph_products/metatag_open_graph_products.info.yml b/web/modules/metatag/metatag_open_graph_products/metatag_open_graph_products.info.yml index 98b70574bc..13a8ab9cf9 100644 --- a/web/modules/metatag/metatag_open_graph_products/metatag_open_graph_products.info.yml +++ b/web/modules/metatag/metatag_open_graph_products/metatag_open_graph_products.info.yml @@ -1,13 +1,13 @@ name: 'Metatag: Open Graph Products' type: module description: Provides additional Open Graph Protocol meta tags for describing products. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag - metatag:metatag_open_graph -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_page_manager/metatag_page_manager.info.yml b/web/modules/metatag/metatag_page_manager/metatag_page_manager.info.yml index 921b515941..d4b402aa58 100644 --- a/web/modules/metatag/metatag_page_manager/metatag_page_manager.info.yml +++ b/web/modules/metatag/metatag_page_manager/metatag_page_manager.info.yml @@ -1,13 +1,13 @@ name: 'Metatag: Page Manager' type: module description: Provides metatag support for Page Manager variants. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - page_manager:page_manager - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_page_manager/metatag_page_manager.module b/web/modules/metatag/metatag_page_manager/metatag_page_manager.module index 68e0a5ba85..b886467958 100644 --- a/web/modules/metatag/metatag_page_manager/metatag_page_manager.module +++ b/web/modules/metatag/metatag_page_manager/metatag_page_manager.module @@ -5,10 +5,10 @@ * Contains metatag_page_manager.module. */ -use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Form\FormStateInterface; -use Drupal\page_manager\Entity\PageVariant; +use Drupal\Core\Routing\RouteMatchInterface; use Drupal\metatag\Entity\MetatagDefaults; +use Drupal\page_manager\Entity\PageVariant; /** * Implements hook_form_FORM_ID_alter(). @@ -18,46 +18,6 @@ function metatag_page_manager_form_metatag_defaults_add_form_alter(&$form, FormS $form['id']['#options'] = array_merge($form['id']['#options'], $variants_options); } -/** - * Implements hook_page_attachments(). - */ -function metatag_page_manager_page_attachments(array &$attachments) { - // Fetch entity from request. - $entity = \Drupal::request()->attributes->get('_entity'); - if ($entity) { - - $key = $entity->getEntityType()->id() . '__' . $entity->id(); - // Get default metatags. - $metatag_defaults = metatag_get_default_tags(); - // Load page variant metatags. - $metatag_variant = MetatagDefaults::load($key); - if ($metatag_variant) { - // Overwrite the metatag defaults with the tags of the page variant. - $metatag_defaults = array_merge($metatag_defaults, $metatag_variant->get('tags')); - - // Set the metatag in the static metatag attachments parameter so the - // metatag module wouldn't overwrite them. - $metatag_attachments = &drupal_static('metatag_attachments'); - - $metatag_manager = \Drupal::service('metatag.manager'); - $metatag_attachments = $metatag_manager->generateElements($metatag_defaults, $entity); - - // If any Metatag items were found, append them. - if (!empty($metatag_attachments['#attached']['html_head'])) { - if (empty($attachments['#attached'])) { - $attachments['#attached'] = []; - } - if (empty($attachments['#attached']['html_head'])) { - $attachments['#attached']['html_head'] = []; - } - foreach ($metatag_attachments['#attached']['html_head'] as $item) { - $attachments['#attached']['html_head'][] = $item; - } - } - } - } -} - /** * Returns all available page variants. * diff --git a/web/modules/metatag/metatag_pinterest/metatag_pinterest.info.yml b/web/modules/metatag/metatag_pinterest/metatag_pinterest.info.yml index 02adbedf25..c219515e7e 100644 --- a/web/modules/metatag/metatag_pinterest/metatag_pinterest.info.yml +++ b/web/modules/metatag/metatag_pinterest/metatag_pinterest.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Pinterest' type: module description: Provides support for Pinterest's custom meta tags. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_routes/metatag_routes.info.yml b/web/modules/metatag/metatag_routes/metatag_routes.info.yml index db0debc85a..532dfe5244 100644 --- a/web/modules/metatag/metatag_routes/metatag_routes.info.yml +++ b/web/modules/metatag/metatag_routes/metatag_routes.info.yml @@ -1,12 +1,12 @@ name: 'Metatag Custom Routes (Paths)' type: module description: Allows assigning meta tags to be used on custom routes, equivalent to custom paths. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_routes/src/Form/MetatagCustomCreateForm.php b/web/modules/metatag/metatag_routes/src/Form/MetatagCustomCreateForm.php index abec71fa86..301f30ba22 100644 --- a/web/modules/metatag/metatag_routes/src/Form/MetatagCustomCreateForm.php +++ b/web/modules/metatag/metatag_routes/src/Form/MetatagCustomCreateForm.php @@ -2,13 +2,13 @@ namespace Drupal\metatag_routes\Form; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Routing\RouteProvider; use Drupal\Core\Path\PathValidator; use Drupal\Core\Routing\AdminContext; +use Drupal\Core\Routing\RouteProvider; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Form for creating custom definitions. @@ -52,7 +52,7 @@ public function __construct( EntityTypeManagerInterface $entity_type_manager, RouteProvider $route_provider, PathValidator $path_validator, - AdminContext $admin_context + AdminContext $admin_context, ) { $this->entityTypeManager = $entity_type_manager; $this->routeProvider = $route_provider; diff --git a/web/modules/metatag/metatag_twitter_cards/metatag_twitter_cards.info.yml b/web/modules/metatag/metatag_twitter_cards/metatag_twitter_cards.info.yml index 3f3e070f54..efbfb78833 100644 --- a/web/modules/metatag/metatag_twitter_cards/metatag_twitter_cards.info.yml +++ b/web/modules/metatag/metatag_twitter_cards/metatag_twitter_cards.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Twitter Cards' type: module description: Provides support for Twitter's Card meta tags. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_twitter_cards/src/Plugin/metatag/Tag/TwitterCardsType.php b/web/modules/metatag/metatag_twitter_cards/src/Plugin/metatag/Tag/TwitterCardsType.php index ba899ded5c..f8a6b6ef7d 100644 --- a/web/modules/metatag/metatag_twitter_cards/src/Plugin/metatag/Tag/TwitterCardsType.php +++ b/web/modules/metatag/metatag_twitter_cards/src/Plugin/metatag/Tag/TwitterCardsType.php @@ -2,8 +2,8 @@ namespace Drupal\metatag_twitter_cards\Plugin\metatag\Tag; -use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase; /** * The Twitter Cards Type-tag. diff --git a/web/modules/metatag/metatag_verification/metatag_verification.info.yml b/web/modules/metatag/metatag_verification/metatag_verification.info.yml index 0fab5ee979..e79857b61a 100644 --- a/web/modules/metatag/metatag_verification/metatag_verification.info.yml +++ b/web/modules/metatag/metatag_verification/metatag_verification.info.yml @@ -1,12 +1,12 @@ name: 'Metatag: Verification' type: module description: Verifies ownership of a site for search engines and other services. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_views/metatag_views.info.yml b/web/modules/metatag/metatag_views/metatag_views.info.yml index 25335acd6d..585f63363c 100644 --- a/web/modules/metatag/metatag_views/metatag_views.info.yml +++ b/web/modules/metatag/metatag_views/metatag_views.info.yml @@ -1,13 +1,13 @@ name: 'Metatag: Views' type: module description: Provides views integration for metatags. -core_version_requirement: '^9.4 || ^10' +core_version_requirement: '^9.4 || ^10 || ^11' package: SEO dependencies: - metatag:metatag - drupal:views -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/metatag_views/src/Controller/MetatagViewsTranslationController.php b/web/modules/metatag/metatag_views/src/Controller/MetatagViewsTranslationController.php index 9de54ba8ef..5d047f22d7 100644 --- a/web/modules/metatag/metatag_views/src/Controller/MetatagViewsTranslationController.php +++ b/web/modules/metatag/metatag_views/src/Controller/MetatagViewsTranslationController.php @@ -2,6 +2,7 @@ namespace Drupal\metatag_views\Controller; +use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Language\LanguageManagerInterface; @@ -9,7 +10,6 @@ use Drupal\metatag\MetatagManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; -use Drupal\Core\Config\ConfigFactoryInterface; /** * Translate Views meta tags. diff --git a/web/modules/metatag/metatag_views/src/Form/MetatagViewsTranslationForm.php b/web/modules/metatag/metatag_views/src/Form/MetatagViewsTranslationForm.php index 89be8defb5..f9907f930d 100644 --- a/web/modules/metatag/metatag_views/src/Form/MetatagViewsTranslationForm.php +++ b/web/modules/metatag/metatag_views/src/Form/MetatagViewsTranslationForm.php @@ -5,13 +5,13 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\metatag\MetatagManagerInterface; use Drupal\metatag\MetatagTagPluginManager; use Drupal\metatag\MetatagToken; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\metatag_views\MetatagViewsValuesCleanerTrait; -use Drupal\Core\StringTranslation\StringTranslationTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Defines a form for translating meta tags for views. diff --git a/web/modules/metatag/metatag_views/src/MetatagViewsCacheWrapper.php b/web/modules/metatag/metatag_views/src/MetatagViewsCacheWrapper.php index f58317834e..f1c11c8f2f 100644 --- a/web/modules/metatag/metatag_views/src/MetatagViewsCacheWrapper.php +++ b/web/modules/metatag/metatag_views/src/MetatagViewsCacheWrapper.php @@ -41,6 +41,25 @@ public function __construct(CachePluginBase $plugin) { $this->plugin = $plugin; } + /** + * Create a new object. + * + * @param \Symfony\Component\DependencyInjection\ContainerInterface $container + * The container object. + * @param array $configuration + * The configuration passed in. + * @param string $plugin_id + * The ID the new plugin instance. + * @param string $plugin_definition + * The configuration used on this plugin instance. + * + * @return \Drupal\metatag_views\MetatagViewsCacheWrapper + * An instance of this class. + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return CachePluginBase::create($container, $configuration, $plugin_id, $plugin_definition); + } + /** * {@inheritdoc} */ @@ -71,7 +90,7 @@ public function cacheGet($type) { switch ($type) { case self::RESULTS: $cutoff = $this->plugin->cacheExpire($type); - // Values to set: $view->result, $view->total_rows, $view->execute_time, + // Values to set: $view->result, $view->total_rows, // $view->current_page and pass row tokens to metatag display extender. if ($cache = \Drupal::cache($this->plugin->resultsBin)->get($this->plugin->generateResultsKey())) { if (!$cutoff || $cache->created > $cutoff) { @@ -80,10 +99,10 @@ public function cacheGet($type) { // Load entities for each result. $view->query->loadEntities($view->result); $view->total_rows = $cache->data['total_rows']; - $view->setCurrentPage($cache->data['current_page'], TRUE); - $view->execute_time = 0; + $view->setCurrentPage($cache->data['current_page']); $extenders = $view->getDisplay()->getExtenders(); if (isset($extenders['metatag_display_extender'])) { + /** @var \Drupal\metatag_views\Plugin\views\display_extender\MetatagDisplayExtender $extenders['metatag_display_extender'] */ $extenders['metatag_display_extender']->setFirstRowTokens($cache->data['first_row_tokens']); } return TRUE; @@ -173,13 +192,6 @@ public function getRowId(ResultRow $row) { return $this->plugin->getRowId($row); } - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - CachePluginBase::create($container, $configuration, $plugin_id, $plugin_definition); - } - /** * {@inheritdoc} */ @@ -219,7 +231,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public static function trustedCallbacks() { - CachePluginBase::trustedCallbacks(); + return CachePluginBase::trustedCallbacks(); } /** @@ -296,14 +308,14 @@ public function globalTokenForm(&$form, FormStateInterface $form_state) { * {@inheritdoc} */ public static function preRenderAddFieldsetMarkup(array $form) { - CachePluginBase::preRenderAddFieldsetMarkup($form); + return CachePluginBase::preRenderAddFieldsetMarkup($form); } /** * {@inheritdoc} */ public static function preRenderFlattenData($form) { - CachePluginBase::preRenderFlattenData($form); + return CachePluginBase::preRenderFlattenData($form); } /** @@ -324,7 +336,7 @@ public function getProvider() { * {@inheritdoc} */ public static function queryLanguageSubstitutions() { - CachePluginBase::queryLanguageSubstitutions(); + return CachePluginBase::queryLanguageSubstitutions(); } /** @@ -380,7 +392,7 @@ public function setMessenger(MessengerInterface $messenger) { * {@inheritdoc} */ public function messenger() { - $this->plugin->messenger(); + return $this->plugin->messenger(); } /** diff --git a/web/modules/metatag/metatag_views/src/Plugin/views/display_extender/MetatagDisplayExtender.php b/web/modules/metatag/metatag_views/src/Plugin/views/display_extender/MetatagDisplayExtender.php index 3bbcac8532..cf5b7815ea 100644 --- a/web/modules/metatag/metatag_views/src/Plugin/views/display_extender/MetatagDisplayExtender.php +++ b/web/modules/metatag/metatag_views/src/Plugin/views/display_extender/MetatagDisplayExtender.php @@ -3,12 +3,12 @@ namespace Drupal\metatag_views\Plugin\views\display_extender; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase; use Drupal\views\Plugin\views\style\StylePluginBase; use Drupal\views\ViewExecutable; use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Metatag display extender plugin. diff --git a/web/modules/metatag/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php b/web/modules/metatag/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php index 6226677e6c..bd842cffc4 100644 --- a/web/modules/metatag/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php +++ b/web/modules/metatag/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php @@ -66,9 +66,6 @@ public function testViewsUi() { $this->drupalGet('<front>'); $this->assertSession()->statusCodeEquals(200); - // With nothing else configured the front page just has a login form. - $this->assertSession()->pageTextContains('Enter your Drupal username.'); - // Log in as user 1. $this->loginUser1(); diff --git a/web/modules/metatag/phpstan.neon b/web/modules/metatag/phpstan.neon new file mode 100644 index 0000000000..20815509df --- /dev/null +++ b/web/modules/metatag/phpstan.neon @@ -0,0 +1,11 @@ +# Configuration file for PHPStan static code checking, see https://phpstan.org. +includes: + - phar://phpstan.phar/conf/bleedingEdge.neon + +parameters: + level: 2 + paths: + - . + ignoreErrors: + # new static() is a best practice in Drupal, so we cannot fix that. + - "#^Unsafe usage of new static#" diff --git a/web/modules/metatag/src/Controller/MetatagController.php b/web/modules/metatag/src/Controller/MetatagController.php index b3be156794..9e8a53514c 100644 --- a/web/modules/metatag/src/Controller/MetatagController.php +++ b/web/modules/metatag/src/Controller/MetatagController.php @@ -4,8 +4,8 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\metatag\MetatagTagPluginManager; use Drupal\metatag\MetatagGroupPluginManager; +use Drupal\metatag\MetatagTagPluginManager; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/web/modules/metatag/src/Form/MetatagDefaultsForm.php b/web/modules/metatag/src/Form/MetatagDefaultsForm.php index 421839d13a..1806d80cdf 100644 --- a/web/modules/metatag/src/Form/MetatagDefaultsForm.php +++ b/web/modules/metatag/src/Form/MetatagDefaultsForm.php @@ -24,6 +24,13 @@ */ class MetatagDefaultsForm extends EntityForm { + /** + * The Metatag defaults object being reverted. + * + * @var \Drupal\metatag\Entity\MetatagDefaults + */ + protected $entity; + /** * The entity type bundle info service. * @@ -353,8 +360,29 @@ public static function getSupportedEntityTypes(): array { 'contact_message', // Menu items. 'menu_link_content', + // Path aliases. + 'path_alias', // Shortcut items. 'shortcut', + // From contributed modules: + // Various Commerce entities. + 'commerce_order', + 'commerce_payment', + 'commerce_payment_method', + 'commerce_promotion', + 'commerce_promotion_coupon', + 'commerce_shipment', + 'commerce_shipping_method', + 'commerce_stock_location', + 'commerce_store', + // LinkChecker. + 'linkcheckerlink', + // Redirect. + 'redirect', + // Salesforce. + 'salesforce_mapped_object', + // Webform. + 'webform_submission', ]; // Make a list of supported content types. diff --git a/web/modules/metatag/src/Form/MetatagDefaultsRevertForm.php b/web/modules/metatag/src/Form/MetatagDefaultsRevertForm.php index 1596d526a4..3b0e57f3fc 100644 --- a/web/modules/metatag/src/Form/MetatagDefaultsRevertForm.php +++ b/web/modules/metatag/src/Form/MetatagDefaultsRevertForm.php @@ -11,6 +11,13 @@ */ class MetatagDefaultsRevertForm extends EntityConfirmFormBase { + /** + * The Metatag defaults object being reverted. + * + * @var \Drupal\metatag\Entity\MetatagDefaults + */ + protected $entity; + /** * {@inheritdoc} */ @@ -36,7 +43,6 @@ public function getConfirmText() { * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - /** @var \Drupal\metatag\Entity\MetatagDefaults $this->entity */ $this->entity->revert(); $this->messenger()->addMessage( diff --git a/web/modules/metatag/src/Form/MetatagSettingsForm.php b/web/modules/metatag/src/Form/MetatagSettingsForm.php index a111765c66..07e964df8c 100644 --- a/web/modules/metatag/src/Form/MetatagSettingsForm.php +++ b/web/modules/metatag/src/Form/MetatagSettingsForm.php @@ -42,6 +42,13 @@ class MetatagSettingsForm extends ConfigFormBase { */ protected $tagPluginManager; + /** + * The module handler. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + /** * {@inheritdoc} */ @@ -54,6 +61,7 @@ public static function create(ContainerInterface $container) { $instance->metatagManager = $container->get('metatag.manager'); $instance->state = $container->get('state'); $instance->tagPluginManager = $container->get('plugin.manager.metatag.tag'); + $instance->moduleHandler = $container->get('module_handler'); return $instance; } @@ -140,13 +148,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { ]; // Optional support for the Maxlenth module. - $form['tag_trim']['use_maxlength'] = array( + $form['tag_trim']['use_maxlength'] = [ '#type' => 'checkbox', '#title' => $this->t('Use Maxlength module to force these limits?'), '#default_value' => $this->config('metatag.settings')->get('use_maxlength') ?? TRUE, - '#description' => $this->t('Because of how tokens are processed in meta tags, use of the Maxlength module may not provide an accurate representation of the actual current length of each meta tag, so it may cause more problem than it is worth. '), - ); - if (!\Drupal::moduleHandler()->moduleExists('maxlength')) { + '#description' => $this->t('Because of how tokens are processed in meta tags, use of the Maxlength module may not provide an accurate representation of the actual current length of each meta tag, so it may cause more problem than it is worth.'), + ]; + if (!$this->moduleHandler->moduleExists('maxlength')) { $form['tag_trim']['use_maxlength']['#disabled'] = TRUE; $form['tag_trim']['use_maxlength']['#description'] = $this->t('Install the Maxlength module to enable this option.'); } diff --git a/web/modules/metatag/src/MetatagManager.php b/web/modules/metatag/src/MetatagManager.php index 06557829ed..ddb679666c 100644 --- a/web/modules/metatag/src/MetatagManager.php +++ b/web/modules/metatag/src/MetatagManager.php @@ -128,7 +128,8 @@ class MetatagManager implements MetatagManagerInterface { * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The Config Factory. */ - public function __construct(MetatagGroupPluginManager $groupPluginManager, + public function __construct( + MetatagGroupPluginManager $groupPluginManager, MetatagTagPluginManager $tagPluginManager, MetatagToken $token, LoggerChannelFactoryInterface $channelFactory, @@ -137,7 +138,7 @@ public function __construct(MetatagGroupPluginManager $groupPluginManager, RouteMatchInterface $routeMatch, RequestStack $requestStack, LanguageManagerInterface $languageManager, - ConfigFactoryInterface $config_factory + ConfigFactoryInterface $config_factory, ) { $this->groupPluginManager = $groupPluginManager; $this->tagPluginManager = $tagPluginManager; @@ -677,12 +678,6 @@ public function generateTokenValues(array $tags, $entity = NULL): array { ->getId(); } - // Use the entity's language code, if one is defined. - $langcode = NULL; - if ($entity) { - $langcode = $entity->language()->getId(); - } - if (!isset($this->processedTokenCache[$entity_identifier])) { $metatag_tags = $this->sortedTags(); diff --git a/web/modules/metatag/src/MetatagSeparator.php b/web/modules/metatag/src/MetatagSeparator.php index daf1a4f227..f8f54dbe27 100644 --- a/web/modules/metatag/src/MetatagSeparator.php +++ b/web/modules/metatag/src/MetatagSeparator.php @@ -30,7 +30,7 @@ public function getSeparator(): string { $config = $this->configFactory->get('metatag.settings'); // @todo This extra check shouldn't be needed. - if (!empty($config)) { + if ($config) { $separator = $config->get('separator'); } diff --git a/web/modules/metatag/src/MetatagToken.php b/web/modules/metatag/src/MetatagToken.php index eb7cdf110e..f74f10c014 100644 --- a/web/modules/metatag/src/MetatagToken.php +++ b/web/modules/metatag/src/MetatagToken.php @@ -2,10 +2,10 @@ namespace Drupal\metatag; -use Drupal\Core\Utility\Token; use Drupal\Core\Render\BubbleableMetadata; -use Drupal\token\TokenEntityMapperInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Core\Utility\Token; +use Drupal\token\TokenEntityMapperInterface; /** * Token handling service. Uses core token service or contributed Token. diff --git a/web/modules/metatag/src/Plugin/Field/FieldFormatter/MetatagEmptyFormatter.php b/web/modules/metatag/src/Plugin/Field/FieldFormatter/MetatagEmptyFormatter.php index 06b6877d38..6116e39352 100644 --- a/web/modules/metatag/src/Plugin/Field/FieldFormatter/MetatagEmptyFormatter.php +++ b/web/modules/metatag/src/Plugin/Field/FieldFormatter/MetatagEmptyFormatter.php @@ -2,8 +2,8 @@ namespace Drupal\metatag\Plugin\Field\FieldFormatter; -use Drupal\Core\Field\FormatterBase; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Core\Field\FormatterBase; /** * Plugin implementation of the 'metatag_empty_formatter' formatter. diff --git a/web/modules/metatag/src/Plugin/Field/MetatagEntityFieldItemList.php b/web/modules/metatag/src/Plugin/Field/MetatagEntityFieldItemList.php index 022c34a071..9ef912b5f3 100644 --- a/web/modules/metatag/src/Plugin/Field/MetatagEntityFieldItemList.php +++ b/web/modules/metatag/src/Plugin/Field/MetatagEntityFieldItemList.php @@ -52,7 +52,7 @@ protected function computeValue() { $metatags_for_entity = $metatag_manager->tagsFromEntityWithDefaults($entity); // Trigger hook_metatags_alter(). - // Allow modules to override tags or the entity used for token replacements. + // Allow modules to override tags or entity used for token replacements. $context = [ 'entity' => &$entity, ]; diff --git a/web/modules/metatag/src/Plugin/diff/Field/MetatagFieldBuilder.php b/web/modules/metatag/src/Plugin/diff/Field/MetatagFieldBuilder.php index df74258255..4eec569aec 100644 --- a/web/modules/metatag/src/Plugin/diff/Field/MetatagFieldBuilder.php +++ b/web/modules/metatag/src/Plugin/diff/Field/MetatagFieldBuilder.php @@ -21,7 +21,7 @@ class MetatagFieldBuilder extends FieldDiffBuilderBase { /** * {@inheritdoc} */ - public function build(FieldItemListInterface $field_items) { + public function build(FieldItemListInterface $field_items): mixed { $result = []; // Every item from $field_items is of type FieldItemInterface. @@ -32,7 +32,7 @@ public function build(FieldItemListInterface $field_items) { // Metatag data store as serialize string. $metatag_data = metatag_data_decode($values['value']); - foreach ($metatag_data as $key => $value) { + foreach ($metatag_data as $value) { $result[$field_key][] = (string) $value; } } diff --git a/web/modules/metatag/src/Plugin/metatag/Tag/MetaNameBase.php b/web/modules/metatag/src/Plugin/metatag/Tag/MetaNameBase.php index b81386d5b6..f0c94c119e 100644 --- a/web/modules/metatag/src/Plugin/metatag/Tag/MetaNameBase.php +++ b/web/modules/metatag/src/Plugin/metatag/Tag/MetaNameBase.php @@ -17,8 +17,8 @@ /** * Each meta tag will extend this base. */ -abstract class MetaNameBase extends PluginBase {//implements ContainerFactoryPluginInterface { - +abstract class MetaNameBase extends PluginBase { + // Implements ContainerFactoryPluginInterface {. use MetatagSeparator; use StringTranslationTrait; @@ -431,7 +431,7 @@ public function form(array $element = []): array { if (!empty($trimlengths['metatag_maxlength_' . $this->id])) { $maxlength = intval($trimlengths['metatag_maxlength_' . $this->id]); if (is_numeric($maxlength) && $maxlength > 0) { - $form['#description'] .= ' ' . $this->t('This will be truncated to a maximum of %max characters after any tokens are processed.', array('%max' => $maxlength)); + $form['#description'] .= ' ' . $this->t('This will be truncated to a maximum of %max characters after any tokens are processed.', ['%max' => $maxlength]); // Optional support for the Maxlength module. if (\Drupal::moduleHandler()->moduleExists('maxlength')) { @@ -664,8 +664,8 @@ protected function trimValue($value): string { * * To skip testing the form field exists, return an empty array. * - * @return string - * An xpath-formatted string for matching a field on the form. + * @return array + * A list of xpath-formatted strings for matching a field on the form. */ public function getTestFormXpath(): array { // "Long" values use a text area on the form, so handle them automatically. diff --git a/web/modules/metatag/src/Plugin/metatag/Tag/Robots.php b/web/modules/metatag/src/Plugin/metatag/Tag/Robots.php index 6e0f930f37..652907aff7 100644 --- a/web/modules/metatag/src/Plugin/metatag/Tag/Robots.php +++ b/web/modules/metatag/src/Plugin/metatag/Tag/Robots.php @@ -199,7 +199,7 @@ public function getTestOutputValuesXpath(array $values): array { $new_values[] = substr($form_field_name, 7, -1); } // Newer strings are stored with the form name "robots-keyed[something]", - // so those need the substring to be extracted and then + // so those need the substring to be extracted and then. elseif (strpos($form_field_name, 'robots-keyed[') !== FALSE) { $new_values[] = substr($form_field_name, 13, -1) . ':' . $value; } diff --git a/web/modules/metatag/src/Plugin/migrate/process/d6/NodewordsEntities.php b/web/modules/metatag/src/Plugin/migrate/process/d6/NodewordsEntities.php index 388dcc2e09..167691bbfe 100644 --- a/web/modules/metatag/src/Plugin/migrate/process/d6/NodewordsEntities.php +++ b/web/modules/metatag/src/Plugin/migrate/process/d6/NodewordsEntities.php @@ -347,7 +347,6 @@ public function tagsMap(): array { // @todo 'video:series' => '', // @todo 'video:tag' => '', // @todo 'video:writer' => '', - // From metatag_opengraph_products.metatag.inc: // https://www.drupal.org/project/metatag/issues/2835925 'product:price:amount' => 'product_price_amount', @@ -376,7 +375,6 @@ public function tagsMap(): array { // @todo 'product:shipping_weight:units' => '', // @todo 'product:expiration_time' => '', // @todo 'product:condition' => '', - // Pinterest. // @todo '' => 'pinterest_id', // @todo '' => 'pinterest_description', @@ -385,7 +383,6 @@ public function tagsMap(): array { // @todo '' => 'pinterest_media', // @todo '' => 'pinterest_nopin', // @todo '' => 'pinterest_nosearch', - // From metatag_twitter_cards.metatag.inc: 'twitter:app:country' => 'twitter_cards_app_store_country', 'twitter:app:id:googleplay' => 'twitter_cards_app_id_googleplay', diff --git a/web/modules/metatag/src/Plugin/migrate/process/d7/MetatagEntities.php b/web/modules/metatag/src/Plugin/migrate/process/d7/MetatagEntities.php index 63dc57c23e..3f13c2b978 100644 --- a/web/modules/metatag/src/Plugin/migrate/process/d7/MetatagEntities.php +++ b/web/modules/metatag/src/Plugin/migrate/process/d7/MetatagEntities.php @@ -374,7 +374,6 @@ protected function tagsMap(): array { // @todo 'product:shipping_weight:units' => '', // @todo 'product:expiration_time' => '', // @todo 'product:condition' => '', - // Pinterest. // @todo '' => 'pinterest_id', // @todo '' => 'pinterest_description', @@ -383,7 +382,6 @@ protected function tagsMap(): array { // @todo '' => 'pinterest_media', // @todo '' => 'pinterest_nopin', // @todo '' => 'pinterest_nosearch', - // From metatag_twitter_cards.metatag.inc: 'twitter:app:country' => 'twitter_cards_app_store_country', 'twitter:app:id:googleplay' => 'twitter_cards_app_id_googleplay', @@ -453,7 +451,7 @@ protected function tagsMap(): array { * A Metatag values array. */ private function decodeValue($string): array { - $data = array(); + $data = []; // Serialized arrays from Metatag v1. if (substr($string, 0, 2) === 'a:') { diff --git a/web/modules/metatag/src/Plugin/migrate/source/d7/MetatagFieldDeriver.php b/web/modules/metatag/src/Plugin/migrate/source/d7/MetatagFieldDeriver.php index 1f4c0be00a..95499317cc 100644 --- a/web/modules/metatag/src/Plugin/migrate/source/d7/MetatagFieldDeriver.php +++ b/web/modules/metatag/src/Plugin/migrate/source/d7/MetatagFieldDeriver.php @@ -70,7 +70,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { ->fetchAllKeyed(0, 0); foreach ($entity_type_ids as $entity_type_id) { // Skip if the entity type is missing. - if (!($entity_type_definition = $this->entityTypeManager->getDefinition($entity_type_id, FALSE))) { + if (!$this->entityTypeManager->getDefinition($entity_type_id, FALSE)) { continue; } diff --git a/web/modules/metatag/src/TypedData/ComputedItemListTrait.php b/web/modules/metatag/src/TypedData/ComputedItemListTrait.php index 21cf66f079..504a17a1e8 100644 --- a/web/modules/metatag/src/TypedData/ComputedItemListTrait.php +++ b/web/modules/metatag/src/TypedData/ComputedItemListTrait.php @@ -40,6 +40,7 @@ protected function ensureComputedValue() { * This is run after the value has been computed at least once. * * @return bool + * State need for recomputing value. */ abstract protected function valueNeedsRecomputing(); diff --git a/web/modules/metatag/tests/fixtures/d8_metatag_v1.php b/web/modules/metatag/tests/fixtures/d8_metatag_v1.php index 996627dded..f26064bf80 100644 --- a/web/modules/metatag/tests/fixtures/d8_metatag_v1.php +++ b/web/modules/metatag/tests/fixtures/d8_metatag_v1.php @@ -7,14 +7,18 @@ /** * Notes on how to use this file. - * - When adding tests for changes to meta tags provided by a submodule, that - * submodule must be listed in the modules list below. - * - It is easiest to not add meta tag default configuration changes here that - * depend upon submodules, it works better to make those changes in the - * appropriate update script. - * - There is currently only one Metatag field defined, on the Article content - * type. - * - Each meta tag value to be tested is added to the fields lower down. + * + * When adding tests for changes to meta tags provided by a submodule, that + * submodule must be listed in the modules list below. + * + * It is easiest to not add meta tag default configuration changes here that + * depend upon submodules, it works better to make those changes in the + * appropriate update script. + * + * There is currently only one Metatag field defined, on the Article content + * type. + * + * Each meta tag value to be tested is added to the fields lower down. * * @todo Finish documenting this file. * @todo Expand to handle multiple languages. @@ -24,15 +28,21 @@ * @todo Work out a better way of handling field specification changes. */ -use Drupal\Core\Database\Database; use Drupal\Component\Serialization\Yaml; use Drupal\Component\Uuid\Php as Uuid; +use Drupal\Core\Database\Database; $config_fields = ['collection', 'name', 'data']; $keyvalue_fields = ['collection', 'name', 'value']; $connection = Database::getConnection(); +// Classes that are allowed in serialized arrays. +$allowed_classes = [ + 'Drupal\Core\Field\BaseFieldDefinition', + 'Drupal\field\Entity\FieldStorageConfig', +]; + // Enable Metatag (and Token). $extensions = $connection->select('config') ->fields('config', ['data']) @@ -40,7 +50,7 @@ ->condition('name', 'core.extension') ->execute() ->fetchField(); -$extensions = unserialize($extensions, ['allowed_classes' => []]); +$extensions = unserialize($extensions, ['allowed_classes' => FALSE]); $extensions['module']['metatag'] = 0; /** * Additional submodules must be added here if their meta tags are being tested. @@ -76,7 +86,7 @@ ->condition('name', 'existing_updates') ->execute() ->fetchField(); -$data = unserialize($data, ['allowed_classes' => []]); +$data = unserialize($data, ['allowed_classes' => FALSE]); $data[] = 'metatag_post_update_convert_author_config'; $data[] = 'metatag_post_update_convert_author_data'; $data[] = 'metatag_post_update_convert_mask_icon_to_array_values'; @@ -376,7 +386,7 @@ ->condition('name', 'node') ->execute() ->fetchField(); -$key_value = unserialize($key_value, ['allowed_classes' => []]); +$key_value = unserialize($key_value, ['allowed_classes' => FALSE]); $key_value['field_meta_tags'] = [ 'type' => 'metatag', 'bundles' => [ @@ -395,19 +405,20 @@ // messing with a serialized object. $key_value = $connection->select('key_value') ->fields('key_value', ['value']) - ->condition('collection', 'entity.definitions.installed') - ->condition('name', 'node.field_storage_definitions') + ->condition('collection', 'entity.definitions.installed') + ->condition('name', 'node.field_storage_definitions') ->execute() ->fetchField(); -$key_value = unserialize($key_value, ['allowed_classes' => [ - 'Drupal\Core\Field\BaseFieldDefinition', - 'Drupal\field\Entity\FieldStorageConfig', -]]); -$key_value['field_meta_tags'] = unserialize('O:38:"Drupal\field\Entity\FieldStorageConfig":35:{s:5:"' . "\0" . '*' . "\0" . 'id";s:20:"node.field_meta_tags";s:13:"' . "\0" . '*' . "\0" . 'field_name";s:15:"field_meta_tags";s:14:"' . "\0" . '*' . "\0" . 'entity_type";s:4:"node";s:7:"' . "\0" . '*' . "\0" . 'type";s:7:"metatag";s:9:"' . "\0" . '*' . "\0" . 'module";s:7:"metatag";s:11:"' . "\0" . '*' . "\0" . 'settings";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'cardinality";i:1;s:15:"' . "\0" . '*' . "\0" . 'translatable";b:1;s:9:"' . "\0" . '*' . "\0" . 'locked";b:0;s:25:"' . "\0" . '*' . "\0" . 'persist_with_no_fields";b:0;s:14:"custom_storage";b:0;s:10:"' . "\0" . '*' . "\0" . 'indexes";a:0:{}s:10:"' . "\0" . '*' . "\0" . 'deleted";b:0;s:13:"' . "\0" . '*' . "\0" . 'originalId";s:20:"node.field_meta_tags";s:9:"' . "\0" . '*' . "\0" . 'status";b:1;s:7:"' . "\0" . '*' . "\0" . 'uuid";s:36:"6aaab457-3728-4319-afa3-938e753ed342";s:11:"' . "\0" . '*' . "\0" . 'langcode";s:2:"en";s:23:"' . "\0" . '*' . "\0" . 'third_party_settings";a:0:{}s:8:"' . "\0" . '*' . "\0" . '_core";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'trustedData";b:0;s:15:"' . "\0" . '*' . "\0" . 'entityTypeId";s:20:"field_storage_config";s:15:"' . "\0" . '*' . "\0" . 'enforceIsNew";N;s:12:"' . "\0" . '*' . "\0" . 'typedData";N;s:16:"' . "\0" . '*' . "\0" . 'cacheContexts";a:0:{}s:12:"' . "\0" . '*' . "\0" . 'cacheTags";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'cacheMaxAge";i:-1;s:14:"' . "\0" . '*' . "\0" . '_serviceIds";a:0:{}s:18:"' . "\0" . '*' . "\0" . '_entityStorages";a:0:{}s:15:"' . "\0" . '*' . "\0" . 'dependencies";a:1:{s:6:"module";a:2:{i:0;s:7:"metatag";i:1;s:4:"node";}}s:12:"' . "\0" . '*' . "\0" . 'isSyncing";b:0;s:18:"cardinality_number";i:1;s:6:"submit";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"' . "\0" . '*' . "\0" . 'string";s:19:"Save field settings";s:12:"' . "\0" . '*' . "\0" . 'arguments";a:0:{}s:10:"' . "\0" . '*' . "\0" . 'options";a:0:{}}s:13:"form_build_id";s:48:"form-LK9HeARuUzcwIVvCAA4jG2MscwGjLAUJ9GLYxuzSo7o";s:10:"form_token";s:43:"eengi9MkLSqT-YFMEKD18fJ6cOvVyS_XRq1He7qhq4s";s:7:"form_id";s:30:"field_storage_config_edit_form";}}'); +$key_value = unserialize($key_value, [ + 'allowed_classes' => $allowed_classes, +]); +$key_value['field_meta_tags'] = unserialize('O:38:"Drupal\field\Entity\FieldStorageConfig":35:{s:5:"' . "\0" . '*' . "\0" . 'id";s:20:"node.field_meta_tags";s:13:"' . "\0" . '*' . "\0" . 'field_name";s:15:"field_meta_tags";s:14:"' . "\0" . '*' . "\0" . 'entity_type";s:4:"node";s:7:"' . "\0" . '*' . "\0" . 'type";s:7:"metatag";s:9:"' . "\0" . '*' . "\0" . 'module";s:7:"metatag";s:11:"' . "\0" . '*' . "\0" . 'settings";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'cardinality";i:1;s:15:"' . "\0" . '*' . "\0" . 'translatable";b:1;s:9:"' . "\0" . '*' . "\0" . 'locked";b:0;s:25:"' . "\0" . '*' . "\0" . 'persist_with_no_fields";b:0;s:14:"custom_storage";b:0;s:10:"' . "\0" . '*' . "\0" . 'indexes";a:0:{}s:10:"' . "\0" . '*' . "\0" . 'deleted";b:0;s:13:"' . "\0" . '*' . "\0" . 'originalId";s:20:"node.field_meta_tags";s:9:"' . "\0" . '*' . "\0" . 'status";b:1;s:7:"' . "\0" . '*' . "\0" . 'uuid";s:36:"6aaab457-3728-4319-afa3-938e753ed342";s:11:"' . "\0" . '*' . "\0" . 'langcode";s:2:"en";s:23:"' . "\0" . '*' . "\0" . 'third_party_settings";a:0:{}s:8:"' . "\0" . '*' . "\0" . '_core";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'trustedData";b:0;s:15:"' . "\0" . '*' . "\0" . 'entityTypeId";s:20:"field_storage_config";s:15:"' . "\0" . '*' . "\0" . 'enforceIsNew";N;s:12:"' . "\0" . '*' . "\0" . 'typedData";N;s:16:"' . "\0" . '*' . "\0" . 'cacheContexts";a:0:{}s:12:"' . "\0" . '*' . "\0" . 'cacheTags";a:0:{}s:14:"' . "\0" . '*' . "\0" . 'cacheMaxAge";i:-1;s:14:"' . "\0" . '*' . "\0" . '_serviceIds";a:0:{}s:18:"' . "\0" . '*' . "\0" . '_entityStorages";a:0:{}s:15:"' . "\0" . '*' . "\0" . 'dependencies";a:1:{s:6:"module";a:2:{i:0;s:7:"metatag";i:1;s:4:"node";}}s:12:"' . "\0" . '*' . "\0" . 'isSyncing";b:0;s:18:"cardinality_number";i:1;s:6:"submit";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"' . "\0" . '*' . "\0" . 'string";s:19:"Save field settings";s:12:"' . "\0" . '*' . "\0" . 'arguments";a:0:{}s:10:"' . "\0" . '*' . "\0" . 'options";a:0:{}}s:13:"form_build_id";s:48:"form-LK9HeARuUzcwIVvCAA4jG2MscwGjLAUJ9GLYxuzSo7o";s:10:"form_token";s:43:"eengi9MkLSqT-YFMEKD18fJ6cOvVyS_XRq1He7qhq4s";s:7:"form_id";s:30:"field_storage_config_edit_form";}}', [ + 'allowed_classes' => $allowed_classes, +]); $connection->update('key_value') ->fields(['value' => serialize($key_value)]) - ->condition('collection', 'entity.definitions.installed') - ->condition('name', 'node.field_storage_definitions') + ->condition('collection', 'entity.definitions.installed') + ->condition('name', 'node.field_storage_definitions') ->execute(); $connection->schema()->createTable('node__field_meta_tags', [ @@ -535,262 +546,262 @@ // Create a node with values. // @todo Create a few more. $connection->insert('comment_entity_statistics') -->fields([ - 'entity_id', - 'entity_type', - 'field_name', - 'cid', - 'last_comment_timestamp', - 'last_comment_name', - 'last_comment_uid', - 'comment_count', -]) -->values([ - 'entity_id' => '1', - 'entity_type' => 'node', - 'field_name' => 'comment', - 'cid' => '0', - 'last_comment_timestamp' => '1669762329', - 'last_comment_name' => NULL, - 'last_comment_uid' => '1', - 'comment_count' => '0', -]) -->execute(); + ->fields([ + 'entity_id', + 'entity_type', + 'field_name', + 'cid', + 'last_comment_timestamp', + 'last_comment_name', + 'last_comment_uid', + 'comment_count', + ]) + ->values([ + 'entity_id' => '1', + 'entity_type' => 'node', + 'field_name' => 'comment', + 'cid' => '0', + 'last_comment_timestamp' => '1669762329', + 'last_comment_name' => NULL, + 'last_comment_uid' => '1', + 'comment_count' => '0', + ]) + ->execute(); $connection->insert('node') -->fields([ - 'nid', - 'vid', - 'type', - 'uuid', - 'langcode', -]) -->values([ - 'nid' => '1', - 'vid' => '1', - 'type' => 'article', - 'uuid' => 'fc2c9449-df04-4d41-beea-5a5b39bf6b89', - 'langcode' => 'en', -]) -->execute(); + ->fields([ + 'nid', + 'vid', + 'type', + 'uuid', + 'langcode', + ]) + ->values([ + 'nid' => '1', + 'vid' => '1', + 'type' => 'article', + 'uuid' => 'fc2c9449-df04-4d41-beea-5a5b39bf6b89', + 'langcode' => 'en', + ]) + ->execute(); $connection->insert('node__comment') -->fields([ - 'bundle', - 'deleted', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'comment_status', -]) -->values([ - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '1', - 'revision_id' => '1', - 'langcode' => 'en', - 'delta' => '0', - 'comment_status' => '2', -]) -->execute(); + ->fields([ + 'bundle', + 'deleted', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_status', + ]) + ->values([ + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '1', + 'revision_id' => '1', + 'langcode' => 'en', + 'delta' => '0', + 'comment_status' => '2', + ]) + ->execute(); $connection->insert('node__field_meta_tags') -->fields([ - 'bundle', - 'deleted', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'field_meta_tags_value', -]) -->values([ - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '1', - 'revision_id' => '1', - 'langcode' => 'en', - 'delta' => '0', + ->fields([ + 'bundle', + 'deleted', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'field_meta_tags_value', + ]) + ->values([ + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '1', + 'revision_id' => '1', + 'langcode' => 'en', + 'delta' => '0', /** * Expand this list as new meta tags need to be tested. */ - 'field_meta_tags_value' => serialize([ - 'description' => 'This is a Metatag v1 meta tag.', - 'title' => 'Testing | [site:name]', - 'robots' => 'index, nofollow, noarchive', + 'field_meta_tags_value' => serialize([ + 'description' => 'This is a Metatag v1 meta tag.', + 'title' => 'Testing | [site:name]', + 'robots' => 'index, nofollow, noarchive', // For #3065441. - 'google_plus_author' => 'GooglePlus Author tag test value for #3065441.', - 'google_plus_description' => 'GooglePlus Description tag test value for #3065441.', - 'google_plus_name' => 'GooglePlus Name tag test value for #3065441.', - 'google_plus_publisher' => 'GooglePlus Publisher tag test value for #3065441.', + 'google_plus_author' => 'GooglePlus Author tag test value for #3065441.', + 'google_plus_description' => 'GooglePlus Description tag test value for #3065441.', + 'google_plus_name' => 'GooglePlus Name tag test value for #3065441.', + 'google_plus_publisher' => 'GooglePlus Publisher tag test value for #3065441.', // For #2973351. - 'news_keywords' => 'News Keywords tag test value for #2973351.', - 'standout' => 'Standout tag test value for #2973351.', + 'news_keywords' => 'News Keywords tag test value for #2973351.', + 'standout' => 'Standout tag test value for #2973351.', // For #3132065. - 'twitter_cards_data1' => 'Data1 tag test for #3132065.', - 'twitter_cards_data2' => 'Data2 tag test for #3132065.', - 'twitter_cards_dnt' => 'Do Not Track tag test for #3132065.', - 'twitter_cards_gallery_image0' => 'Gallery Image0 tag test for #3132065.', - 'twitter_cards_gallery_image1' => 'Gallery Image1 tag test for #3132065.', - 'twitter_cards_gallery_image2' => 'Gallery Image2 tag test for #3132065.', - 'twitter_cards_gallery_image3' => 'Gallery Image3 tag test for #3132065.', - 'twitter_cards_image_height' => 'Image Height tag test for #3132065.', - 'twitter_cards_image_width' => 'Image Width tag test for #3132065.', - 'twitter_cards_label1' => 'Label1 tag test for #3132065.', - 'twitter_cards_label2' => 'Label2 tag test for #3132065.', - 'twitter_cards_page_url' => 'Page URL tag test for #3132065.', + 'twitter_cards_data1' => 'Data1 tag test for #3132065.', + 'twitter_cards_data2' => 'Data2 tag test for #3132065.', + 'twitter_cards_dnt' => 'Do Not Track tag test for #3132065.', + 'twitter_cards_gallery_image0' => 'Gallery Image0 tag test for #3132065.', + 'twitter_cards_gallery_image1' => 'Gallery Image1 tag test for #3132065.', + 'twitter_cards_gallery_image2' => 'Gallery Image2 tag test for #3132065.', + 'twitter_cards_gallery_image3' => 'Gallery Image3 tag test for #3132065.', + 'twitter_cards_image_height' => 'Image Height tag test for #3132065.', + 'twitter_cards_image_width' => 'Image Width tag test for #3132065.', + 'twitter_cards_label1' => 'Label1 tag test for #3132065.', + 'twitter_cards_label2' => 'Label2 tag test for #3132065.', + 'twitter_cards_page_url' => 'Page URL tag test for #3132065.', // For #3217263. - 'content_language' => 'Content Language tag test for #3217263.', + 'content_language' => 'Content Language tag test for #3217263.', // For #3132062. - 'twitter_cards_type' => 'gallery', + 'twitter_cards_type' => 'gallery', // For #3361816. - 'google_rating' => 'Google Rating tag test for #3361816', - ]), -]) -->execute(); + 'google_rating' => 'Google Rating tag test for #3361816', + ]), + ]) + ->execute(); $connection->insert('node_field_data') -->fields([ - 'nid', - 'vid', - 'type', - 'title', - 'created', - 'changed', - 'promote', - 'sticky', - 'revision_translation_affected', - 'default_langcode', - 'langcode', - 'status', - 'uid', -]) -->values([ - 'nid' => '1', - 'vid' => '1', - 'type' => 'article', - 'title' => 'Testing', - 'created' => '1669762311', - 'changed' => '1669762329', - 'promote' => '1', - 'sticky' => '0', - 'revision_translation_affected' => '1', - 'default_langcode' => '1', - 'langcode' => 'en', - 'status' => '1', - 'uid' => '1', -]) -->execute(); + ->fields([ + 'nid', + 'vid', + 'type', + 'title', + 'created', + 'changed', + 'promote', + 'sticky', + 'revision_translation_affected', + 'default_langcode', + 'langcode', + 'status', + 'uid', + ]) + ->values([ + 'nid' => '1', + 'vid' => '1', + 'type' => 'article', + 'title' => 'Testing', + 'created' => '1669762311', + 'changed' => '1669762329', + 'promote' => '1', + 'sticky' => '0', + 'revision_translation_affected' => '1', + 'default_langcode' => '1', + 'langcode' => 'en', + 'status' => '1', + 'uid' => '1', + ]) + ->execute(); $connection->insert('node_field_revision') -->fields([ - 'nid', - 'vid', - 'title', - 'created', - 'changed', - 'promote', - 'sticky', - 'revision_translation_affected', - 'default_langcode', - 'langcode', - 'status', - 'uid', -]) -->values([ - 'nid' => '1', - 'vid' => '1', - 'title' => 'Testing', - 'created' => '1669762311', - 'changed' => '1669762329', - 'promote' => '1', - 'sticky' => '0', - 'revision_translation_affected' => '1', - 'default_langcode' => '1', - 'langcode' => 'en', - 'status' => '1', - 'uid' => '1', -]) -->execute(); + ->fields([ + 'nid', + 'vid', + 'title', + 'created', + 'changed', + 'promote', + 'sticky', + 'revision_translation_affected', + 'default_langcode', + 'langcode', + 'status', + 'uid', + ]) + ->values([ + 'nid' => '1', + 'vid' => '1', + 'title' => 'Testing', + 'created' => '1669762311', + 'changed' => '1669762329', + 'promote' => '1', + 'sticky' => '0', + 'revision_translation_affected' => '1', + 'default_langcode' => '1', + 'langcode' => 'en', + 'status' => '1', + 'uid' => '1', + ]) + ->execute(); $connection->insert('node_revision__comment') -->fields([ - 'bundle', - 'deleted', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'comment_status', -]) -->values([ - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '1', - 'revision_id' => '1', - 'langcode' => 'en', - 'delta' => '0', - 'comment_status' => '2', -]) -->execute(); + ->fields([ + 'bundle', + 'deleted', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'comment_status', + ]) + ->values([ + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '1', + 'revision_id' => '1', + 'langcode' => 'en', + 'delta' => '0', + 'comment_status' => '2', + ]) + ->execute(); $connection->insert('node_revision__field_meta_tags') -->fields([ - 'bundle', - 'deleted', - 'entity_id', - 'revision_id', - 'langcode', - 'delta', - 'field_meta_tags_value', -]) -->values([ - 'bundle' => 'article', - 'deleted' => '0', - 'entity_id' => '1', - 'revision_id' => '1', - 'langcode' => 'en', - 'delta' => '0', + ->fields([ + 'bundle', + 'deleted', + 'entity_id', + 'revision_id', + 'langcode', + 'delta', + 'field_meta_tags_value', + ]) + ->values([ + 'bundle' => 'article', + 'deleted' => '0', + 'entity_id' => '1', + 'revision_id' => '1', + 'langcode' => 'en', + 'delta' => '0', /** * Expand this list as new meta tags need to be tested. */ - 'field_meta_tags_value' => serialize([ - 'description' => 'This is a Metatag v1 meta tag.', - 'title' => 'Testing | [site:name]', - 'robots' => 'index, nofollow, noarchive', + 'field_meta_tags_value' => serialize([ + 'description' => 'This is a Metatag v1 meta tag.', + 'title' => 'Testing | [site:name]', + 'robots' => 'index, nofollow, noarchive', // For #3065441. - 'google_plus_author' => 'GooglePlus Author tag test value for #3065441.', - 'google_plus_description' => 'GooglePlus Description tag test value for #3065441.', - 'google_plus_name' => 'GooglePlus Name tag test value for #3065441.', - 'google_plus_publisher' => 'GooglePlus Publisher tag test value for #3065441.', + 'google_plus_author' => 'GooglePlus Author tag test value for #3065441.', + 'google_plus_description' => 'GooglePlus Description tag test value for #3065441.', + 'google_plus_name' => 'GooglePlus Name tag test value for #3065441.', + 'google_plus_publisher' => 'GooglePlus Publisher tag test value for #3065441.', // For #2973351. - 'news_keywords' => 'News Keywords tag test value for #2973351.', - 'standout' => 'Standout tag test value for #2973351.', + 'news_keywords' => 'News Keywords tag test value for #2973351.', + 'standout' => 'Standout tag test value for #2973351.', // For #3132065. - 'twitter_cards_data1' => 'Data1 tag test for #3132065.', - 'twitter_cards_data2' => 'Data2 tag test for #3132065.', - 'twitter_cards_dnt' => 'Do Not Track tag test for #3132065.', - 'twitter_cards_gallery_image0' => 'Gallery Image0 tag test for #3132065.', - 'twitter_cards_gallery_image1' => 'Gallery Image1 tag test for #3132065.', - 'twitter_cards_gallery_image2' => 'Gallery Image2 tag test for #3132065.', - 'twitter_cards_gallery_image3' => 'Gallery Image3 tag test for #3132065.', - 'twitter_cards_image_height' => 'Image Height tag test for #3132065.', - 'twitter_cards_image_width' => 'Image Width tag test for #3132065.', - 'twitter_cards_label1' => 'Label1 tag test for #3132065.', - 'twitter_cards_label2' => 'Label2 tag test for #3132065.', - 'twitter_cards_page_url' => 'Page URL tag test for #3132065.', + 'twitter_cards_data1' => 'Data1 tag test for #3132065.', + 'twitter_cards_data2' => 'Data2 tag test for #3132065.', + 'twitter_cards_dnt' => 'Do Not Track tag test for #3132065.', + 'twitter_cards_gallery_image0' => 'Gallery Image0 tag test for #3132065.', + 'twitter_cards_gallery_image1' => 'Gallery Image1 tag test for #3132065.', + 'twitter_cards_gallery_image2' => 'Gallery Image2 tag test for #3132065.', + 'twitter_cards_gallery_image3' => 'Gallery Image3 tag test for #3132065.', + 'twitter_cards_image_height' => 'Image Height tag test for #3132065.', + 'twitter_cards_image_width' => 'Image Width tag test for #3132065.', + 'twitter_cards_label1' => 'Label1 tag test for #3132065.', + 'twitter_cards_label2' => 'Label2 tag test for #3132065.', + 'twitter_cards_page_url' => 'Page URL tag test for #3132065.', // For #3217263. - 'content_language' => 'Content Language tag test for #3217263.', + 'content_language' => 'Content Language tag test for #3217263.', // For #3132062. - 'twitter_cards_type' => 'gallery', + 'twitter_cards_type' => 'gallery', // For #3361816. - 'google_rating' => 'Google Rating tag test for #3361816', - ]), -]) -->execute(); + 'google_rating' => 'Google Rating tag test for #3361816', + ]), + ]) + ->execute(); diff --git a/web/modules/metatag/tests/modules/metatag_test_custom_route/metatag_test_custom_route.info.yml b/web/modules/metatag/tests/modules/metatag_test_custom_route/metatag_test_custom_route.info.yml index c00d4a736e..d881fa5c58 100644 --- a/web/modules/metatag/tests/modules/metatag_test_custom_route/metatag_test_custom_route.info.yml +++ b/web/modules/metatag/tests/modules/metatag_test_custom_route/metatag_test_custom_route.info.yml @@ -5,7 +5,7 @@ package: Testing dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/tests/modules/metatag_test_custom_route/src/Controller/MetatagTestCustomRouteController.php b/web/modules/metatag/tests/modules/metatag_test_custom_route/src/Controller/MetatagTestCustomRouteController.php index 24a537cd1c..98769a183f 100644 --- a/web/modules/metatag/tests/modules/metatag_test_custom_route/src/Controller/MetatagTestCustomRouteController.php +++ b/web/modules/metatag/tests/modules/metatag_test_custom_route/src/Controller/MetatagTestCustomRouteController.php @@ -14,7 +14,7 @@ class MetatagTestCustomRouteController extends ControllerBase { */ public function test() { $render = [ - '#markup' => $this->t('<p>Hello world!</p>'), + '#markup' => '<p>Hello world!</p>', ]; return $render; diff --git a/web/modules/metatag/tests/modules/metatag_test_integration/metatag_test_integration.info.yml b/web/modules/metatag/tests/modules/metatag_test_integration/metatag_test_integration.info.yml index 0063c74c48..dec5cc84de 100644 --- a/web/modules/metatag/tests/modules/metatag_test_integration/metatag_test_integration.info.yml +++ b/web/modules/metatag/tests/modules/metatag_test_integration/metatag_test_integration.info.yml @@ -5,7 +5,7 @@ package: Testing dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/tests/modules/metatag_test_tag/metatag_test_tag.info.yml b/web/modules/metatag/tests/modules/metatag_test_tag/metatag_test_tag.info.yml index 0f90fed6fc..580613c240 100644 --- a/web/modules/metatag/tests/modules/metatag_test_tag/metatag_test_tag.info.yml +++ b/web/modules/metatag/tests/modules/metatag_test_tag/metatag_test_tag.info.yml @@ -5,7 +5,7 @@ package: Testing dependencies: - metatag:metatag -# Information added by Drupal.org packaging script on 2023-06-27 -version: '2.0.0' +# Information added by Drupal.org packaging script on 2024-08-05 +version: '2.0.2' project: 'metatag' -datestamp: 1687856985 +datestamp: 1722869775 diff --git a/web/modules/metatag/tests/src/Functional/DefaultTags.php b/web/modules/metatag/tests/src/Functional/DefaultTagsTest.php similarity index 99% rename from web/modules/metatag/tests/src/Functional/DefaultTags.php rename to web/modules/metatag/tests/src/Functional/DefaultTagsTest.php index 6573aa457b..6a4e8f33cd 100644 --- a/web/modules/metatag/tests/src/Functional/DefaultTags.php +++ b/web/modules/metatag/tests/src/Functional/DefaultTagsTest.php @@ -9,7 +9,7 @@ * * @group metatag */ -class DefaultTags extends BrowserTestBase { +class DefaultTagsTest extends BrowserTestBase { // Contains helper methods. use MetatagHelperTrait; diff --git a/web/modules/metatag/tests/src/Functional/EnsureDevelWebProfilerWorks.php b/web/modules/metatag/tests/src/Functional/EnsureDevelWebProfilerWorks.php deleted file mode 100644 index 015f810a38..0000000000 --- a/web/modules/metatag/tests/src/Functional/EnsureDevelWebProfilerWorks.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Drupal\Tests\metatag\Functional; - -/** - * Verify that enabling WebProfiler won't cause the site to blow up. - * - * @group metatag - */ -class EnsureDevelWebProfilerWorks extends EnsureDevelWorks { - - /** - * {@inheritdoc} - */ - protected static $modules = [ - // Modules for core functionality. - 'node', - 'field', - 'field_ui', - 'user', - - // Contrib dependencies. - 'token', - - // This module. - 'metatag', - - // Use the custom route to verify the site works. - 'metatag_test_custom_route', - - // The modules to test. - 'devel', - 'webprofiler', - ]; - -} diff --git a/web/modules/metatag/tests/src/Functional/EnsureDevelWorks.php b/web/modules/metatag/tests/src/Functional/EnsureDevelWorks.php deleted file mode 100644 index 9a492900d6..0000000000 --- a/web/modules/metatag/tests/src/Functional/EnsureDevelWorks.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -namespace Drupal\Tests\metatag\Functional; - -use Drupal\Tests\BrowserTestBase; - -/** - * Verify that enabling Devel won't cause the site to blow up. - * - * @group metatag - */ -class EnsureDevelWorks extends BrowserTestBase { - - // Contains helper methods. - use MetatagHelperTrait; - - /** - * {@inheritdoc} - */ - protected $defaultTheme = 'stark'; - - /** - * {@inheritdoc} - */ - protected static $modules = [ - // Modules for core functionality. - 'node', - 'field', - 'field_ui', - 'user', - - // Contrib dependencies. - 'token', - - // This module. - 'metatag', - - // Use the custom route to verify the site works. - 'metatag_test_custom_route', - - // The modules to test. - 'devel', - ]; - - /** - * Load the custom route, make sure something is output. - */ - public function testCustomRoute() { - $this->drupalGet('metatag_test_custom_route'); - $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->pageTextContains('Hello world!'); - } - - /** - * Make sure that the system still works when some example content exists. - */ - public function testNode() { - $node = $this->createContentTypeNode(); - $this->drupalGet($node->toUrl()); - $this->assertSession()->statusCodeEquals(200); - } - -} diff --git a/web/modules/metatag/tests/src/Functional/EntityTestMetatagTest.php b/web/modules/metatag/tests/src/Functional/EntityTestMetatagTest.php index fd964fee76..ae106296fe 100644 --- a/web/modules/metatag/tests/src/Functional/EntityTestMetatagTest.php +++ b/web/modules/metatag/tests/src/Functional/EntityTestMetatagTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\metatag\Functional; use Drupal\Component\Serialization\Json; -use Drupal\Core\Cache\Cache; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; @@ -93,7 +92,7 @@ protected function createEntity() { 'type' => 'entity_test', 'field_metatag' => [ 'value' => [ - 'description' => 'This is a description for use in Search Engines' + 'description' => 'This is a description for use in Search Engines', ], ], ]); diff --git a/web/modules/metatag/tests/src/Functional/MaintenanceMode.php b/web/modules/metatag/tests/src/Functional/MaintenanceModeTest.php similarity index 96% rename from web/modules/metatag/tests/src/Functional/MaintenanceMode.php rename to web/modules/metatag/tests/src/Functional/MaintenanceModeTest.php index 1bd3cd8f0e..ad24a72967 100644 --- a/web/modules/metatag/tests/src/Functional/MaintenanceMode.php +++ b/web/modules/metatag/tests/src/Functional/MaintenanceModeTest.php @@ -10,7 +10,7 @@ * * @group metatag */ -class MaintenanceMode extends BrowserTestBase { +class MaintenanceModeTest extends BrowserTestBase { // Contains helper methods. use MetatagHelperTrait; diff --git a/web/modules/metatag/tests/src/Functional/MetatagAdminTest.php b/web/modules/metatag/tests/src/Functional/MetatagAdminTest.php index 10c26d385f..8ebf28ff15 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagAdminTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagAdminTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\metatag\Functional; -use Drupal\metatag\MetatagManager; use Drupal\metatag\Entity\MetatagDefaults; +use Drupal\metatag\MetatagManager; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** * Tests the Metatag administration. @@ -14,8 +14,8 @@ */ class MetatagAdminTest extends BrowserTestBase { + use FieldUiTestTrait; use MetatagHelperTrait; - use StringTranslationTrait; /** * {@inheritdoc} @@ -127,7 +127,7 @@ public function testDefaults() { drupal_flush_all_caches(); $this->drupalGet('hit-a-404'); $session->statusCodeEquals(404); - foreach ($values as $metatag => $value) { + foreach ($values as $value) { $processed_value = \Drupal::token()->replace($value); $session->responseContains($processed_value); } @@ -278,7 +278,7 @@ public function testOverrides() { // Create a test node. $node = $this->drupalCreateNode([ - 'title' => $this->t('Hello, world!'), + 'title' => 'Hello, world!', 'type' => 'article', ]); @@ -318,7 +318,7 @@ public function testOverrides() { // performant than creating a node for every set of assertions. // @see BookTest::testDelete() $node = $this->drupalCreateNode([ - 'title' => $this->t('Hello, world!'), + 'title' => 'Hello, world!', 'type' => 'article', ]); $this->drupalGet('node/' . $node->id()); @@ -340,7 +340,7 @@ public function testOverrides() { // Confirm the fields load properly on the node/add/article page. $node = $this->drupalCreateNode([ - 'title' => $this->t('Hello, world!'), + 'title' => 'Hello, world!', 'type' => 'article', ]); $this->drupalGet('node/' . $node->id()); @@ -379,19 +379,8 @@ public function testEntityDefaultInheritence() { $this->drupalLogin($account); // Add a Metatag field to the Article content type. - $this->drupalGet('admin/structure/types/manage/article/fields/add-field'); $session = $this->assertSession(); - $session->statusCodeEquals(200); - $edit = [ - 'new_storage_type' => 'metatag', - 'label' => 'Meta tags', - 'field_name' => 'meta_tags', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $this->submitForm([], $this->t('Save field settings')); - $session->pageTextContains(strip_tags('Updated field Meta tags field settings.')); - $this->submitForm([], $this->t('Save settings')); - $session->pageTextContains(strip_tags('Saved Meta tags configuration.')); + $this->fieldUIAddNewField('admin/structure/types/manage/article', 'meta_tags', 'Metatag', 'metatag'); // Try creating an article, confirm the fields are present. This should be // the node default values that are shown. diff --git a/web/modules/metatag/tests/src/Functional/MetatagTagTypesTest.php b/web/modules/metatag/tests/src/Functional/MetatagApiTest.php similarity index 78% rename from web/modules/metatag/tests/src/Functional/MetatagTagTypesTest.php rename to web/modules/metatag/tests/src/Functional/MetatagApiTest.php index 9975c7330e..459f4a62ba 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagTagTypesTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagApiTest.php @@ -3,16 +3,16 @@ namespace Drupal\Tests\metatag\Functional; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** - * Verify that different meta tag API options are supported. + * Verify that different API options are supported. * * @group metatag */ class MetatagApiTest extends BrowserTestBase { - use StringTranslationTrait; + use FieldUiTestTrait; /** * Profile to use. @@ -40,9 +40,6 @@ class MetatagApiTest extends BrowserTestBase { // Needed for the field UI testing. 'field_ui', - // Needed for the basic entity testing. - 'entity_test', - // Needed to verify that nothing is broken for unsupported entities. 'contact', @@ -68,10 +65,10 @@ class MetatagApiTest extends BrowserTestBase { */ protected $permissions = [ 'access administration pages', - 'view test entity', - 'administer entity_test fields', - 'administer entity_test content', 'administer meta tags', + // 'view test entity', + // 'administer entity_test fields', + // 'administer entity_test content', ]; /** @@ -83,17 +80,14 @@ protected function setUp(): void { $this->drupalLogin($this->adminUser); // Add a metatag field to the entity type test_entity. - $this->drupalGet('entity_test/structure/entity_test/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $this->submitForm([], $this->t('Save field settings')); - $this->container->get('entity_field.manager') - ->clearCachedFieldDefinitions(); + // @todo Work out a better solution for this, as the entity type is not + // actually used. + // @code + // phpcs:ignore + // $this->fieldUIAddNewField('admin/structure/types/manage/entity_test', 'metatag', 'Metatag', 'metatag'); + // $this->container->get('entity_field.manager') + // ->clearCachedFieldDefinitions(); + // @endcode } /** @@ -175,26 +169,32 @@ public function testContactForm() { */ public function todoTestUrl() { // @code - // $save_label = (floatval(\Drupal::VERSION) <= 8.3) ? $this->t('Save and publish') : $this->t('Save'); + // $save_label = (floatval(\Drupal::VERSION) <= 8.3) ? + // 'Save and publish' : 'Save'; // // Tests meta tags with URLs work. // $this->drupalGet($this->entity_add_path); // $this->assertSession()->statusCodeEquals(200); + // $url_test = 'https://example.com/foo.html'; // $edit = [ - // 'name[0][value]' => 'UrlTags', - // 'user_id[0][target_id]' => 'foo (' . $this->adminUser->id() . ')', - // 'field_metatag[0][advanced][original_source]' => 'https://example.com/foo.html', + // 'name[0][value]' => 'UrlTags', + // 'user_id[0][target_id]' => 'foo (' . $this->adminUser->id() . ')', + // 'field_metatag[0][advanced][original_source]' => $url_test, // ]; // $this->submitForm($edit, $save_label); // $entities = entity_load_multiple_by_properties('entity_test', [ - // 'name' => 'UrlTags', + // 'name' => 'UrlTags', // ]); // $this->assertEquals(count($entities), 1, 'Entity was saved'); // $entity = reset($entities); // $this->drupalGet($this->entity_base_path . '/' . $entity->id()); // $this->assertSession()->statusCodeEquals(200); // $elements = $this->cssSelect("meta[name='original-source']"); - // $this->assertTrue(count($elements) === 1, 'Found original source metatag from defaults'); - // $this->assertEquals($edit['field_metatag[0][advanced][original_source]'], (string) $elements[0]['content']); + // $message_assert = 'Found original source metatag from defaults'; + // $this->assertTrue(count($elements) === 1, $message_assert); + // $this->assertEquals( + // $edit['field_metatag[0][advanced][original_source]'], + // (string) $elements[0]['content'] + // ); // @endcode } diff --git a/web/modules/metatag/tests/src/Functional/MetatagConfigTranslationTest.php b/web/modules/metatag/tests/src/Functional/MetatagConfigTranslationTest.php index 32fab439d7..d8ec87898f 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagConfigTranslationTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagConfigTranslationTest.php @@ -5,7 +5,6 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\metatag\Entity\MetatagDefaults; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Ensures that the Metatag config translations work correctly. @@ -14,8 +13,6 @@ */ class MetatagConfigTranslationTest extends BrowserTestBase { - use StringTranslationTrait; - /** * Profile to use. * @@ -90,7 +87,7 @@ public function testConfigTranslationsExist() { $this->drupalGet('admin/config/regional/config-translation/metatag_defaults'); $session->statusCodeEquals(200); // @todo Update this to confirm the H1 is loaded. - $session->responseContains($this->t('Metatag defaults')); + $session->responseContains('Metatag defaults'); // Load all of the Metatag defaults. $defaults = \Drupal::configFactory()->listAll('metatag.metatag_defaults'); @@ -128,7 +125,7 @@ public function testConfigTranslations() { 'title' => 'Test title', 'description' => 'Test description', ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $session->statusCodeEquals(200); $session->pageTextContains('Saved the Global Metatag defaults.'); @@ -153,7 +150,7 @@ public function testConfigTranslations() { 'translation[config_names][metatag.metatag_defaults.global][tags][title]' => 'Le title', 'translation[config_names][metatag.metatag_defaults.global][tags][description]' => 'Le description', ]; - $this->submitForm($edit, $this->t('Save translation')); + $this->submitForm($edit, 'Save translation'); $session->statusCodeEquals(200); $session->pageTextContains('Successfully saved French translation'); diff --git a/web/modules/metatag/tests/src/Functional/MetatagCustomRouteTest.php b/web/modules/metatag/tests/src/Functional/MetatagCustomRouteTest.php index 7b158628f6..7a426b2f61 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagCustomRouteTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagCustomRouteTest.php @@ -13,7 +13,7 @@ * * @see hook_metatag_route_entity() */ -class CustomRouteTest extends BrowserTestBase { +class MetatagCustomRouteTest extends BrowserTestBase { /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/MetatagFieldNodeTest.php b/web/modules/metatag/tests/src/Functional/MetatagFieldNodeTest.php index 25bc6da4fa..76425b1194 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFieldNodeTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFieldNodeTest.php @@ -72,7 +72,7 @@ class MetatagFieldNodeTest extends MetatagFieldTestBase { /** * {@inheritdoc} */ - protected $entityFieldAdminPath = 'admin/structure/types/manage/page/fields'; + protected $entityFieldAdminPath = 'admin/structure/types/manage/page'; /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/MetatagFieldTermTest.php b/web/modules/metatag/tests/src/Functional/MetatagFieldTermTest.php index e3ca21988c..5f2be9847e 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFieldTermTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFieldTermTest.php @@ -2,8 +2,6 @@ namespace Drupal\Tests\metatag\Functional; -use Drupal\Core\StringTranslation\StringTranslationTrait; - /** * Ensures that the Metatag field works correctly on taxonomy terms. * @@ -11,8 +9,6 @@ */ class MetatagFieldTermTest extends MetatagFieldTestBase { - use StringTranslationTrait; - /** * {@inheritdoc} */ @@ -72,7 +68,7 @@ class MetatagFieldTermTest extends MetatagFieldTestBase { /** * {@inheritdoc} */ - protected $entityFieldAdminPath = 'admin/structure/taxonomy/manage/tags/overview/fields'; + protected $entityFieldAdminPath = 'admin/structure/taxonomy/manage/tags/overview'; /** * {@inheritdoc} @@ -96,7 +92,7 @@ protected function setUpEntityType(): void { 'name' => 'Tags', 'vid' => 'tags', ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $this->drupalLogout(); } diff --git a/web/modules/metatag/tests/src/Functional/MetatagFieldTestBase.php b/web/modules/metatag/tests/src/Functional/MetatagFieldTestBase.php index ec5d308d20..55a7ab60a9 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFieldTestBase.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFieldTestBase.php @@ -5,12 +5,14 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** * Base class for ensuring that the Metatag field works correctly. */ abstract class MetatagFieldTestBase extends BrowserTestBase { + use FieldUiTestTrait; use StringTranslationTrait; /** @@ -168,15 +170,7 @@ protected function entityDefaultValues($title = 'Barfoo'): array { */ protected function addField(): void { // Add a metatag field to the entity type test_entity. - $this->drupalGet($this->entityFieldAdminPath . '/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $this->submitForm([], $this->t('Save field settings')); + $this->fieldUIAddNewField($this->entityFieldAdminPath, 'metatag', 'Metatag', 'metatag'); // Clear all settings. $this->container->get('entity_field.manager')->clearCachedFieldDefinitions(); @@ -244,9 +238,6 @@ public function testEntityDefaultsInheritance() { $session->statusCodeEquals(200); $session->pageTextNotContains('Fatal error'); - // Allow the fields to be customized if needed. - $edit = $this->entityDefaultValues('Barfoo'); - // If this entity type supports defaults then verify the global default is // not present but that the entity default *is* present. $session->fieldValueEquals('field_metatag[0][basic][metatag_test_tag]', $entity_values['metatag_test_tag']); @@ -267,10 +258,10 @@ public function testBundleDefaultsInheritance() { * Confirm a field can be added to the entity bundle. */ public function testFieldCanBeAdded() { - $this->drupalGet($this->entityFieldAdminPath . '/add-field'); + $this->drupalGet($this->entityFieldAdminPath . '/fields/add-field'); $session = $this->assertSession(); $session->statusCodeEquals(200); - $session->responseContains('<option value="metatag">' . $this->t('Meta tags') . '</option>'); + $session->elementExists('css', 'label:contains("Meta tags")'); } /** @@ -430,8 +421,8 @@ public function testEntityFieldValuesNewEntity() { // @todo Confirm the values output correctly. // Check the output. // @todo Test this. - $all_tags = metatag_generate_entity_all_tags($entity); - $overrides = metatag_generate_entity_overrides($entity); + metatag_generate_entity_all_tags($entity); + metatag_generate_entity_overrides($entity); } /** @@ -451,7 +442,7 @@ public function todoTestEntityField() { $edit = $this->entityDefaultValues() + [ 'field_metatag[0][basic][metatag_test_tag]' => 'Kilimanjaro', ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $entities = \Drupal::entityTypeManager() ->getStorage('entity_test') ->loadByProperties([$this->entityTitleField => 'Barfoo']); diff --git a/web/modules/metatag/tests/src/Functional/MetatagFieldTestTest.php b/web/modules/metatag/tests/src/Functional/MetatagFieldTestTest.php index fb54470a95..43878f4a27 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFieldTestTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFieldTestTest.php @@ -64,7 +64,7 @@ class MetatagFieldTestTest extends MetatagFieldTestBase { /** * {@inheritdoc} */ - protected $entityFieldAdminPath = 'entity_test/structure/entity_test/fields'; + protected $entityFieldAdminPath = 'entity_test/structure/entity_test'; /** * Whether or not the entity type supports defaults. diff --git a/web/modules/metatag/tests/src/Functional/MetatagFieldUserTest.php b/web/modules/metatag/tests/src/Functional/MetatagFieldUserTest.php index bfef61ebd4..a8cdf8837a 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFieldUserTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFieldUserTest.php @@ -67,7 +67,7 @@ class MetatagFieldUserTest extends MetatagFieldTestBase { /** * {@inheritdoc} */ - protected $entityFieldAdminPath = 'admin/config/people/accounts/fields'; + protected $entityFieldAdminPath = 'admin/config/people/accounts'; /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/MetatagForumTest.php b/web/modules/metatag/tests/src/Functional/MetatagForumTest.php index 49cd5e5be4..d1d830079c 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagForumTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagForumTest.php @@ -2,15 +2,15 @@ namespace Drupal\Tests\metatag\Functional; -use Drupal\Tests\BrowserTestBase; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\BrowserTestBase; /** * Ensures that meta tags are rendering correctly on forum pages. * * @group metatag */ -class ForumTest extends BrowserTestBase { +class MetatagForumTest extends BrowserTestBase { use StringTranslationTrait; diff --git a/web/modules/metatag/tests/src/Functional/MetatagFrontpageTest.php b/web/modules/metatag/tests/src/Functional/MetatagFrontpageTest.php index 98af295cba..65366800ec 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagFrontpageTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagFrontpageTest.php @@ -3,17 +3,15 @@ namespace Drupal\Tests\metatag\Functional; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Ensures that meta tags are rendering correctly on home page. * * @group metatag */ -class FrontpageTest extends BrowserTestBase { +class MetatagFrontpageTest extends BrowserTestBase { use MetatagHelperTrait; - use StringTranslationTrait; /** * {@inheritdoc} @@ -76,7 +74,7 @@ public function testFrontPageMetatagsEnabledConfig() { 'description' => 'Test description', 'keywords' => 'testing,keywords', ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $session->statusCodeEquals(200); $session->pageTextContains('Saved the Front page Metatag defaults.'); @@ -121,19 +119,21 @@ public function testFrontPageMetatagsEnabledConfig() { ]; $this->drupalGet('admin/config/system/site-information'); $session->statusCodeEquals(200); - $this->submitForm($site_edit, $this->t('Save configuration')); + $this->submitForm($site_edit, 'Save configuration'); $session->pageTextContains('The configuration options have been saved.'); - return; // @todo Finish this? - $this->drupalGet('test-page'); - $session->statusCodeEquals(200); - foreach ($edit as $metatag => $metatag_value) { - $xpath = $this->xpath("//meta[@name='" . $metatag . "']"); - $this->assertCount(1, $xpath, 'Exactly one ' . $metatag . ' meta tag found.'); - $value = $xpath[0]->getAttribute('content'); - $this->assertEquals($value, $metatag_value); - } + // @code + // $this->drupalGet('test-page'); + // $session->statusCodeEquals(200); + // foreach ($edit as $metatag => $metatag_value) { + // $xpath = $this->xpath("//meta[@name='" . $metatag . "']"); + // $assert_message = 'Exactly one ' . $metatag . ' meta tag found.'; + // $this->assertCount(1, $xpath, $assert_message); + // $value = $xpath[0]->getAttribute('content'); + // $this->assertEquals($value, $metatag_value); + // } + // @endcode } /** @@ -144,7 +144,7 @@ public function testFrontPageMetatagDisabledConfig() { $this->drupalGet('admin/config/search/metatag/front/delete'); $session = $this->assertSession(); $session->statusCodeEquals(200); - $this->submitForm([], $this->t('Delete')); + $this->submitForm([], 'Delete'); $session->statusCodeEquals(200); $session->pageTextContains('Deleted Front page defaults.'); @@ -179,7 +179,7 @@ public function testFrontPageMetatagDisabledConfig() { $edit = [ 'site_frontpage' => '/test-page', ]; - $this->submitForm($edit, $this->t('Save configuration')); + $this->submitForm($edit, 'Save configuration'); $session->pageTextContains('The configuration options have been saved.'); // Front page is custom route. diff --git a/web/modules/metatag/tests/src/Functional/MetatagHelperTrait.php b/web/modules/metatag/tests/src/Functional/MetatagHelperTrait.php index 343c0b7874..d1bf11b064 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagHelperTrait.php +++ b/web/modules/metatag/tests/src/Functional/MetatagHelperTrait.php @@ -113,7 +113,7 @@ private function createVocabulary(array $values = []): VocabularyInterface { * @param array $values * Items passed to the term. Requires the 'vid' element. * - * @return \Drupal\taxonomy\Term + * @return \Drupal\taxonomy\Entity\Term * A fully formatted term object. */ private function createTerm(array $values = []): TermInterface { diff --git a/web/modules/metatag/tests/src/Functional/MetatagIntegrationTest.php b/web/modules/metatag/tests/src/Functional/MetatagIntegrationTest.php index 8a7ff1d80e..22d5139666 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagIntegrationTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagIntegrationTest.php @@ -9,7 +9,7 @@ * * @group metatag */ -class MetatagHooksTest extends BrowserTestBase { +class MetatagIntegrationTest extends BrowserTestBase { /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/MetatagNodeTranslationTest.php b/web/modules/metatag/tests/src/Functional/MetatagNodeTranslationTest.php index da753410a6..5de6b5f44f 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagNodeTranslationTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagNodeTranslationTest.php @@ -4,16 +4,16 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** * Ensures that meta tag values are translated correctly on nodes. * * @group metatag */ -class NodeTranslationTest extends BrowserTestBase { +class MetatagNodeTranslationTest extends BrowserTestBase { - use StringTranslationTrait; + use FieldUiTestTrait; /** * Modules to enable. @@ -79,13 +79,6 @@ protected function setUp(): void { foreach ($this->additionalLangcodes as $langcode) { ConfigurableLanguage::createFromLangcode($langcode)->save(); } - } - - /** - * Tests the metatag value translations. - */ - public function testMetatagValueTranslation() { - $save_label_i18n = 'Save (this translation)'; // Set up a content type. $name = $this->randomMachineName() . ' ' . $this->randomMachineName(); @@ -94,46 +87,56 @@ public function testMetatagValueTranslation() { // Add a metatag field to the content type. $this->drupalGet('admin/structure/types'); - $session = $this->assertSession(); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $this->drupalGet('admin/structure/types/manage/metatag_node'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $edit = [ 'language_configuration[language_alterable]' => TRUE, 'language_configuration[content_translation]' => TRUE, ]; - $this->submitForm($edit, $this->t('Save content type')); - $session->statusCodeEquals(200); - - $this->drupalGet('admin/structure/types/manage/metatag_node/fields/add-field'); - $session->statusCodeEquals(200); - $edit = [ - 'label' => 'Meta tags', - 'field_name' => 'meta_tags', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $session->statusCodeEquals(200); - $this->submitForm([], $this->t('Save field settings')); - $session->statusCodeEquals(200); - $edit = [ - 'translatable' => TRUE, - ]; - $this->submitForm($edit, $this->t('Save settings')); - $session->statusCodeEquals(200); + $this->submitForm($edit, 'Save'); + $this->assertSession()->statusCodeEquals(200); + + $this->fieldUIAddNewField( + 'admin/structure/types/manage/metatag_node', + 'meta_tags', + 'Metatag', + 'metatag', + [], + ['translatable' => TRUE] + ); $this->drupalGet('admin/structure/types/manage/metatag_node/fields/node.metatag_node.field_meta_tags'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); + } + + /** + * Confirm the language translation system isn't accidentally broken. + */ + public function testContentTranslationForm() { + $this->drupalGet('/admin/config/regional/content-language'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('Content language'); + $this->submitForm([], 'Save configuration'); + $this->assertSession()->statusCodeEquals(200); + $this->assertSession()->pageTextContains('Settings successfully updated.'); + } + + /** + * Tests the metatag value translations. + */ + public function testMetatagValueTranslation() { + $save_label_i18n = 'Save (this translation)'; // Set up a node without explicit metatag description. This causes the // global default to be used, which contains a token (node:summary). The // token value should be correctly translated. // Load the node form. $this->drupalGet('node/add/metatag_node'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); // Check the default values are correct. - $session->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); - $session->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); // Create a node. $edit = [ @@ -141,7 +144,7 @@ public function testMetatagValueTranslation() { 'body[0][value]' => 'French summary.', ]; $this->submitForm($edit, 'Save'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $xpath = $this->xpath("//meta[@name='description']"); $this->assertCount(1, $xpath, 'Exactly one description meta tag found.'); @@ -149,20 +152,20 @@ public function testMetatagValueTranslation() { $this->assertEquals($value, 'French summary.'); $this->drupalGet('node/1/translations/add/en/es'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); // Check the default values are there. - $session->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); - $session->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); $edit = [ 'title[0][value]' => 'Node EspaƱol', 'body[0][value]' => 'Spanish summary.', ]; $this->submitForm($edit, $save_label_i18n); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $this->drupalGet('es/node/1'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $xpath = $this->xpath("//meta[@name='description']"); $this->assertCount(1, $xpath, 'Exactly one description meta tag found.'); $value = $xpath[0]->getAttribute('content'); @@ -170,20 +173,20 @@ public function testMetatagValueTranslation() { $this->assertNotEquals($value, 'French summary.'); $this->drupalGet('node/1/edit'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); // Check the default values are there. - $session->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); - $session->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][title]', '[node:title] | [site:name]'); + $this->assertSession()->fieldValueEquals('field_meta_tags[0][basic][description]', '[node:summary]'); // Set explicit values on the description metatag instead using the // defaults. $this->drupalGet('node/1/edit'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $edit = [ 'field_meta_tags[0][basic][description]' => 'Overridden French description.', ]; $this->submitForm($edit, $save_label_i18n); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $xpath = $this->xpath("//meta[@name='description']"); $this->assertCount(1, $xpath, 'Exactly one description meta tag found.'); @@ -193,12 +196,12 @@ public function testMetatagValueTranslation() { $this->assertNotEquals($value, 'French summary.'); $this->drupalGet('es/node/1/edit'); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $edit = [ 'field_meta_tags[0][basic][description]' => 'Overridden Spanish description.', ]; $this->submitForm($edit, $save_label_i18n); - $session->statusCodeEquals(200); + $this->assertSession()->statusCodeEquals(200); $xpath = $this->xpath("//meta[@name='description']"); $this->assertCount(1, $xpath, 'Exactly one description meta tag found.'); diff --git a/web/modules/metatag/tests/src/Functional/MetatagStringTest.php b/web/modules/metatag/tests/src/Functional/MetatagStringTest.php index ded5b6c8f7..c25694292a 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagStringTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagStringTest.php @@ -3,7 +3,7 @@ namespace Drupal\Tests\metatag\Functional; use Drupal\Tests\BrowserTestBase; -use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** * Ensures that the Metatag field works correctly. @@ -12,7 +12,7 @@ */ class MetatagStringTest extends BrowserTestBase { - use StringTranslationTrait; + use FieldUiTestTrait; /** * Admin user. @@ -69,17 +69,7 @@ protected function setUp(): void { ]); // Add a Metatag field to the content type. - $this->drupalGet('admin/structure/types'); - $this->assertSession()->statusCodeEquals(200); - $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag_field', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $this->submitForm([], $this->t('Save field settings')); + $this->fieldUIAddNewField('admin/structure/types/manage/page', 'metatag_field', 'Metatag', 'metatag'); $this->container->get('entity_field.manager')->clearCachedFieldDefinitions(); } @@ -172,7 +162,7 @@ public function checkConfig($string): void { $this->drupalGet('<front>'); $session->statusCodeEquals(200); - // Again, with xpath the HTML entities will be parsed automagically. + // Again, with xpath the HTML entities will be parsed automatically. $xpath_title = current($this->xpath("//title"))->getText(); $this->assertEquals($xpath_title, $title_original); $this->assertNotEquals($xpath_title, $title_encoded); @@ -185,7 +175,7 @@ public function checkConfig($string): void { $session->responseNotContains('<title>' . $title_original . '</title>'); $session->responseNotContains('<title>' . $title_encodeded . '</title>'); - // Again, with xpath the HTML entities will be parsed automagically. + // Again, with xpath the HTML entities will be parsed automatically. $xpath = $this->xpath("//meta[@name='description']"); $this->assertEquals($xpath[0]->getAttribute('content'), $desc_original); $this->assertNotEquals($xpath[0]->getAttribute('content'), $desc_encoded); @@ -216,7 +206,7 @@ public function checkNode($string): void { 'title' => $title_original, 'description' => $desc_original, ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $session->statusCodeEquals(200); // Set up a node without explicit metatag description. This causes the @@ -236,7 +226,7 @@ public function checkNode($string): void { $this->drupalGet('node/1'); $session->statusCodeEquals(200); - // Again, with xpath the HTML entities will be parsed automagically. + // Again, with xpath the HTML entities will be parsed automatically. $xpath_title = current($this->xpath("//title"))->getText(); $this->assertEquals($xpath_title, $title_original); $this->assertNotEquals($xpath_title, $title_encoded); @@ -246,7 +236,7 @@ public function checkNode($string): void { // because assertRaw() checks the raw HTML, not the parsed strings like // xpath does. $session->responseContains('<title>' . $title_encoded . '</title>'); - // Again, with xpath the HTML entities will be parsed automagically. + // Again, with xpath the HTML entities will be parsed automatically. $xpath = $this->xpath("//meta[@name='description']"); $value = $xpath[0]->getAttribute('content'); $this->assertEquals($value, $desc_original); @@ -284,7 +274,7 @@ public function checkEncodedField($string): void { 'title' => $title_original, 'description' => $desc_original, ]; - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $session->statusCodeEquals(200); // Set up a node without explicit metatag description. This causes the @@ -304,7 +294,7 @@ public function checkEncodedField($string): void { $this->drupalGet('node/1'); $session->statusCodeEquals(200); - // With xpath the HTML entities will be parsed automagically. + // With xpath the HTML entities will be parsed automatically. $xpath = $this->xpath("//meta[@name='description']"); $value = $xpath[0]->getAttribute('content'); $this->assertEquals($value, $desc_original); diff --git a/web/modules/metatag/tests/src/Functional/MetatagTokenStatus.php b/web/modules/metatag/tests/src/Functional/MetatagTokenStatusTest.php similarity index 94% rename from web/modules/metatag/tests/src/Functional/MetatagTokenStatus.php rename to web/modules/metatag/tests/src/Functional/MetatagTokenStatusTest.php index 4d6a13b7be..067df4d8e7 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagTokenStatus.php +++ b/web/modules/metatag/tests/src/Functional/MetatagTokenStatusTest.php @@ -10,7 +10,7 @@ * * @group metatag */ -class MetatagTokenStatus extends BrowserTestBase { +class MetatagTokenStatusTest extends BrowserTestBase { /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/MetatagTokenTest.php b/web/modules/metatag/tests/src/Functional/MetatagTokenTest.php index c03c6d6c61..1d9d907b35 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagTokenTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagTokenTest.php @@ -12,7 +12,7 @@ * * @group metatag */ -class TokenTest extends BrowserTestBase { +class MetatagTokenTest extends BrowserTestBase { use TokenTestTrait; use FieldUiTestTrait; diff --git a/web/modules/metatag/tests/src/Functional/MetatagXssTest.php b/web/modules/metatag/tests/src/Functional/MetatagXssTest.php index f88962d727..fb437c758f 100644 --- a/web/modules/metatag/tests/src/Functional/MetatagXssTest.php +++ b/web/modules/metatag/tests/src/Functional/MetatagXssTest.php @@ -2,16 +2,18 @@ namespace Drupal\Tests\metatag\Functional; -use Drupal\Tests\BrowserTestBase; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; /** * Ensures that meta tags do not allow xss vulnerabilities. * * @group metatag */ -class XssTest extends BrowserTestBase { +class MetatagXssTest extends BrowserTestBase { + use FieldUiTestTrait; use StringTranslationTrait; /** @@ -107,15 +109,7 @@ protected function setUp(): void { ]); // Add a metatag field to the content type. - $this->drupalGet('admin/structure/types/manage/metatag_node/fields/add-field'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'label' => 'Metatag', - 'field_name' => 'metatag_field', - 'new_storage_type' => 'metatag', - ]; - $this->submitForm($edit, $this->t('Save and continue')); - $this->submitForm([], $this->t('Save field settings')); + $this->fieldUIAddNewField('admin/structure/types/manage/metatag_node', 'metatag_field', 'Metatag', 'metatag'); } /** diff --git a/web/modules/metatag/tests/src/Functional/NodeJsonOutput.php b/web/modules/metatag/tests/src/Functional/NodeJsonOutputTest.php similarity index 98% rename from web/modules/metatag/tests/src/Functional/NodeJsonOutput.php rename to web/modules/metatag/tests/src/Functional/NodeJsonOutputTest.php index 3aa8f23369..29600c82f7 100644 --- a/web/modules/metatag/tests/src/Functional/NodeJsonOutput.php +++ b/web/modules/metatag/tests/src/Functional/NodeJsonOutputTest.php @@ -11,7 +11,7 @@ * * @group metatag */ -class NodeJsonOutput extends BrowserTestBase { +class NodeJsonOutputTest extends BrowserTestBase { // Contains helper methods. use MetatagHelperTrait; diff --git a/web/modules/metatag/tests/src/Functional/NodeTranslation.php b/web/modules/metatag/tests/src/Functional/NodeTranslation.php deleted file mode 100644 index bd2207f35e..0000000000 --- a/web/modules/metatag/tests/src/Functional/NodeTranslation.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -namespace Drupal\Tests\metatag\Functional; - -use Drupal\Tests\BrowserTestBase; - -/** - * Verify that node translation form works. - * - * @group metatag - */ -class NodeTranslation extends BrowserTestBase { - - // Contains helper methods. - use MetatagHelperTrait; - - /** - * {@inheritdoc} - */ - protected static $modules = [ - // Modules for core functionality. - 'language', - 'node', - 'field_ui', - 'user', - - // Contrib dependencies. - 'token', - - // This module. - 'metatag', - - // The extra module(s) to test. - 'content_translation', - ]; - - /** - * {@inheritdoc} - */ - protected $defaultTheme = 'stark'; - - /** - * {@inheritdoc} - */ - protected function setUp(): void { - parent::setUp(); - - // Login. - $this->loginUser1(); - - // Add language. - $this->drupalGet('/admin/config/regional/language/add'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'predefined_langcode' => 'hu', - ]; - $this->submitForm($edit, 'Add language'); - - // Set up a content type. - $this->drupalCreateContentType(['type' => 'article']); - $this->drupalGet('/admin/structure/types/manage/article'); - $this->assertSession()->statusCodeEquals(200); - $edit = [ - 'language_configuration[content_translation]' => TRUE, - ]; - $this->submitForm($edit, 'Save content type'); - } - - /** - * Load the custom route, make sure something is output. - */ - public function testContentTranslationForm() { - $this->drupalGet('/admin/config/regional/content-language'); - $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->pageTextContains('Content language'); - $this->submitForm([], 'Save configuration'); - $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->pageTextContains('Settings successfully updated.'); - } - -} diff --git a/web/modules/metatag/tests/src/Functional/TagsTestBase.php b/web/modules/metatag/tests/src/Functional/TagsTestBase.php index 12b2d46a19..83b86282e1 100644 --- a/web/modules/metatag/tests/src/Functional/TagsTestBase.php +++ b/web/modules/metatag/tests/src/Functional/TagsTestBase.php @@ -4,8 +4,6 @@ use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; -use Symfony\Component\DependencyInjection\Container; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Base class to test all of the meta tags that are in a specific module. @@ -13,7 +11,6 @@ abstract class TagsTestBase extends BrowserTestBase { use MetatagHelperTrait; - use StringTranslationTrait; /** * {@inheritdoc} @@ -73,10 +70,10 @@ public function testTags() { // Create a content type to test with. $this->createContentType(['type' => 'page']); $this->drupalCreateNode([ - 'title' => $this->t('Hello, world!'), + 'title' => 'Hello, world!', 'type' => 'page', ]); - + // Build a list of all tag objects that will be used later on. $tag_manager = \Drupal::service('plugin.manager.metatag.tag'); $all_tags = []; @@ -123,7 +120,10 @@ public function testTags() { dump([$tag_name => $form_field_xpath]); } $xpath = $this->xpath($form_field_xpath); - $this->assertCount(1, $xpath, new FormattableMarkup('One @tag tag form field found using: @xpath', ['@tag' => $tag_name, '@xpath' => $form_field_xpath])); + $this->assertCount(1, $xpath, new FormattableMarkup('One @tag tag form field found using: @xpath', [ + '@tag' => $tag_name, + '@xpath' => $form_field_xpath, + ])); } // Get the key value(s) that will be identified for this tag. Make sure @@ -160,14 +160,20 @@ public function testTags() { dump([$tag_name => $tag_string]); } $xpath = $this->xpath($tag_string); - $this->assertCount(1, $xpath, new FormattableMarkup('One @tag tag found using: @xpath', ['@tag' => $tag_name, '@xpath' => $tag_string])); + $this->assertCount(1, $xpath, new FormattableMarkup('One @tag tag found using: @xpath', [ + '@tag' => $tag_name, + '@xpath' => $tag_string, + ])); } foreach ($tag->getTestOutputValuesXpath($tag_values[$tag_name]) as $output_string) { if ($this->debugMode) { dump([$tag_name => $output_string]); } $xpath = $this->xpath($output_string); - $this->assertCount(1, $xpath, new FormattableMarkup('Tag output for @tag found using: @xpath', ['@tag' => $tag_name, '@xpath' => $output_string])); + $this->assertCount(1, $xpath, new FormattableMarkup('Tag output for @tag found using: @xpath', [ + '@tag' => $tag_name, + '@xpath' => $output_string, + ])); } } continue; diff --git a/web/modules/metatag/tests/src/Functional/Update/TestV2Updates.php b/web/modules/metatag/tests/src/Functional/Update/V2UpdatesTest.php similarity index 99% rename from web/modules/metatag/tests/src/Functional/Update/TestV2Updates.php rename to web/modules/metatag/tests/src/Functional/Update/V2UpdatesTest.php index 598d44d702..afe749fc0c 100644 --- a/web/modules/metatag/tests/src/Functional/Update/TestV2Updates.php +++ b/web/modules/metatag/tests/src/Functional/Update/V2UpdatesTest.php @@ -34,7 +34,7 @@ * * @group metatag */ -class TestV2Updates extends UpdatePathTestBase { +class V2UpdatesTest extends UpdatePathTestBase { /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Functional/WithRedirect.php b/web/modules/metatag/tests/src/Functional/WithRedirect.php deleted file mode 100644 index 37340f0faf..0000000000 --- a/web/modules/metatag/tests/src/Functional/WithRedirect.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace Drupal\Tests\metatag\Functional; - -/** - * Tests the Metatag administration when Redirect is installed. - * - * @group metatag - */ -class WithRedirect extends MetatagAdminTest { - - /** - * {@inheritdoc} - */ - protected static $modules = [ - 'node', - 'field_ui', - 'test_page_test', - 'token', - 'metatag', - - // @see testAvailableConfigEntities - 'block', - 'block_content', - 'comment', - 'contact', - 'menu_link_content', - 'menu_ui', - 'shortcut', - 'taxonomy', - 'entity_test', - - // The whole point of this test. - 'redirect', - ]; - -} diff --git a/web/modules/metatag/tests/src/FunctionalJavascript/MetatagAvailableTokensTest.php b/web/modules/metatag/tests/src/FunctionalJavascript/MetatagAvailableTokensTest.php index f6c92be1fe..9b10b97455 100644 --- a/web/modules/metatag/tests/src/FunctionalJavascript/MetatagAvailableTokensTest.php +++ b/web/modules/metatag/tests/src/FunctionalJavascript/MetatagAvailableTokensTest.php @@ -10,7 +10,7 @@ * * @group metatag */ -class AvailableTokensTest extends WebDriverTestBase { +class MetatagAvailableTokensTest extends WebDriverTestBase { /** * {@inheritdoc} diff --git a/web/modules/metatag/tests/src/Kernel/MetatagSerializationTest.php b/web/modules/metatag/tests/src/Kernel/MetatagSerializationTest.php index 82ae1eef56..4b65396e02 100644 --- a/web/modules/metatag/tests/src/Kernel/MetatagSerializationTest.php +++ b/web/modules/metatag/tests/src/Kernel/MetatagSerializationTest.php @@ -2,9 +2,9 @@ namespace Drupal\Tests\metatag\Kernel; -use Drupal\field\Entity\FieldStorageConfig; -use Drupal\field\Entity\FieldConfig; use Drupal\entity_test\Entity\EntityTest; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\jsonapi\JsonApiResource\ResourceObject; use Drupal\jsonapi\Normalizer\Value\CacheableNormalization; use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; @@ -24,6 +24,7 @@ class MetatagSerializationTest extends EntityKernelTestBase { protected static $modules = [ // Core modules. 'serialization', + 'file', // Contrib modules. 'token', diff --git a/web/modules/metatag/tests/src/Kernel/Migrate/d6/NodewordsEntitiesTest.php b/web/modules/metatag/tests/src/Kernel/Migrate/d6/NodewordsEntitiesTest.php index 8a9aff8fee..da69c7a4aa 100644 --- a/web/modules/metatag/tests/src/Kernel/Migrate/d6/NodewordsEntitiesTest.php +++ b/web/modules/metatag/tests/src/Kernel/Migrate/d6/NodewordsEntitiesTest.php @@ -9,9 +9,9 @@ use Drupal\node\NodeInterface; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\TermInterface; +use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; use Drupal\user\Entity\User; use Drupal\user\UserInterface; -use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; /** * Tests migration of per-entity data from Nodewords-D6. @@ -91,19 +91,19 @@ protected function setUp(): void { $this->installSchema('system', ['sequences']); $this->installEntitySchema('metatag_defaults'); - $this->executeMigrations([ - 'd6_nodewords_field', - 'd6_node_type', - 'd6_taxonomy_vocabulary', - 'd6_nodewords_field', - 'd6_nodewords_field_instance', - 'd6_filter_format', - 'd6_user_role', - 'd6_user', - 'd6_comment_type', - 'd6_field', - 'd6_field_instance', - ]); + // Run each migration to avoid problems. No, it's not clear why. + $this->executeMigrations(['d6_nodewords_field']); + $this->executeMigrations(['d6_node_type']); + $this->executeMigrations(['d6_taxonomy_vocabulary']); + $this->executeMigrations(['d6_nodewords_field']); + $this->executeMigrations(['d6_nodewords_field_instance']); + $this->executeMigrations(['d6_filter_format']); + $this->executeMigrations(['d6_user_role']); + $this->executeMigrations(['d6_user']); + $this->executeMigrations(['d6_comment_type']); + $this->executeMigrations(['d6_field']); + $this->executeMigrations(['d6_field_instance']); + $this->fileMigrationSetup(); $this->executeMigrations([ 'd6_node_settings', @@ -136,7 +136,9 @@ public function testMetatag() { ]; $this->assertSame(Json::encode($expected), $node->field_metatag->value); - $node = node_revision_load(2004); + $node_storage_manager = \Drupal::entityTypeManager() + ->getStorage('node'); + $node = $node_storage_manager->loadRevision(2004); $this->assertInstanceOf(NodeInterface::class, $node); $this->assertTrue($node->hasField('field_metatag')); // This should have the "old revision" keywords value, indicating it is diff --git a/web/modules/metatag/tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php b/web/modules/metatag/tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php index a9d91027be..b50ada28ba 100644 --- a/web/modules/metatag/tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php +++ b/web/modules/metatag/tests/src/Kernel/Migrate/d7/MetatagEntitiesTest.php @@ -9,9 +9,9 @@ use Drupal\node\NodeInterface; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\TermInterface; +use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; use Drupal\user\Entity\User; use Drupal\user\UserInterface; -use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** * Tests migration of per-entity data from Metatag-D7. @@ -89,23 +89,22 @@ protected function setUp(): void { $this->installEntitySchema('menu_link_content'); $this->installConfig(static::$modules); $this->installSchema('node', ['node_access']); - $this->installSchema('system', ['sequences']); $this->installEntitySchema('metatag_defaults'); - $this->executeMigrations([ - 'language', - 'd7_metatag_field', - 'd7_node_type', - 'd7_taxonomy_vocabulary', - 'd7_metatag_field_instance', - 'd7_metatag_field_instance_widget_settings', - 'd7_user_role', - 'd7_user', - 'd7_comment_type', - 'd7_field', - 'd7_field_instance', - 'd7_language_content_settings', - ]); + // Run each migration to avoid problems. No, it's not clear why. + $this->executeMigrations(['language']); + $this->executeMigrations(['d7_metatag_field']); + $this->executeMigrations(['d7_node_type']); + $this->executeMigrations(['d7_taxonomy_vocabulary']); + $this->executeMigrations(['d7_metatag_field_instance']); + $this->executeMigrations(['d7_metatag_field_instance_widget_settings']); + $this->executeMigrations(['d7_user_role']); + $this->executeMigrations(['d7_user']); + $this->executeMigrations(['d7_comment_type']); + $this->executeMigrations(['d7_field']); + $this->executeMigrations(['d7_field_instance']); + $this->executeMigrations(['d7_language_content_settings']); + $this->fileMigrationSetup(); $this->executeMigrations([ 'd7_node_complete', @@ -130,7 +129,9 @@ public function testMetatag() { ]; $this->assertSame(Json::encode($expected), $node->field_metatag->value); - $node = node_revision_load(998); + $node_storage_manager = \Drupal::entityTypeManager() + ->getStorage('node'); + $node = $node_storage_manager->loadRevision(998); $this->assertInstanceOf(NodeInterface::class, $node); $this->assertTrue($node->hasField('field_metatag')); // This should have the "old revision" keywords value, indicating it is diff --git a/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d6/NodewordsFieldInstanceTest.php b/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d6/NodewordsFieldInstanceTest.php index 2fdef25e0e..959fd55147 100644 --- a/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d6/NodewordsFieldInstanceTest.php +++ b/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d6/NodewordsFieldInstanceTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\metatag\Kernel\Plugin\migrate\source\d6; -use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; use Drupal\node\Entity\NodeType; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; /** * Tests Metatag-D6 field instance source plugin. diff --git a/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d7/MetatagFieldInstanceTest.php b/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d7/MetatagFieldInstanceTest.php index 5b56c8e03b..fcb2a98831 100644 --- a/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d7/MetatagFieldInstanceTest.php +++ b/web/modules/metatag/tests/src/Kernel/Plugin/migrate/source/d7/MetatagFieldInstanceTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\metatag\Kernel\Plugin\migrate\source\d7; -use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; use Drupal\node\Entity\NodeType; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; /** * Tests Metatag-D7 field instance source plugin. diff --git a/web/modules/metatag/tests/src/Unit/MetaNameBaseTest.php b/web/modules/metatag/tests/src/Unit/MetaNameBaseTest.php index df65716af1..9d94d73c21 100644 --- a/web/modules/metatag/tests/src/Unit/MetaNameBaseTest.php +++ b/web/modules/metatag/tests/src/Unit/MetaNameBaseTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\metatag\Unit; +namespace Drupal\Tests\metatag\Unit; use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase; use Drupal\Tests\UnitTestCase; diff --git a/web/modules/metatag/tests/src/Unit/MetatagTrimmerTest.php b/web/modules/metatag/tests/src/Unit/MetatagTrimmerTest.php index 0c072331bc..fd4820e448 100644 --- a/web/modules/metatag/tests/src/Unit/MetatagTrimmerTest.php +++ b/web/modules/metatag/tests/src/Unit/MetatagTrimmerTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\metatag\Unit; +namespace Drupal\Tests\metatag\Unit; use Drupal\metatag\MetatagTrimmer; use Drupal\Tests\UnitTestCase; @@ -45,7 +45,7 @@ public function testTrimBeforeValue() { } /** - * Tests the trimAferValue method. + * Tests the trimAfterValue method. */ public function testTrimAfterValue() { $trimResult1 = $this->metatagTrimmer->trimAfterValue('Test 123', 7); -- GitLab