You are here

public function TestSubContext::thereAreNoFilesNamed in Panopoly 8.2

Deletes files with a particular URI.

@Given /^there are no files with uri "([^"]*)"$/

File

modules/panopoly/panopoly_test/behat/steps/panopoly_test.behat.inc, line 1148
Provide Behat step-definitions for generic Panopoly tests.

Class

TestSubContext
Behat sub-context for Panopoly.

Code

public function thereAreNoFilesNamed($uri) {

  /** @var \Drupal\file\FileInterface[] $files */
  $files = \Drupal::entityTypeManager()
    ->getStorage('file')
    ->loadByProperties([
    'uri' => $uri,
  ]);
  foreach ($files as $file) {
    $file
      ->delete();
  }
}