You are here

public function DateTimePlusTest::testInvalidDateArrays in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDateArrays()

Tests creating dates from invalid array input.

@dataProvider providerTestInvalidDateArrays

Parameters

mixed $input: Input argument for DateTimePlus.

string $timezone: Timezone argument for DateTimePlus.

string $class: The Exception subclass to expect to be thrown.

File

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

Class

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

Namespace

Drupal\Tests\Component\Datetime

Code

public function testInvalidDateArrays($input, $timezone, $class) {
  $this
    ->expectException($class);
  $this
    ->assertInstanceOf('\\Drupal\\Component\\DateTimePlus', DateTimePlus::createFromArray($input, $timezone));
}