You are here

public function MediaImageFieldTest::tearDown in Lightning Media 8.2

File

tests/src/ExistingSiteJavascript/MediaImageFieldTest.php, line 93

Class

MediaImageFieldTest
@group lightning @group lightning_media

Namespace

Drupal\Tests\lightning_media\ExistingSiteJavascript

Code

public function tearDown() {
  if ($this->name) {

    /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
    $storage = $this->container
      ->get('entity_type.manager')
      ->getStorage('media');
    $media = $storage
      ->loadByProperties([
      'name' => $this->name,
    ]);
    $storage
      ->delete($media);
  }
  entity_load('field_config', 'media.video.field_image')
    ->delete();
  field_purge_batch(10);
  parent::tearDown();
}