Skip to content
Snippets Groups Projects
Verified Commit 3520ae25 authored by Dave Long's avatar Dave Long
Browse files

Issue #3456417 by eugene bocharov, pablo_pukha, smustgrave, oily, andypost:...

Issue #3456417 by eugene bocharov, pablo_pukha, smustgrave, oily, andypost: [regression] DateHelper::dayOfWeekName() returns untranslated name

(cherry picked from commit 3aaf8f3b)
parent a24ffe4f
Branches
Tags
24 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete,!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator,!10570Issue #3494197: Convert Twig engine hooks,!10567Issue #3494154: Index is not added if entity doesn't support revisions,!10548Revert "Issue #3478621 by catch, longwave, nicxvan: Add filecache to OOP hook attribute parsing"
Pipeline #365792 canceled
Pipeline: drupal

#365793

    ......@@ -521,7 +521,7 @@ public static function dayOfWeek($date = NULL) {
    * (optional) Whether to return the abbreviated name for that day.
    * Defaults to TRUE.
    *
    * @return string|null
    * @return \Drupal\Core\StringTranslation\TranslatableMarkup|null
    * The name of the day in the week for that date, or null if the $date has
    * errors.
    */
    ......@@ -533,7 +533,7 @@ public static function dayOfWeekName($date = NULL, $abbr = TRUE) {
    if (!$date->hasErrors()) {
    $dow = self::dayOfWeek($date);
    $days = $abbr ? self::weekDaysAbbr() : self::weekDays();
    return $days[$dow]->getUntranslatedString();
    return $days[$dow];
    }
    return NULL;
    }
    ......
    ......@@ -7,6 +7,7 @@
    use Drupal\Core\Datetime\DateHelper;
    use Drupal\Core\DependencyInjection\ContainerBuilder;
    use Drupal\Core\Language\Language;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\Tests\UnitTestCase;
    /**
    ......@@ -31,6 +32,7 @@ protected function setUp(): void {
    $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']);
    ......@@ -245,6 +247,9 @@ public function testDayOfWeekName(): void {
    $this->assertNotNull(DateHelper::dayOfWeekName(FALSE));
    $this->assertNotNull(DateHelper::dayOfWeekName(''));
    // Ensure proper return value type.
    $this->assertInstanceOf(TranslatableMarkup::class, DateHelper::dayOfWeekName());
    // Pass nothing and expect to get NULL.
    $this->assertNull(DateHelper::dayOfWeekName(0));
    $this->assertNull(DateHelper::dayOfWeekName('0'));
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment