You are here

public function CivicrmStorageGetTest::testLoadContact in CiviCRM Entity 8.3

Tests loading a contact.

File

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

Class

CivicrmStorageGetTest
Tests the storage.

Namespace

Drupal\Tests\civicrm_entity\Kernel

Code

public function testLoadContact() {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('civicrm_contact');
  $entity = $storage
    ->load(10);
  $this
    ->assertInstanceOf(CivicrmEntity::class, $entity);
  $this
    ->assertEquals($entity
    ->id(), 10);
  $this
    ->assertEquals($entity
    ->get('display_name')->value, 'Emma Neal');
  $this
    ->assertEquals('1982/06/27', $entity
    ->get('birth_date')->date
    ->format('Y/m/d'));
}