function AliasManagerTest::setUpCurrentLanguage

Same name and namespace in other branches
  1. 11.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. 9 core/modules/path_alias/tests/src/Unit/AliasManagerTest.php \Drupal\Tests\path_alias\Unit\AliasManagerTest::setUpCurrentLanguage()
  4. 8.9.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.

4 calls to AliasManagerTest::setUpCurrentLanguage()
AliasManagerTest::testGetAliasByPathCachedMissLanguage in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath cache when a different language is requested.
AliasManagerTest::testGetAliasByPathMatch in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath method for a path that has a matching alias.
AliasManagerTest::testGetAliasByPathNoMatch in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getAliasByPath method for a path that has no matching alias.
AliasManagerTest::testGetPathByAliasMatch in core/modules/path_alias/tests/src/Unit/AliasManagerTest.php
Tests the getPathByAlias method for an alias that have a matching path.

File

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

Class

AliasManagerTest
Tests Drupal\path_alias\AliasManager.

Namespace

Drupal\Tests\path_alias\Unit

Code

protected function setUpCurrentLanguage() : Language {
  $language = new Language([
    'id' => 'en',
  ]);
  $this->languageManager
    ->expects($this->exactly(2))
    ->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.