You are here

protected function UiDialogTest::setUp in Editor Advanced Image 8.2

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/UiDialogTest.php \Drupal\Tests\editor_advanced_image\FunctionalJavascript\UiDialogTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/UiDialogTest.php, line 64

Class

UiDialogTest
Tests event info pages and links.

Namespace

Drupal\Tests\editor_advanced_image\FunctionalJavascript

Code

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

  // Create text format.
  $this->editorFilterFormat = FilterFormat::create([
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 0,
    'filters' => [],
  ]);
  $this->editorFilterFormat
    ->save();
  $this->editor = Editor::create([
    'format' => 'full_html',
    'editor' => 'ckeditor',
  ]);
  $settings['toolbar']['rows'] = [
    [
      [
        'name' => 'Image',
        'items' => [
          'DrupalImage',
        ],
      ],
    ],
  ];
  $this->editor
    ->setSettings($settings);
  $this->editor
    ->save();

  // 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();

  // Create a user for tests.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer nodes',
    'create page content',
    'use text format full_html',
  ]);
}