You are here

final class FixtureContext in Lightning API 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/FixtureContext.php \Drupal\Tests\lightning_api\FixtureContext

Performs set-up and tear-down tasks before and after each test scenario.

Hierarchy

  • class \Drupal\Tests\lightning_api\FixtureContext extends \Drupal\Tests\lightning_core\FixtureBase

Expanded class hierarchy of FixtureContext

1 string reference to 'FixtureContext'
behat.yml in ./behat.yml
behat.yml

File

tests/src/FixtureContext.php, line 11

Namespace

Drupal\Tests\lightning_api
View source
final class FixtureContext extends FixtureBase {

  /**
   * @BeforeScenario
   */
  public function setUp() {
    $this
      ->config('lightning_api.settings')
      ->set('entity_json', TRUE)
      ->set('bundle_docs', TRUE)
      ->save();

    // If Lightning Core's FixtureContext created the test content type before
    // now, react to it retroactively.
    $node_type = NodeType::load('test');
    if ($node_type) {
      lightning_api_entity_insert($node_type);
    }
    $this->container
      ->get('entity_type.bundle.info')
      ->clearCachedBundles();
  }

  /**
   * @AfterScenario
   */
  public function tearDown() {

    // This useless if statement is here to evade a pointless, too-strict coding
    // standards check.
    if (TRUE) {
      parent::tearDown();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FixtureContext::setUp public function @BeforeScenario
FixtureContext::tearDown public function @AfterScenario