You are here

public function ModerationContext::tearDown in Lightning Workflow 8.2

Cleans up after the scenario.

@AfterScenario

File

tests/contexts/ModerationContext.behat.inc, line 36

Class

ModerationContext
Contains miscellaneous step definitions for testing moderation UIs.

Namespace

Acquia\LightningExtension\Context

Code

public function tearDown() {
  if ($this->node) {
    $this->node
      ->delete();
  }

  /** @var \Drupal\workflows\WorkflowInterface $workflow */
  $workflow = entity_load('workflow', 'editorial');
  Assert::isInstanceOf($workflow, '\\Drupal\\workflows\\WorkflowInterface');
  while ($this->moderated) {
    $workflow
      ->getTypePlugin()
      ->removeEntityTypeAndBundle('node', array_pop($this->moderated));
  }
  $workflow
    ->save();
}