You are here

public function DynamicBaseFieldTest::testEntityEntityCreation in Entity Construction Kit (ECK) 8

Test if entities can be created when base fields are configured.

File

tests/src/Functional/DynamicBaseFieldTest.php, line 77

Class

DynamicBaseFieldTest
Tests the functioning of eck's dynamic base fields.

Namespace

Drupal\Tests\eck\Functional

Code

public function testEntityEntityCreation() {
  $type = $this
    ->createEntityType();
  $bundle = $this
    ->createEntityBundle($type['id']);

  // Test if a new entity can be created.
  $edit = [
    'title[0][value]' => $this
      ->randomMachineName(),
  ];
  $route_args = [
    'eck_entity_type' => $type['id'],
    'eck_entity_bundle' => $bundle['type'],
  ];
  $this
    ->drupalGet(Url::fromRoute('eck.entity.add', $route_args));
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->responseContains($edit['title[0][value]']);
}