function MediaRevisionTest::createMediaRevision

Same name in other branches
  1. 9 core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::createMediaRevision()
  2. 8.9.x core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::createMediaRevision()
  3. 11.x core/modules/media/tests/src/Functional/MediaRevisionTest.php \Drupal\Tests\media\Functional\MediaRevisionTest::createMediaRevision()

Creates a new revision for a given media item.

Parameters

\Drupal\media\MediaInterface $media: A media object.

Return value

\Drupal\media\MediaInterface A media object with up to date revision information.

1 call to MediaRevisionTest::createMediaRevision()
MediaRevisionTest::testRevisions in core/modules/media/tests/src/Functional/MediaRevisionTest.php
Checks media revision operations.

File

core/modules/media/tests/src/Functional/MediaRevisionTest.php, line 205

Class

MediaRevisionTest
Tests the revisions of media entities.

Namespace

Drupal\Tests\media\Functional

Code

protected function createMediaRevision(MediaInterface $media) {
    $media->setName($this->randomMachineName());
    $media->setNewRevision();
    $media->save();
    return $media;
}

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