You are here

public function EntityLegalDocumentVersionTest::testAdminOverviewUi in Entity Legal 4.0.x

Same name and namespace in other branches
  1. 8.2 src/Tests/EntityLegalDocumentVersionTest.php \Drupal\entity_legal\Tests\EntityLegalDocumentVersionTest::testAdminOverviewUi()
  2. 3.0.x src/Tests/EntityLegalDocumentVersionTest.php \Drupal\entity_legal\Tests\EntityLegalDocumentVersionTest::testAdminOverviewUi()

Test the overview page contains a list of entities.

File

src/Tests/EntityLegalDocumentVersionTest.php, line 15

Class

EntityLegalDocumentVersionTest
Tests admin functionality for the legal document version entity.

Namespace

Drupal\entity_legal\Tests

Code

public function testAdminOverviewUi() {

  // Create a document.
  $document = $this
    ->createDocument();

  // Create 3 documents versions.
  $versions = [];
  for ($i = 0; $i < 3; $i++) {
    $version = $this
      ->createDocumentVersion($document);
    $versions[] = $version;
  }
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/structure/legal/manage/' . $document
    ->id());

  /** @var \Drupal\entity_legal\EntityLegalDocumentVersionInterface $version */
  foreach ($versions as $version) {
    $this
      ->assertRaw($version
      ->label(), 'Legal document version found on overview page');
    $this
      ->assertLinkByHref('/admin/structure/legal/manage/' . $document
      ->id() . '/manage/' . $version
      ->id(), 0, 'Edit link for legal document version appears on overview');
  }
}