You are here

protected function StaticPageTest::setUp in Static Page 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/StaticPageTest.php, line 39

Class

StaticPageTest
Test basic module functionality: settings form, etc.

Namespace

Drupal\Tests\static_page\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->user = $this
    ->drupalCreateUser([
    'administer site configuration',
  ]);
  $this
    ->drupalLogin($this->user);

  // Create node types.
  $node_types = [
    'article' => t('Article'),
    'page' => t('Basic page'),
    'static_page' => t('Static page'),
  ];
  foreach ($node_types as $id => $label) {
    $type = $this
      ->drupalCreateContentType([
      'type' => $id,
      'name' => $label,
    ]);
    node_add_body_field($type);
  }
  FieldStorageConfig::create([
    'field_name' => 'static_page_field',
    'entity_type' => 'node',
    'type' => 'text_long',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'static_page_field',
    'entity_type' => 'node',
    'bundle' => 'static_page',
  ])
    ->save();
}