function DateHelperTest::testWeekDaysOrdered

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php \Drupal\Tests\Core\Datetime\DateHelperTest::testWeekDaysOrdered()
  2. 8.9.x core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php \Drupal\Tests\Core\Datetime\DateHelperTest::testWeekDaysOrdered()
  3. 10 core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php \Drupal\Tests\Core\Datetime\DateHelperTest::testWeekDaysOrdered()

@covers ::weekDaysOrdered @dataProvider providerTestWeekDaysOrdered

File

core/tests/Drupal/Tests/Core/Datetime/DateHelperTest.php, line 52

Class

DateHelperTest
@coversDefaultClass \Drupal\Core\Datetime\DateHelper @group Datetime

Namespace

Drupal\Tests\Core\Datetime

Code

public function testWeekDaysOrdered($first_day, $expected) : void {
    $container = new ContainerBuilder();
    $config = [
        'system.date' => [
            'first_day' => $first_day,
        ],
    ];
    $container->set('config.factory', $this->getConfigFactoryStub($config));
    \Drupal::setContainer($container);
    $weekdays = DateHelper::weekDaysUntranslated();
    // self::assertSame() MUST be used here as it checks for array key order.
    $this->assertSame($expected, DateHelper::weekDaysOrdered($weekdays));
}

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