function AliasManagerTest::setUpCurrentLanguage

Same name in other branches
  1. 8.9.x core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::setUpCurrentLanguage()
  2. 10 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::setUpCurrentLanguage()
  3. 11.x core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::setUpCurrentLanguage()

Sets up the current language.

Return value

\Drupal\Core\Language\LanguageInterface The current language object.

10 calls to AliasManagerTest::setUpCurrentLanguage()
AliasManagerTest::testCacheClear in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
@covers ::cacheClear
AliasManagerTest::testGetAliasByPathCachedMatch in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath method for a path that is preloaded.
AliasManagerTest::testGetAliasByPathCachedMissLanguage in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath cache when a different language is requested.
AliasManagerTest::testGetAliasByPathCachedMissNoAlias in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath cache with a preloaded path without alias.
AliasManagerTest::testGetAliasByPathMatch in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath method for a path that has a matching alias.

... See full list

File

core/modules/path_alias/tests/src/Unit/AliasManagerTest.php, line 541

Class

AliasManagerTest
@coversDefaultClass \Drupal\path_alias\AliasManager @group path_alias

Namespace

Drupal\Tests\path_alias\Unit

Code

protected function setUpCurrentLanguage() {
    $language = new Language([
        'id' => 'en',
    ]);
    $this->languageManager
        ->expects($this->any())
        ->method('getCurrentLanguage')
        ->with(LanguageInterface::TYPE_URL)
        ->willReturn($language);
    return $language;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.