public function DateTest::providerTestFormatInterval in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Datetime/DateTest.php \Drupal\Tests\Core\Datetime\DateTest::providerTestFormatInterval()
Provides some test data for the format interval test.
File
- core/
tests/ Drupal/ Tests/ Core/ Datetime/ DateTest.php, line 119 - Contains \Drupal\Tests\Core\Datetime\DateTest.
Class
- DateTest
- @coversDefaultClass \Drupal\Core\Datetime\DateFormatter @group Datetime
Namespace
Drupal\Tests\Core\DatetimeCode
public function providerTestFormatInterval() {
$data = array(
// Checks for basic seconds.
array(
1,
1,
'1 sec',
),
array(
1,
2,
'1 sec',
),
array(
2,
1,
'2 sec',
),
array(
2,
2,
'2 sec',
),
// Checks for minutes with seconds.
array(
61,
1,
'1 min',
),
array(
61,
2,
'1 min 1 sec',
),
array(
62,
2,
'1 min 2 sec',
),
array(
121,
1,
'2 min',
),
array(
121,
2,
'2 min 1 sec',
),
// Check for hours with minutes and seconds.
array(
3601,
1,
'1 hour',
),
array(
3601,
2,
'1 hour',
),
// Check for higher units.
array(
86401,
1,
'1 day',
),
array(
604800,
1,
'1 week',
),
array(
2592000 * 2,
1,
'2 months',
),
array(
31536000 * 2,
1,
'2 years',
),
// Check for a complicated one with months weeks and days.
array(
2592000 * 2 + 604800 * 3 + 86400 * 4,
3,
'2 months 3 weeks 4 days',
),
// Check for the langcode.
array(
61,
1,
'1 min',
'xxx-lolspeak',
),
// Check with an unspecified granularity.
array(
61,
NULL,
'1 min 1 sec',
),
);
return $data;
}