You are here

public function DateTimePlusTest::testInvalidConstructor 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::testInvalidConstructor()
  2. 9 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 757

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());
}