You are here

public function MediaLibraryContext::assertDelete in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.2 tests/contexts/MediaLibraryContext.behat.inc \Acquia\LightningExtension\Context\MediaLibraryContext::assertDelete()

Asserts that media can be selected and deleted from the media overview.

@Then I should be able to select and delete media

File

tests/contexts/MediaLibraryContext.behat.inc, line 142

Class

MediaLibraryContext
Contains step definitions to interact with the administrative media library.

Namespace

Acquia\LightningExtension\Context

Code

public function assertDelete() {
  $page = $this
    ->getSession()
    ->getPage();
  $assert = $this
    ->assertSession();
  $page
    ->selectFieldOption('Action', 'Delete media');
  $page
    ->checkField('media_bulk_form[0]');
  $page
    ->checkField('media_bulk_form[1]');
  $page
    ->pressButton('Apply to selected items');
  $page
    ->pressButton('Delete');
  $assert
    ->pageTextContains('Deleted 2 items.');
  array_walk($this->media, [
    $assert,
    'pageTextNotContains',
  ]);
}