You are here

protected function EditorImageDialogTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php \Drupal\Tests\editor\Kernel\EditorImageDialogTest::setUp()

Sets up the test.

Overrides EntityKernelTestBase::setUp

File

core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php, line 43

Class

EditorImageDialogTest
Tests EditorImageDialog validation and conversion functionality.

Namespace

Drupal\Tests\editor\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('system', [
    'key_value_expire',
  ]);
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  $this
    ->installConfig([
    'node',
  ]);

  // Add text formats.
  $format = FilterFormat::create([
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => [
      'filter_align' => [
        'status' => TRUE,
      ],
      'filter_caption' => [
        'status' => TRUE,
      ],
    ],
  ]);
  $format
    ->save();

  // Set up text editor.
  $editor = Editor::create([
    'format' => 'filtered_html',
    'editor' => 'unicorn',
    'image_upload' => [
      'max_size' => 100,
      'scheme' => 'public',
      'directory' => '',
      'status' => TRUE,
    ],
  ]);
  $editor
    ->save();
  $this->editor = $editor;

  // Create a node type for testing.
  $type = NodeType::create([
    'type' => 'page',
    'name' => 'page',
  ]);
  $type
    ->save();
  node_add_body_field($type);
  $this
    ->installEntitySchema('user');
  \Drupal::service('router.builder')
    ->rebuild();
}