You are here

public function EckEntityTest::testEckMethods in Entity Construction Kit (ECK) 8

Tests some of the ECK entity methods.

File

tests/src/Kernel/EckEntityTest.php, line 34

Class

EckEntityTest
Tests the ECK entity class.

Namespace

Drupal\Tests\eck\Kernel

Code

public function testEckMethods() {

  // Entity without base fields.
  $eck_type_1 = $this
    ->createEckEntityType('no_fields');
  $entity_1 = $this
    ->createEckEntity($eck_type_1);
  $this
    ->assertNull($entity_1
    ->getChangedTime());
  $this
    ->assertNull($entity_1
    ->getCreatedTime());

  // Entity with base fields.
  $eck_type_2 = $this
    ->createEckEntityType('with_fields', [
    'created',
    'changed',
  ]);
  $entity_2 = $this
    ->createEckEntity($eck_type_2);
  $this
    ->assertNotNull($entity_2
    ->getChangedTime());
  $this
    ->assertNotNull($entity_2
    ->getCreatedTime());
}