public function DateTimePlusTest::providerTestInvalidConstructor in Drupal 9
Same name and namespace in other branches
- 8 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 766 
Class
- DateTimePlusTest
- @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
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',
      ],
    ],
  ];
}