protected function CommentAlterTestBase::assertRevisionDelete in Comment Alter 8
Asserts that nothing breaks when a revision of parent entity is deleted.
10 calls to CommentAlterTestBase::assertRevisionDelete()
- CommentAlterImageTest::testImageFieldMultiple in tests/src/ Functional/ CommentAlterImageTest.php 
- Tests for multi valued image field comment altering.
- CommentAlterImageTest::testImageFieldSingle in tests/src/ Functional/ CommentAlterImageTest.php 
- Tests for single valued image field comment altering.
- CommentAlterListStringTest::testOptionsButtonMultiple in tests/src/ Functional/ CommentAlterListStringTest.php 
- Tests for multi-valued List (string) fields comment altering.
- CommentAlterListStringTest::testOptionsButtonSingle in tests/src/ Functional/ CommentAlterListStringTest.php 
- Tests for single valued List (string) fields comment altering.
- CommentAlterListStringTest::testOptionsSelectMultiple in tests/src/ Functional/ CommentAlterListStringTest.php 
- Tests for multi-valued List (string) fields comment altering.
File
- tests/src/ Functional/ CommentAlterTestBase.php, line 255 
Class
- CommentAlterTestBase
- Base class for Comment Alter test cases.
Namespace
Drupal\Tests\comment_alter\FunctionalCode
protected function assertRevisionDelete() {
  $old_revision_id = $this->entity
    ->getRevisionId();
  // Create a new revision as deleteRevision() can't delete active revision.
  $this->entity
    ->setNewRevision(TRUE);
  $this->entity
    ->save();
  $this
    ->assertNotEquals($old_revision_id, $this->entity
    ->getRevisionId(), 'Make sure that two revisions are different.');
  // Now delete the old revision and see if we can open the entity page.
  \Drupal::entityTypeManager()
    ->getStorage($this->entityType)
    ->deleteRevision($old_revision_id);
  $content = $this
    ->drupalGet('entity_test_rev/manage/' . $this->entity
    ->id());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}