You are here

public function DateTimePlusTest::providerTestDateArrays in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestDateArrays()

Provides data for date tests.

Return value

array An array of arrays, each containing the input parameters for DateTimePlusTest::testDates().

See also

DateTimePlusTest::testDates().

File

core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php, line 287
Contains \Drupal\Tests\Component\Datetime\DateTimePlusTest.

Class

DateTimePlusTest
@coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime

Namespace

Drupal\Tests\Component\Datetime

Code

public function providerTestDateArrays() {
  return array(
    // Array input.
    // Create date object from date array, date only.
    array(
      array(
        'year' => 2010,
        'month' => 2,
        'day' => 28,
      ),
      'America/Chicago',
      '2010-02-28T00:00:00-06:00',
    ),
    // Create date object from date array with hour.
    array(
      array(
        'year' => 2010,
        'month' => 2,
        'day' => 28,
        'hour' => 10,
      ),
      'America/Chicago',
      '2010-02-28T10:00:00-06:00',
    ),
    // Create date object from date array, date only.
    array(
      array(
        'year' => 2010,
        'month' => 2,
        'day' => 28,
      ),
      'Europe/Berlin',
      '2010-02-28T00:00:00+01:00',
    ),
    // Create date object from date array with hour.
    array(
      array(
        'year' => 2010,
        'month' => 2,
        'day' => 28,
        'hour' => 10,
      ),
      'Europe/Berlin',
      '2010-02-28T10:00:00+01:00',
    ),
  );
}