You are here

public function NavigationalStructureTest::entityView in Entity Construction Kit (ECK) 8

Test entity viewing.

@test

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Functional/NavigationalStructureTest.php, line 502

Class

NavigationalStructureTest
Test Entity Construction Kit's navigational structure.

Namespace

Drupal\Tests\eck\Functional

Code

public function entityView() {
  $entityTitle = $this
    ->randomString();
  $entity = $this
    ->getEntityStorageHandler()
    ->create([
    'type' => $this->entityBundleMachineName,
    'title' => $entityTitle,
  ]);
  $entity
    ->save();
  $route = "entity.{$this->entityTypeMachineName}.canonical";
  $routeArguments = [
    $this->entityTypeMachineName => $entity
      ->id(),
  ];
  $expectedUrl = "{$this->entityTypeMachineName}/{$entity->id()}";
  $expectedTitle = $entityTitle;
  $this->baseCrumbs = [
    "Home",
  ];
  $this
    ->assertCorrectPageOnRoute($route, $routeArguments, $expectedUrl, $expectedTitle);
}