You are here

public function EntityContext::tearDown in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::tearDown()
  2. 8.2 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::tearDown()
  3. 8.3 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::tearDown()
  4. 8.4 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::tearDown()

Deletes entities created during the scenario.

@afterScenario

File

tests/contexts/EntityContext.behat.inc, line 68

Class

EntityContext
Contains miscellaneous step definitions for working with Drupal entities.

Namespace

Acquia\LightningExtension\Context

Code

public function tearDown() {
  foreach ($this->trash as $entity_type => $IDs) {

    /** @var \Drupal\Core\Entity\EntityInterface[] $entities */
    $entities = \Drupal::entityTypeManager()
      ->getStorage($entity_type)
      ->loadMultiple($IDs);
    foreach ($entities as $entity) {
      $entity
        ->delete();
    }
  }
}