$assert_session->
elementExists('css', 'td.views-field-operations li a:contains("Edit")',
$row1);
$assert_session->
linkByHrefExists('/media/' .
$media1->
id() . '/edit'
);
$assert_session->
elementExists('css', 'td.views-field-operations li a:contains("Delete")',
$row1);
$assert_session->
linkByHrefExists('/media/' .
$media1->
id() . '/delete'
);
// Make the user the owner of the unpublished media item and assert the
// media item is only visible with the 'view own unpublished media'
// permission.
$media2->
setOwner($this->nonAdminUser
)->
save();
$this->
getSession()->
reload();
$assert_session->
pageTextNotContains($media2->
label());
$role->
grantPermission('view own unpublished media'
)->
save();
$this->
getSession()->
reload();
$row =
$assert_session->
elementExists('css', 'table tbody tr:nth-child(2)'
);
$name =
$assert_session->
elementExists('css', 'td.views-field-name a',
$row);
$this->
assertSame($media2->
label(),
$name->
getText());
$status_element =
$assert_session->
elementExists('css', 'td.views-field-status',
$row);
$this->
assertSame('Unpublished',
$status_element->
getText());
// Assert the admin user can always view all media.
$this->
drupalLogin($this->adminUser
);
$this->
drupalGet('/admin/content/media'
);
$row1 =
$assert_session->
elementExists('css', 'table tbody tr:nth-child(1)'
);