You are here

public function DateRecurPartGridTest::testAllowedAll in Recurring Dates Field 8.2

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

Tests when nothing is allowed.

File

tests/src/Kernel/DateRecurPartGridTest.php, line 65

Class

DateRecurPartGridTest
Tests field validation failures as a result part grids.

Namespace

Drupal\Tests\date_recur\Kernel

Code

public function testAllowedAll() {
  $this
    ->setPartSettings([
    'all' => TRUE,
    'frequencies' => [
      // Nothing is allowed here.
      'SECONDLY' => [],
      'MINUTELY' => [],
      'HOURLY' => [],
      'DAILY' => [],
      'WEEKLY' => [],
      'MONTHLY' => [],
      'YEARLY' => [],
    ],
  ]);
  $entity = EntityTest::create();
  $entity->foo = [
    'value' => '2014-06-15T23:00:00',
    'end_value' => '2014-06-16T07:00:00',
    'rrule' => 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=3',
    'infinite' => '0',
    'timezone' => 'Australia/Sydney',
  ];

  /** @var \Symfony\Component\Validator\ConstraintViolationListInterface $violations */
  $violations = $entity->foo
    ->validate();
  $this
    ->assertEquals(0, $violations
    ->count());
}