You are here

public function DateTimePlusTest::providerTestInvalidDateArrays 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::providerTestInvalidDateArrays()

Data provider for testInvalidDateArrays.

Return value

array An array of arrays, each containing:

See also

testInvalidDateArrays

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function providerTestInvalidDateArrays() {
  return array(
    // One year larger than the documented upper limit of checkdate().
    array(
      array(
        'year' => 32768,
        'month' => 1,
        'day' => 8,
        'hour' => 8,
        'minute' => 0,
        'second' => 0,
      ),
      'America/Chicago',
    ),
    // One year smaller than the documented lower limit of checkdate().
    array(
      array(
        'year' => 0,
        'month' => 1,
        'day' => 8,
        'hour' => 8,
        'minute' => 0,
        'second' => 0,
      ),
      'America/Chicago',
    ),
    // Test for invalid month from date array.
    array(
      array(
        'year' => 2010,
        'month' => 27,
        'day' => 8,
        'hour' => 8,
        'minute' => 0,
        'second' => 0,
      ),
      'America/Chicago',
    ),
    // Test for invalid hour from date array.
    array(
      array(
        'year' => 2010,
        'month' => 2,
        'day' => 28,
        'hour' => 80,
        'minute' => 0,
        'second' => 0,
      ),
      'America/Chicago',
    ),
    // Test for invalid minute from date array.
    array(
      array(
        'year' => 2010,
        'month' => 7,
        'day' => 8,
        'hour' => 8,
        'minute' => 88,
        'second' => 0,
      ),
      'America/Chicago',
    ),
    // Regression test for https://www.drupal.org/node/2084455.
    array(
      array(
        'hour' => 59,
        'minute' => 1,
        'second' => 1,
      ),
      'America/Chicago',
    ),
  );
}