You are here

public function MediaRevisionsUiTest::testRevert in Media Revisions UI 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/MediaRevisionsUiTest.php \Drupal\Tests\media_revisions_ui\Functional\MediaRevisionsUiTest::testRevert()

Tests reverting a revision.

File

tests/src/Functional/MediaRevisionsUiTest.php, line 127

Class

MediaRevisionsUiTest
Tests media revisions UI.

Namespace

Drupal\Tests\media_revisions_ui\Functional

Code

public function testRevert() {
  $media = Media::create([
    'bundle' => $this->mediaType
      ->id(),
    'name' => 'Test media',
  ]);
  $media
    ->save();
  $user = $this
    ->drupalCreateUser([
    'administer media',
    'view all media revisions',
  ]);
  $this
    ->createMediaRevision($media);
  $this
    ->assertRevisionsListStatusCode($user, $media, 200);
  $this
    ->clickLink('Revert');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Revert');
  $this
    ->assertSession()
    ->pageTextContains('Media Test media has been reverted');
}