function LanguageNegotiationContentEntityTest::setUp
Same name in this branch
- 11.x core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::setUp()
Same name in other branches
- 9 core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::setUp()
- 8.9.x core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::setUp()
- 10 core/modules/language/tests/src/Unit/Plugin/LanguageNegotiation/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Unit\Plugin\LanguageNegotiation\LanguageNegotiationContentEntityTest::setUp()
- 10 core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php \Drupal\Tests\language\Functional\LanguageNegotiationContentEntityTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
modules/ language/ tests/ src/ Unit/ Plugin/ LanguageNegotiation/ LanguageNegotiationContentEntityTest.php, line 53
Class
- LanguageNegotiationContentEntityTest
- Tests the LanguageNegotiationContentEntity plugin class.
Namespace
Drupal\Tests\language\Unit\Plugin\LanguageNegotiationCode
protected function setUp() : void {
parent::setUp();
// Set up some languages to be used by the language-based path processor.
$language_de = $this->createMock(LanguageInterface::class);
$language_de->expects($this->any())
->method('getId')
->willReturn('de');
$language_de->expects($this->any())
->method('getName')
->willReturn('German');
$language_en = $this->createMock(LanguageInterface::class);
$language_en->expects($this->any())
->method('getId')
->willReturn('en');
$language_en->expects($this->any())
->method('getName')
->willReturn('English');
$this->languages = [
'de' => $language_de,
'en' => $language_en,
];
$language_manager = $this->createMock(ConfigurableLanguageManagerInterface::class);
$language_manager->expects($this->any())
->method('getLanguages')
->willReturn($this->languages);
$language_manager->expects($this->any())
->method('getNativeLanguages')
->willReturn($this->languages);
$this->languageManager = $language_manager;
$container = new ContainerBuilder();
$cache_contexts_manager = $this->createMock(CacheContextsManager::class);
$cache_contexts_manager->method('assertValidTokens')
->willReturn(TRUE);
$container->set('cache_contexts_manager', $cache_contexts_manager);
$entityTypeManager = $this->createMock(EntityTypeManager::class);
$container->set('entity_type.manager', $entityTypeManager);
\Drupal::setContainer($container);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.