function DateTimePlusTest::testInvalidConstructor

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidConstructor()
  2. 10 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidConstructor()
  3. 11.x core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidConstructor()

Tests invalid values passed to constructor.

@covers ::__construct

@dataProvider providerTestInvalidConstructor

Parameters

string $time: A date/time string.

string[] $errors: An array of error messages.

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function testInvalidConstructor($time, array $errors) {
    $date = new DateTimePlus($time);
    $this->assertEquals(TRUE, $date->hasErrors());
    $this->assertEquals($errors, $date->getErrors());
}

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