function DateTimePlusTest::providerTestInvalidConstructor

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()
  2. 8.9.x core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()
  3. 10 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 773

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public static 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',
            ],
        ],
        [
            'invalid time string',
            [
                'The timezone could not be found in the database',
                'Double timezone specification',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.