You are here

protected function EditorImageDialogTest::setUp in Zircon Profile 8

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

Sets up the test.

Overrides EntityUnitTestBase::setUp

File

core/modules/editor/src/Tests/EditorImageDialogTest.php, line 41
Contains \Drupal\editor\Tests\EditorImageDialogTest.

Class

EditorImageDialogTest
Tests EditorImageDialog validation and conversion functionality.

Namespace

Drupal\editor\Tests

Code

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

  // Add text formats.
  $this->format = FilterFormat::create([
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => [
      'filter_align' => [
        'status' => TRUE,
      ],
      'filter_caption' => [
        'status' => TRUE,
      ],
    ],
  ]);
  $this->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();

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