You are here

public function CivicrmEntityTypeTest::testEntityType in CiviCRM Entity 8.3

Tests the generated entity type.

File

tests/src/Kernel/CivicrmEntityTypeTest.php, line 15

Class

CivicrmEntityTypeTest
Tests entity definition.

Namespace

Drupal\Tests\civicrm_entity\Kernel

Code

public function testEntityType() {
  $definition = $this->container
    ->get('entity_type.manager')
    ->getDefinition('civicrm_event');
  $keys = $definition
    ->getKeys();
  $this
    ->assertEquals('id', $keys['id']);
  $this
    ->assertEquals('title', $keys['label']);
  $links = $definition
    ->getLinkTemplates();
  $this
    ->assertEquals('/civicrm-event/{civicrm_event}', $links['canonical']);
  $this
    ->assertEquals('/civicrm-event/{civicrm_event}/edit', $links['edit-form']);
  $this
    ->assertEquals('/admin/structure/civicrm-entity/civicrm-event', $links['collection']);
}