FixtureContext.php in Lightning API 8.3
Same filename and directory in other branches
Namespace
Drupal\Tests\lightning_apiFile
tests/src/FixtureContext.phpView source
<?php
namespace Drupal\Tests\lightning_api;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\lightning_core\FixtureBase;
/**
* Performs set-up and tear-down tasks before and after each test scenario.
*/
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();
}
}
}
Classes
Name | Description |
---|---|
FixtureContext | Performs set-up and tear-down tasks before and after each test scenario. |