protected function LanguageNegotiationUrlTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
modules/ language/ tests/ src/ Unit/ LanguageNegotiationUrlTest.php, line 30 - Contains \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest.
Class
- LanguageNegotiationUrlTest
- @coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl @group language
Namespace
Drupal\Tests\language\UnitCode
protected function setUp() {
// Set up some languages to be used by the language-based path processor.
$language_de = $this
->getMock('\\Drupal\\Core\\Language\\LanguageInterface');
$language_de
->expects($this
->any())
->method('getId')
->will($this
->returnValue('de'));
$language_en = $this
->getMock('\\Drupal\\Core\\Language\\LanguageInterface');
$language_en
->expects($this
->any())
->method('getId')
->will($this
->returnValue('en'));
$languages = array(
'de' => $language_de,
'en' => $language_en,
);
$this->languages = $languages;
// Create a language manager stub.
$language_manager = $this
->getMockBuilder('Drupal\\language\\ConfigurableLanguageManagerInterface')
->getMock();
$language_manager
->expects($this
->any())
->method('getLanguages')
->will($this
->returnValue($languages));
$this->languageManager = $language_manager;
// Create a user stub.
$this->user = $this
->getMockBuilder('Drupal\\Core\\Session\\AccountInterface')
->getMock();
$cache_contexts_manager = $this
->getMockBuilder('Drupal\\Core\\Cache\\Context\\CacheContextsManager')
->disableOriginalConstructor()
->getMock();
$cache_contexts_manager
->method('assertValidTokens')
->willReturn(TRUE);
$container = new ContainerBuilder();
$container
->set('cache_contexts_manager', $cache_contexts_manager);
\Drupal::setContainer($container);
}