You are here

public function DateDataTypeTest::getValueTestDataProvider in Search API 8

Provides test data for testGetValue().

Return value

array[] An array of argument arrays for testGetValue().

See also

\Drupal\Tests\search_api\Unit\DateDataTypeTest::testGetValue()

File

tests/src/Unit/DateDataTypeTest.php, line 59

Class

DateDataTypeTest
Tests functionality of the "Date" data type plugin.

Namespace

Drupal\Tests\search_api\Unit

Code

public function getValueTestDataProvider() {
  $t = 1400000000;
  $f = 'Y-m-d H:i:s';
  return [
    'timestamp' => [
      $t,
      $t,
    ],
    'string timestamp' => [
      "{$t}",
      $t,
    ],
    'float timestamp' => [
      $t + 0.12,
      $t,
    ],
    'date string' => [
      gmdate($f, $t),
      $t,
    ],
    'date string with timezone' => [
      date($f . 'P', $t),
      $t,
    ],
  ];
}