You are here

public function CivicrmStorageGetTest::testLoadEvent in CiviCRM Entity 8.3

Tests loading an entity through storage.

File

tests/src/Kernel/CivicrmStorageGetTest.php, line 37

Class

CivicrmStorageGetTest
Tests the storage.

Namespace

Drupal\Tests\civicrm_entity\Kernel

Code

public function testLoadEvent() {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('civicrm_event');
  $entity = $storage
    ->load(1);
  $this
    ->assertInstanceOf(CivicrmEntity::class, $entity);
  $this
    ->assertEquals($entity
    ->id(), 1);
  $this
    ->assertEquals($entity
    ->get('title')->value, 'Fall Fundraiser Dinner');
  $this
    ->assertEquals('2018-05-02T07:00:00', $entity
    ->get('start_date')->value);
  $this
    ->assertEquals('2018/05/02', $entity
    ->get('start_date')->date
    ->format('Y/m/d'));
  $this
    ->assertTrue($entity
    ->get('is_public')->value);
}