protected function CoffeeCommandsTest::setUp in Coffee 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ CoffeeCommandsTest.php, line 28
Class
- CoffeeCommandsTest
- Tests hook_coffee_commands().
Namespace
Drupal\Tests\coffee\KernelCode
protected function setUp() {
parent::setUp();
$this
->installSchema('system', [
'sequences',
'router',
]);
$this
->installEntitySchema('user');
$this
->installConfig('coffee');
// Create the node bundles required for testing.
$node_type = NodeType::create([
'type' => 'page',
'name' => 'Basic page',
]);
$node_type
->save();
// Create user that can create a node for our bundle.
$role = Role::create([
'id' => 'page_creator',
'permissions' => [
'create page content',
],
]);
$role
->save();
$user = User::create([
'name' => $this
->randomMachineName(),
'roles' => [
$role
->id(),
],
]);
$user
->save();
// Set current user.
\Drupal::currentUser()
->setAccount($user);
}