1 common.test public CommonFormatDateTestCase::providerTestFormatInterval()

Provides some test data for the format interval test.

File

core/modules/simpletest/tests/common.test, line 3010
Tests for common.inc functionality.

Class

CommonFormatDateTestCase
Tests the format_date() function.

Code

public function providerTestFormatInterval() {
  $data = array(
    // Checks for basic seconds.
    array(1, 1, '1 sec', NULL),
    array(1, 2, '1 sec', NULL),
    array(2, 1, '2 sec', NULL),
    array(2, 2, '2 sec', NULL),
    // Checks for minutes with seconds.
    array(61, 1, '1 min', NULL),
    array(61, 2, '1 min 1 sec', NULL),
    array(62, 2, '1 min 2 sec', NULL),
    array(121, 1, '2 min', NULL),
    array(121, 2, '2 min 1 sec', NULL),
    // Check for hours with minutes and seconds.
    array(3601, 1, '1 hour', NULL),
    array(3601, 2, '1 hour 1 sec', NULL),
    // Check for higher units.
    array(86401, 1, '1 day', NULL),
    array(604800, 1, '1 week', NULL),
    array(2592000 * 2, 1, '2 months', NULL),
    array(31536000 * 2, 1, '2 years', NULL),
    // Check for a complicated one with months weeks and days.
    array(
      2592000 * 2 + 604800 * 3 + 86400 * 4, 3,
      '2 months 3 weeks 4 days', NULL,
    ),
    // Check for the langcode.
    array(61, 1, '1 min', self::LANGCODE),
    // Check with an unspecified granularity.
    array(61, NULL, '1 min 1 sec', NULL),
  );

  return $data;
}