public function EntityLegalDocumentTest::testDeleteForm in Entity Legal 3.0.x
Same name and namespace in other branches
- 8.2 src/Tests/EntityLegalDocumentTest.php \Drupal\entity_legal\Tests\EntityLegalDocumentTest::testDeleteForm()
- 4.0.x src/Tests/EntityLegalDocumentTest.php \Drupal\entity_legal\Tests\EntityLegalDocumentTest::testDeleteForm()
Test the functionality of the delete form.
File
- src/Tests/ EntityLegalDocumentTest.php, line 112 
Class
- EntityLegalDocumentTest
- Tests admin functionality for the legal document entity.
Namespace
Drupal\entity_legal\TestsCode
public function testDeleteForm() {
  $document = $this
    ->createDocument();
  $document_name = $document
    ->id();
  // Log in and check for existence of the created document.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/structure/legal');
  $this
    ->assertRaw($document_name, 'Document found in overview list');
  // Delete the document.
  $this
    ->drupalPostForm('admin/structure/legal/manage/' . $document_name . '/delete', [], 'Delete');
  // Ensure document no longer exists on the overview page.
  $this
    ->assertUrl('admin/structure/legal', [], 'Returned to overview page after deletion');
  $this
    ->assertNoText($document_name, 'Document not found in overview list');
}