function DateHelperTest::setUp
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php \Drupal\Tests\Core\Datetime\DateHelperTest::setUp()
- 11.x core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php \Drupal\Tests\Core\Datetime\DateHelperTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
tests/ Drupal/ Tests/ Core/ Datetime/ DateHelperTest.php, line 29
Class
- DateHelperTest
- @coversDefaultClass \Drupal\Core\Datetime\DateHelper @group Datetime
Namespace
Drupal\Tests\Core\DatetimeCode
protected function setUp() : void {
parent::setUp();
$container = new ContainerBuilder();
$config = [
'system.date' => [
'first_day' => 'Sunday',
],
];
$container->set('config.factory', $this->getConfigFactoryStub($config));
$container->set('string_translation', $this->getStringTranslationStub());
$this->languageManager = $this->createMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$language = new Language([
'langcode' => 'en',
]);
$this->languageManager
->expects($this->any())
->method('getDefaultLanguage')
->willReturn($language);
$this->languageManager
->expects($this->any())
->method('getCurrentLanguage')
->willReturn($language);
$container->set('language_manager', $this->languageManager);
\Drupal::setContainer($container);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.