You are here

protected function GatsbyInstantPreviewTest::setUp in Gatsby Live Preview & Incremental Builds 2.0.x

Same name and namespace in other branches
  1. 8 modules/gatsby_instantpreview/tests/src/Kernel/GatsbyInstantPreviewTest.php \Drupal\Tests\gatsby_instantpreview\Kernel\GatsbyInstantPreviewTest::setUp()

Overrides KernelTestBase::setUp

File

modules/gatsby_instantpreview/tests/src/Kernel/GatsbyInstantPreviewTest.php, line 46

Class

GatsbyInstantPreviewTest
Defines a test for the GatsbyInstantPreview.

Namespace

Drupal\Tests\gatsby_instantpreview\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'node',
    'filter',
  ]);
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('path_alias');
  $this
    ->createContentType([
    'type' => 'page',
  ]);
  $config_factory = \Drupal::configFactory();
  $config_factory
    ->getEditable('gatsby.settings')
    ->set('preview_entity_types', [
    'node',
  ])
    ->set('secret_key', $this
    ->randomString())
    ->save();
  $this
    ->setUpCurrentUser([], [
    'access content',
  ]);
  $this
    ->createEntityReferenceField('node', 'page', 'field_reference', 'Referencs', 'node');
}