You are here

protected function CkeditorConfigTest::setUp in CKEditor custom config 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/CkeditorConfigTest.php \Drupal\Tests\ckeditor_config\FunctionalJavascript\CkeditorConfigTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/CkeditorConfigTest.php, line 41

Class

CkeditorConfigTest
Verify settings form validation, submission, and storage.

Namespace

Drupal\Tests\ckeditor_config\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();

  // Create a node type for testing.
  NodeType::create([
    'type' => 'page',
    'name' => 'page',
  ])
    ->save();
  $field_storage = FieldStorageConfig::loadByName('node', 'body');

  // Create a body field instance for the 'page' node type.
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'page',
    'label' => 'Body',
    'settings' => [
      'display_summary' => TRUE,
    ],
    'required' => TRUE,
  ])
    ->save();

  // Assign widget settings for the 'default' form mode.
  EntityFormDisplay::create([
    'targetEntityType' => 'node',
    'bundle' => 'page',
    'mode' => 'default',
    'status' => TRUE,
  ])
    ->setComponent('body', [
    'type' => 'text_textarea_with_summary',
  ])
    ->save();
  $filtered_html_format = FilterFormat::create([
    'format' => 'testing_text_format',
    'name' => 'Testing Text Format',
    'weight' => 0,
    'filters' => [],
  ]);
  $filtered_html_format
    ->save();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'access administration pages',
    'administer filters',
    'administer nodes',
    'create page content',
    'use text format testing_text_format',
  ]));
}