Partially refactor Language switcher block tests

Created on 3 April 2023, over 1 year ago

Problem/Motivation

This is a follow-up issue to πŸ› [regression] Language switcher block throws exception when no route is matched Fixed , where the tests got added.

The issue-fork added a couple of tests which need to get refactored.

From that issue (note that the comment is aimed at "core/modules/language/tests/src/Functional/LanguageSwitchingTest.php"):

Note, that at the start of "testRestrictedPaths()" we are still logged in as the created "admin_user", the test only succeeds, because this user is not a "real" admin user, since he only has the following permissions:

      'administer blocks',
      'administer languages',
      'access administration pages',
      'access content',

This makes the test quite hard to understand, since later in this test we log in as a "privileged user" even if the admin should be already privileged with the required permissions.

Furthermore, I do not understand the assertion in line 560:

    // Visit a restricted user page.
    // Assert that the language switching block is displayed on the
    // access-denied page, but it does not contain the path alias.
    $this->assertLinkMarkup('/user/1', 403, $block->label(), 'peter-parker');

Why would a block be displayed on a 403 page? Am I missing something here?

Steps to reproduce

Proposed resolution

Fix the mentioned issues

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

10.1 ✨

Component
Language systemΒ  β†’

Last updated about 12 hours ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡©πŸ‡ͺGermany Grevil

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

Comments & Activities

Production build 0.71.5 2024