You are here

public function DateHelperTest::testWeekDaysOrdered in Drupal 8

Same name and namespace in other branches
  1. 9 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 19

Class

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

Namespace

Drupal\Tests\Core\Datetime

Code

public function testWeekDaysOrdered($first_day, $expected) {
  $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));
}