You are here

public function LanguageBreadcrumbTest::testBreadCrumbs in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php \Drupal\Tests\language\Functional\LanguageBreadcrumbTest::testBreadCrumbs()
  2. 9 core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php \Drupal\Tests\language\Functional\LanguageBreadcrumbTest::testBreadCrumbs()

Tests breadcrumbs with URL prefixes.

File

core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php, line 43

Class

LanguageBreadcrumbTest
Tests breadcrumbs functionality.

Namespace

Drupal\Tests\language\Functional

Code

public function testBreadCrumbs() {

  // /user/login is the default frontpage which only works for an anonymous
  // user. Access the frontpage in different languages, ensure that no
  // breadcrumb is displayed.
  $this
    ->assertBreadcrumb('user/login', []);
  $this
    ->assertBreadcrumb('de/user/login', []);
  $this
    ->assertBreadcrumb('gsw-berne/user/login', []);
  $admin_user = $this
    ->drupalCreateUser([
    'access administration pages',
  ]);
  $this
    ->drupalLogin($admin_user);

  // Use administration routes to assert that breadcrumb is displayed
  // correctly on pages other than the frontpage.
  $this
    ->assertBreadcrumb('admin', [
    '' => 'Home',
  ]);
  $this
    ->assertBreadcrumb('de/admin', [
    'de' => 'Home',
  ]);
  $this
    ->assertBreadcrumb('admin/structure', [
    '' => 'Home',
    'admin' => 'Administration',
  ]);
  $this
    ->assertBreadcrumb('de/admin/structure', [
    'de' => 'Home',
    'de/admin' => 'Administration',
  ]);
}