function MediaRevisionTest::createMediaWithRevision
Same name in other branches
- 11.x core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::createMediaWithRevision()
Creates a media with a revision.
Parameters
\Drupal\media\Entity\Media $media: The media object.
2 calls to MediaRevisionTest::createMediaWithRevision()
- MediaRevisionTest::testRevisionDelete in core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php - Tests deleting a revision.
- MediaRevisionTest::testRevisionRevert in core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php - Tests reverting a revision.
File
-
core/
modules/ media/ tests/ src/ Functional/ MediaRevisionTest.php, line 244
Class
- MediaRevisionTest
- Tests the revisions of media entities.
Namespace
Drupal\Tests\media\FunctionalCode
private function createMediaWithRevision(Media $media) : void {
$media->setNewRevision();
$media->setName('1st changed title');
$media->setRevisionLogMessage('first revision');
// Set revision creation time to check the confirmation message while
// deleting or reverting a revision.
$media->setRevisionCreationTime((new \DateTimeImmutable('11 January 2009 4pm'))->getTimestamp());
$media->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.