function ContentEntityBaseUnitTest::testIsDefaultRevision
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::testIsDefaultRevision()
- 10 core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::testIsDefaultRevision()
- 11.x core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::testIsDefaultRevision()
@covers ::isDefaultRevision
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ ContentEntityBaseUnitTest.php, line 272
Class
- ContentEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Entity\ContentEntityBase @group Entity @group Access
Namespace
Drupal\Tests\Core\EntityCode
public function testIsDefaultRevision() {
// The default value is TRUE.
$this->assertTrue($this->entity
->isDefaultRevision());
// Change the default revision, verify that the old value is returned.
$this->assertTrue($this->entity
->isDefaultRevision(FALSE));
// The last call changed the return value for this call.
$this->assertFalse($this->entity
->isDefaultRevision());
// The revision for a new entity should always be the default revision.
$this->entity
->expects($this->any())
->method('isNew')
->willReturn(TRUE);
$this->entity
->isDefaultRevision(FALSE);
$this->assertTrue($this->entity
->isDefaultRevision());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.