FixtureContext.php in Lightning Core 8.5
File
tests/src/FixtureContext.php
View source
<?php
namespace Drupal\Tests\lightning_core;
use Drupal\block\Entity\Block;
use Drupal\node\Entity\NodeType;
use Drupal\user\Entity\Role;
final class FixtureContext extends FixtureBase {
public function setUp() {
if (!Role::load('administrator')) {
$role = Role::create([
'id' => 'administrator',
'label' => 'Administrator',
])
->setIsAdmin(TRUE);
$this
->save($role);
}
$this
->installTheme('seven');
$this
->config('system.theme')
->set('admin', 'seven')
->set('default', 'seven')
->save();
if (!Block::load('seven_content')) {
$block = Block::create([
'id' => 'seven_content',
'theme' => 'seven',
'region' => 'content',
'plugin' => 'system_main_block',
'settings' => [
'label_display' => '0',
],
]);
$this
->save($block);
}
$node_type = NodeType::create([
'type' => 'test',
'name' => 'Test',
]);
$this
->save($node_type);
}
public function tearDown() {
if (TRUE) {
parent::tearDown();
}
}
}
Classes
Name |
Description |
FixtureContext |
Performs set-up and tear-down tasks before and after test scenarios. |