class LanguageBreadcrumbTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php \Drupal\Tests\language\Functional\LanguageBreadcrumbTest
- 9 core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php \Drupal\Tests\language\Functional\LanguageBreadcrumbTest
Tests breadcrumbs functionality.
@group Menu
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\language\Functional\LanguageBreadcrumbTest uses AssertBreadcrumbTrait
Expanded class hierarchy of LanguageBreadcrumbTest
File
- core/
modules/ language/ tests/ src/ Functional/ LanguageBreadcrumbTest.php, line 14
Namespace
Drupal\Tests\language\FunctionalView source
class LanguageBreadcrumbTest extends BrowserTestBase {
use AssertBreadcrumbTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'language',
'block',
'filter',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this
->drupalPlaceBlock('system_breadcrumb_block');
ConfigurableLanguage::createFromLangcode('de')
->save();
ConfigurableLanguage::createFromLangcode('gsw-berne')
->save();
}
/**
* Tests breadcrumbs with URL prefixes.
*/
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',
]);
}
}