function DateTimePlusTest::providerTestInvalidConstructor

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()
  2. 10 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::providerTestInvalidConstructor()
  3. 11.x 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 <a href="/api/drupal/core%21lib%21Drupal%21Component%21Datetime%21DateTimePlus.php/class/DateTimePlus/8.9.x" title="Wraps DateTime()." class="local">\Drupal\Component\Datetime\DateTimePlus</a> @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',
            ],
        ],
    ];
}

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