You are here

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

Provides data for testInvalidDates.

Return value

array An array of arrays, each containing:

See also

testInvalidDates

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function providerTestInvalidDates() {
  return array(
    // Test for invalid month names when we are using a short version
    // of the month.
    array(
      '23 abc 2012',
      NULL,
      'd M Y',
      "23 abc 2012 contains an invalid month name and did not produce errors.",
    ),
    // Test for invalid hour.
    array(
      '0000-00-00T45:30:00',
      NULL,
      'Y-m-d\\TH:i:s',
      "0000-00-00T45:30:00 contains an invalid hour and did not produce errors.",
    ),
    // Test for invalid day.
    array(
      '0000-00-99T05:30:00',
      NULL,
      'Y-m-d\\TH:i:s',
      "0000-00-99T05:30:00 contains an invalid day and did not produce errors.",
    ),
    // Test for invalid month.
    array(
      '0000-75-00T15:30:00',
      NULL,
      'Y-m-d\\TH:i:s',
      "0000-75-00T15:30:00 contains an invalid month and did not produce errors.",
    ),
    // Test for invalid year.
    array(
      '11-08-01T15:30:00',
      NULL,
      'Y-m-d\\TH:i:s',
      "11-08-01T15:30:00 contains an invalid year and did not produce errors.",
    ),
  );
}