You are here

public function DateRecurUtilityTest::testSmallestDate in Recurring Dates Field 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Kernel/DateRecurUtilityTest.php \Drupal\Tests\date_recur\Kernel\DateRecurUtilityTest::testSmallestDate()
  2. 3.0.x tests/src/Kernel/DateRecurUtilityTest.php \Drupal\Tests\date_recur\Kernel\DateRecurUtilityTest::testSmallestDate()
  3. 3.1.x tests/src/Kernel/DateRecurUtilityTest.php \Drupal\Tests\date_recur\Kernel\DateRecurUtilityTest::testSmallestDate()

Tests smallest date utility.

@covers ::createSmallestDateFromInput @dataProvider providerSmallestDate

Parameters

string $granularity: A granularity.

string $value: An input value, assuming Singapore is the timezone.

string $expected: The expected date, in date()'s 'r' format.

File

tests/src/Kernel/DateRecurUtilityTest.php, line 29

Class

DateRecurUtilityTest
Tests utility class.

Namespace

Drupal\Tests\date_recur\Kernel

Code

public function testSmallestDate($granularity, $value, $expected) {
  $timezone = new \DateTimeZone('Asia/Singapore');
  $smallest = DateRecurUtility::createSmallestDateFromInput($granularity, $value, $timezone);
  $this
    ->assertEquals($expected, $smallest
    ->format('r'));
}