You are here

public function LocalTaskEntityTest::testLocalTask in Entity Construction Kit (ECK) 8

Tests that the entity contains the local task links.

File

tests/src/Functional/LocalTaskEntityTest.php, line 51

Class

LocalTaskEntityTest
Tests the local task links in entities.

Namespace

Drupal\Tests\eck\Functional

Code

public function testLocalTask() {
  $edit['title[0][value]'] = $this
    ->randomMachineName();
  $route_args = [
    'eck_entity_type' => $this->entityTypeInfo['id'],
    'eck_entity_bundle' => $this->bundleInfo['type'],
  ];
  $this
    ->drupalGet(Url::fromRoute("eck.entity.add", $route_args));
  $this
    ->submitForm($edit, 'Save');
  $route_args = [
    $this->entityTypeInfo['id'] => 1,
  ];
  $this
    ->assertLocalTasksFor("entity.{$this->entityTypeInfo['id']}.canonical", $route_args);
  $this
    ->assertLocalTasksFor("entity.{$this->entityTypeInfo['id']}.edit_form", $route_args);
  $this
    ->assertLocalTasksFor("entity.{$this->entityTypeInfo['id']}.delete_form", $route_args);
}