You are here

protected function EditorIntegrationTest::setUp in Drupal 9

Sets the default field storage backend for fields created during tests.

Overrides QuickEditTestBase::setUp

File

core/modules/quickedit/tests/src/Kernel/EditorIntegrationTest.php, line 65

Class

EditorIntegrationTest
Tests Edit module integration (Editor module's inline editing support).

Namespace

Drupal\Tests\quickedit\Kernel

Code

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

  // Install the Filter module.
  // Create a field.
  $this->fieldName = 'field_textarea';
  $this
    ->createFieldWithStorage($this->fieldName, 'text', 1, 'Long text field', [], 'text_textarea', [
    'size' => 42,
  ], 'text_default', []);

  // Create text format.
  $full_html_format = FilterFormat::create([
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 1,
    'filters' => [],
  ]);
  $full_html_format
    ->save();

  // Associate text editor with text format.
  $editor = Editor::create([
    'format' => $full_html_format
      ->id(),
    'editor' => 'unicorn',
  ]);
  $editor
    ->save();

  // Also create a text format without an associated text editor.
  FilterFormat::create([
    'format' => 'no_editor',
    'name' => 'No Text Editor',
    'weight' => 2,
    'filters' => [],
  ])
    ->save();
}