You are here

protected function EntityRepositoryTest::getLanguageContexts in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::getLanguageContexts()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::getLanguageContexts()

Returns a set of language contexts matching the specified language.

Parameters

string $langcode: A language code.

Return value

\Drupal\Core\Plugin\Context\ContextInterface[] An array of contexts.

3 calls to EntityRepositoryTest::getLanguageContexts()
EntityRepositoryTest::doTestLanguageFallback in core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
Check that language fallback is applied.
EntityRepositoryTest::testGetActive in core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
Tests retrieving active variants.
EntityRepositoryTest::testGetCanonical in core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
Tests retrieving canonical variants.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php, line 318

Class

EntityRepositoryTest
Tests the entity repository.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function getLanguageContexts($langcode) {
  $prefix = '@language.current_language_context:';
  return [
    $prefix . LanguageInterface::TYPE_INTERFACE => new Context(new ContextDefinition('language'), $langcode),
    $prefix . LanguageInterface::TYPE_CONTENT => new Context(new ContextDefinition('language'), $langcode),
  ];
}