public function DateRecurUtilityTest::testSmallestDate in Recurring Dates Field 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/DateRecurUtilityTest.php \Drupal\Tests\date_recur\Kernel\DateRecurUtilityTest::testSmallestDate()
- 3.x tests/src/Kernel/DateRecurUtilityTest.php \Drupal\Tests\date_recur\Kernel\DateRecurUtilityTest::testSmallestDate()
- 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\KernelCode
public function testSmallestDate($granularity, $value, $expected) {
$timezone = new \DateTimeZone('Asia/Singapore');
$smallest = DateRecurUtility::createSmallestDateFromInput($granularity, $value, $timezone);
$this
->assertEquals($expected, $smallest
->format('r'));
}