public function ExtraFieldsTest::setUp in Entity Print 8.2
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ ExtraFieldsTest.php, line 48
Class
- ExtraFieldsTest
- Tests the hook_extra_fields() implementation.
Namespace
Drupal\Tests\entity_print\KernelCode
public function setUp() : void {
parent::setUp();
array_map([
$this,
'installEntitySchema',
], [
'user',
'node',
]);
$this
->installConfig([
'system',
'filter',
'node',
]);
$this
->installSchema('system', [
'sequences',
]);
$this
->createContentType([
'type' => 'page',
'display_submitted' => FALSE,
]);
$this->node = $this
->createNode([
'body' => [
[
'value' => 'body text',
],
],
]);
// Configure the display so that the "View PDF" field is displayed.
EntityViewDisplay::load('node.page.default')
->setComponent('entity_print_view_pdf', [
'weight' => -2,
])
->setComponent('body', [
'type' => 'text_default',
'weight' => 0,
])
->save();
// Create a user with permission to view the links.
$account = $this
->createUser([
'access content',
'entity print access type node',
'administer nodes',
]);
$this->container
->get('current_user')
->setAccount($account);
}