$page =
$this->
getSession()->
getPage();
$page->
fillField('Name', 'Foobar'
);
$page->
attachFileToField('File',
$this->container->
get('file_system'
)->
realpath($uri));
$page->
pressButton('Save'
);
$assert->
addressEquals('admin/content/media'
);
// The media item was just created, so it should only have one revision.
$media =
$this->container
->
get('entity_type.manager'
) ->
getStorage('media'
) ->
load(1
);
$this->
assertRevisionCount($media, 1
);
// If we edit the item, we should get a new revision.
$this->
drupalGet('/media/1/edit'
);
$assert->
checkboxChecked('Create new revision'
);
$page =
$this->
getSession()->
getPage();
$page->
fillField('Name', 'Foo'
);
$page->
pressButton('Save'
);
$this->
assertRevisionCount($media, 2
);
// Confirm the correct revision title appears on "view revisions" page.
$media =
$this->container->
get('entity_type.manager'
)