You are here

public function DateRecurUtilityTest::testLargestDate in Recurring Dates Field 3.x

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

Tests largest date utility.

@covers ::createLargestDateFromInput @dataProvider providerLargestDate

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 81

Class

DateRecurUtilityTest
Tests utility class.

Namespace

Drupal\Tests\date_recur\Kernel

Code

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