function MediaRevisionTest::assertRevisionCount
Same name in other branches
- 8.9.x core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::assertRevisionCount()
- 10 core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::assertRevisionCount()
- 11.x core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::assertRevisionCount()
Asserts that an entity has a certain number of revisions.
@internal
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity in question.
int $expected_revisions: The expected number of revisions.
2 calls to MediaRevisionTest::assertRevisionCount()
- MediaRevisionTest::testFileMediaRevision in core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php - Tests creating revisions of a File media item.
- MediaRevisionTest::testImageMediaRevision in core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php - Tests creating revisions of an Image media item.
File
-
core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php, line 196
Class
- MediaRevisionTest
- Tests the revisionability of media entities.
Namespace
Drupal\Tests\media\FunctionalCode
protected function assertRevisionCount(EntityInterface $entity, int $expected_revisions) : void {
$entity_type = $entity->getEntityType();
$count = $this->container
->get('entity_type.manager')
->getStorage($entity_type->id())
->getQuery()
->accessCheck(FALSE)
->count()
->allRevisions()
->condition($entity_type->getKey('id'), $entity->id())
->execute();
$this->assertSame($expected_revisions, (int) $count);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.