You are here

public function EntityLegalDocumentTest::testAdminOverviewUi in Entity Legal 3.0.x

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

Test the overview page contains a list of entities.

File

src/Tests/EntityLegalDocumentTest.php, line 15

Class

EntityLegalDocumentTest
Tests admin functionality for the legal document entity.

Namespace

Drupal\entity_legal\Tests

Code

public function testAdminOverviewUi() {

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

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