You are here

public function DateHelperTest::testWeekDaysOrdered in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 24
Contains \Drupal\Tests\Core\Datetime\DateHelperTest.

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));
}