You are here

public function DateRecurFieldItemTest::testTimeZoneMissing in Recurring Dates Field 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/DateRecurFieldItemTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemTest::testTimeZoneMissing()
  2. 3.x tests/src/Kernel/DateRecurFieldItemTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemTest::testTimeZoneMissing()
  3. 3.0.x tests/src/Kernel/DateRecurFieldItemTest.php \Drupal\Tests\date_recur\Kernel\DateRecurFieldItemTest::testTimeZoneMissing()

Test exception thrown if time zone is missing when getting a item helper.

File

tests/src/Kernel/DateRecurFieldItemTest.php, line 216

Class

DateRecurFieldItemTest
Tests date_recur field.

Namespace

Drupal\Tests\date_recur\Kernel

Code

public function testTimeZoneMissing() {
  $entity = DrEntityTest::create();
  $entity->dr = [
    [
      'value' => '2008-06-16T00:00:00',
      'end_value' => '2008-06-16T06:00:00',
      'rrule' => 'FREQ=DAILY;COUNT=100',
      'timezone' => '',
    ],
  ];
  $this
    ->expectException(DateRecurHelperArgumentException::class);
  $this
    ->expectExceptionMessage('Invalid time zone');
  $entity->dr[0]
    ->getHelper();
}