function EditorImageDialogTest::setUp

Same name in other branches
  1. 9 core/modules/editor/tests/src/Kernel/EditorImageDialogTest.php \Drupal\Tests\editor\Kernel\EditorImageDialogTest::setUp()
  2. 8.9.x 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 46

Class

EditorImageDialogTest
Tests EditorImageDialog validation and conversion functionality.

Namespace

Drupal\Tests\editor\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('file');
    $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' => '',
            'max_dimensions' => [
                'width' => NULL,
                'height' => NULL,
            ],
            '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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.