Rewrite tests to use permissions properly, not use user 1

Created on 9 April 2024, 3 months ago
Updated 1 May 2024, about 2 months ago

Problem/Motivation

As of Drupal 10.3.0 it will be possible to turn off the magicness of user 1: https://www.drupal.org/node/2910500 β†’

Right now many of the Metatag tests use this to simplify the tests.

Proposed resolution

Rewrite the relevant tests to not assume the user 1 magic.

Remaining tasks

Change tests as follows:

  protected bool $usesSuperUserAccessPolicy = FALSE;

Rewrite the tests as necessary.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

πŸ“Œ Task
Status

Active

Version

2.0

Component

Tests

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @DamienMcKenna
  • Assigned to Panchuk
  • πŸ‡ΊπŸ‡¦Ukraine Panchuk Volyn, Lutsk

    Hey, I would like to take care of this issue and update the tests. For first I'm going to create a list of tests to update. Since there are a lot of different tests in the main module and submodules it's easy to miss something.

  • πŸ‡ΊπŸ‡¦Ukraine Panchuk Volyn, Lutsk

    Metatag Submodules Tests

    • Tags (Drupal\Tests\metatag_app_links\Functional\Tags)
    • Tags (Drupal\Tests\metatag_dc\Functional\Tags)
    • Tags (Drupal\Tests\metatag_dc_advanced\Functional\Tags)
    • Permissions (Drupal\Tests\metatag_extended_perms\Functional\Permissions)
    • Tags (Drupal\Tests\metatag_facebook\Functional\Tags)
    • Tags (Drupal\Tests\metatag_favicons\Functional\Tags)
    • Tags (Drupal\Tests\metatag_google_cse\Functional\Tags)
    • Tags (Drupal\Tests\metatag_hreflang\Functional\Tags)
    • Tags (Drupal\Tests\metatag_mobile\Functional\Tags)
    • Tags (Drupal\Tests\metatag_open_graph\Functional\Tags)
    • Tags (Drupal\Tests\metatag_open_graph_products\Functional\Tags)
    • Tags (Drupal\Tests\metatag_pinterest\Functional\Tags)
    • Tags (Drupal\Tests\metatag_twitter_cards\Functional\Tags)
    • Tags (Drupal\Tests\metatag_verification\Functional\Tags)

    Metatag Views Tests

    • Metatag Views Basics (Drupal\Tests\metatag_views\Functional\MetatagViewsBasics)
    • Metatag Views Token (Drupal\Tests\metatag_views\Functional\MetatagViewsToken)

    Metatag Functional Test

    • Default Tags (Drupal\Tests\metatag\Functional\DefaultTags)
    • Entity Test Metatag (Drupal\Tests\metatag\Functional\EntityTestMetatag)
    • Language Handling (Drupal\Tests\metatag\Functional\LanguageHandling)
    • Maintenance Mode (Drupal\Tests\metatag\Functional\MaintenanceMode)
    • Metatag Admin (Drupal\Tests\metatag\Functional\MetatagAdmin)
    • Metatag Api (Drupal\Tests\metatag\Functional\MetatagApi)
    • Metatag Config Translation (Drupal\Tests\metatag\Functional\MetatagConfigTranslation)
    • Metatag Custom Route (Drupal\Tests\metatag\Functional\MetatagCustomRoute)
    • Metatag Field Node (Drupal\Tests\metatag\Functional\MetatagFieldNode)
    • Metatag Field Term (Drupal\Tests\metatag\Functional\MetatagFieldTerm)
    • Metatag Field Test (Drupal\Tests\metatag\Functional\MetatagFieldTest)
    • Metatag Field User (Drupal\Tests\metatag\Functional\MetatagFieldUser)
    • Metatag Forum (Drupal\Tests\metatag\Functional\MetatagForum)
    • Metatag Frontpage (Drupal\Tests\metatag\Functional\MetatagFrontpage)
    • Metatag Integration (Drupal\Tests\metatag\Functional\MetatagIntegration)
    • Metatag Node Translation (Drupal\Tests\metatag\Functional\MetatagNodeTranslation)
    • Metatag String (Drupal\Tests\metatag\Functional\MetatagString)
    • Metatag Token Status (Drupal\Tests\metatag\Functional\MetatagTokenStatus)
    • Metatag Token (Drupal\Tests\metatag\Functional\MetatagToken)
    • Metatag Xss (Drupal\Tests\metatag\Functional\MetatagXss)
    • Node Json Output (Drupal\Tests\metatag\Functional\NodeJsonOutput)
    • Tags (Drupal\Tests\metatag\Functional\Tags)
    • V2Updates (Drupal\Tests\metatag\Functional\Update\V2Updates)
    • Metatag Available Tokens (Drupal\Tests\metatag\FunctionalJavascript\MetatagAvailableTokens)

    Metatag Kernel Tests

    • Metatag Settings Form (Drupal\Tests\metatag\Kernel\Form\MetatagSettingsForm)
    • Metatag Manager (Drupal\Tests\metatag\Kernel\MetatagManager)
    • Metatag Serialization (Drupal\Tests\metatag\Kernel\MetatagSerialization)
    • Metatag Settings (Drupal\Tests\metatag\Kernel\MetatagSettings)
    • Nodewords Entities (Drupal\Tests\metatag\Kernel\Migrate\d6\NodewordsEntities)
    • Nodewords Field (Drupal\Tests\metatag\Kernel\Migrate\d6\NodewordsField)
    • Metatag Entities (Drupal\Tests\metatag\Kernel\Migrate\d7\MetatagEntities)
    • Metatag Field (Drupal\Tests\metatag\Kernel\Migrate\d7\MetatagField)
    • Nodewords Field Instance (Drupal\Tests\metatag\Kernel\Plugin\migrate\source\d6\NodewordsFieldInstance)
    • Metatag Field Instance (Drupal\Tests\metatag\Kernel\Plugin\migrate\source\d7\MetatagFieldInstance)

    Metatag Unit Tests

    • Meta Name Base (Drupal\metatag\Unit\MetaNameBase)
    • Metatag Trimmer (Drupal\metatag\Unit\MetatagTrimmer)
  • πŸ‡ΊπŸ‡¦Ukraine Panchuk Volyn, Lutsk

    Configured local environment for running tests, almost everything is okay, but there are a few tests that have fallen.

    Summary of non-successful tests:

    Metatag Views Basics (Drupal\Tests\metatag_views\Functional\MetatagViewsBasics)
    ✘ Views ui
    β”‚
    β”‚ Behat\Mink\Exception\ExpectationException: Current response status code is 404, but 200 expected.
    β”‚
    β”‚ /var/www/html/vendor/behat/mink/src/WebAssert.php:888
    β”‚ /var/www/html/vendor/behat/mink/src/WebAssert.php:145
    β”‚ /var/www/html/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php:82
    β”‚ /var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
    β”‚

    Entity Test Metatag (Drupal\Tests\metatag\Functional\EntityTestMetatag)
    ↩ Post
    ↩ Patch
    ↩ Delete

    Metatag Available Tokens (Drupal\Tests\metatag\FunctionalJavascript\MetatagAvailableTokens)
    ↩ Node metatag defaults page

    Tests: 119, Assertions: 11092, Errors: 1, Skipped: 4.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update about 2 months ago
    120 pass
  • Pipeline finished with Failed
    about 2 months ago
    Total: 323s
    #161603
Production build 0.69.0 2024