You are here

public function DateRecurBaseFieldTest::testDrEntityTest in Recurring Dates Field 8.2

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

Tests date recur entity.

File

tests/src/Kernel/DateRecurBaseFieldTest.php, line 44

Class

DateRecurBaseFieldTest
Tests base fields.

Namespace

Drupal\Tests\date_recur\Kernel

Code

public function testDrEntityTest() {
  $entity = DrEntityTest::create();
  $entity->dr = [
    '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',
  ];
  $entity
    ->save();
  $tableName = 'date_recur__dr_entity_test__dr';
  $actualCount = $this->container
    ->get('database')
    ->select($tableName)
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertEquals(3, $actualCount);
}