function ContentEntityBaseUnitTest::testSetNewRevisionException

Tests set new revision exception.

@legacy-covers ::setNewRevision

File

core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php, line 277

Class

ContentEntityBaseUnitTest
Tests Drupal\Core\Entity\ContentEntityBase.

Namespace

Drupal\Tests\Core\Entity

Code

public function testSetNewRevisionException() : void {
  $this->entityType
    ->expects($this->once())
    ->method('hasKey')
    ->with('revision')
    ->willReturn(FALSE);
  $this->expectException('LogicException');
  $this->expectExceptionMessage('Entity type ' . $this->entityTypeId . ' does not support revisions.');
  $this->entity
    ->setNewRevision();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.