protected function MediaRevisionTest::assertRevisionCount in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::assertRevisionCount()
Asserts that an entity has a certain number of revisions.
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 194
Class
- MediaRevisionTest
- Tests the revisionability of media entities.
Namespace
Drupal\Tests\media\FunctionalCode
protected function assertRevisionCount(EntityInterface $entity, $expected_revisions) {
$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);
}