1 common.test public CommonFormatDateTestCase::testFormatInterval()

Tests the formatInterval method.

@covers ::formatInterval

File

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

Class

CommonFormatDateTestCase
Tests the format_date() function.

Code

public function testFormatInterval() {
  $test_data = $this->providerTestFormatInterval();
  foreach ($test_data as $data) {
    list($interval, $granularity, $expected, $langcode) = $data;
    // Check if the granularity is specified.
    if ($granularity) {
      $result = format_interval($interval, $granularity, $langcode);
    }
    else {
      $result = format_interval($interval);
    }

    $this->assertEqual($expected, $result);
  }
}