You are here

public function DateTimePlusTest::providerTestInvalidConstructor in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()
  2. 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()

Provider for testInvalidConstructor().

Return value

array An array of invalid date/time strings, and corresponding error messages.

File

core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php, line 770

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function providerTestInvalidConstructor() {
  return [
    [
      'YYYY-MM-DD',
      [
        'The timezone could not be found in the database',
        'Unexpected character',
        'Double timezone specification',
      ],
    ],
    [
      '2017-MM-DD',
      [
        'Unexpected character',
        'The timezone could not be found in the database',
      ],
    ],
    [
      'YYYY-03-DD',
      [
        'The timezone could not be found in the database',
        'Unexpected character',
        'Double timezone specification',
      ],
    ],
    [
      'YYYY-MM-07',
      [
        'The timezone could not be found in the database',
        'Unexpected character',
        'Double timezone specification',
      ],
    ],
    [
      '2017-13-55',
      [
        'Unexpected character',
      ],
    ],
    [
      'YYYY-MM-DD hh:mm:ss',
      [
        'The timezone could not be found in the database',
        'Unexpected character',
        'Double timezone specification',
      ],
    ],
    [
      '2017-03-07 25:70:80',
      [
        'Unexpected character',
        'Double time specification',
      ],
    ],
    [
      'lorem ipsum dolor sit amet',
      [
        'The timezone could not be found in the database',
        'Double timezone specification',
      ],
    ],
  ];
}