function DateTest::testFormatWithEmptyStringAsDateFormatType

Same name and namespace in other branches
  1. main core/tests/Drupal/Tests/Core/Datetime/DateTest.php \Drupal\Tests\Core\Datetime\DateTest::testFormatWithEmptyStringAsDateFormatType()

Tests that the formatter does not call \Drupal\Core\Language\LanguageManagerInterface::getConfigOverrideLanguage.

The language manager is called by \Drupal\Core\Datetime\DateFormatter::dateFormat, which should not happen when the type is set to empty string.

File

core/tests/Drupal/Tests/Core/Datetime/DateTest.php, line 564

Class

DateTest
Tests Drupal\Core\Datetime\DateFormatter.

Namespace

Drupal\Tests\Core\Datetime

Code

public function testFormatWithEmptyStringAsDateFormatType() : void {
  $this->languageManager = $this->languageManager
    ->expects($this->never())
    ->method('getConfigOverrideLanguage');
  $this->assertSame('00:00:00', $this->dateFormatter
    ->format(0, '', 'H:i:s', 'UTC', 'en'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.