function CKEditor5ReadOnlyModeTest::setUp

Same name and namespace in other branches
  1. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5ReadOnlyModeTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5ReadOnlyModeTest::setUp()

Overrides CKEditor5TestBase::setUp

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5ReadOnlyModeTest.php, line 28

Class

CKEditor5ReadOnlyModeTest
Tests read-only mode for CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    $field_storage = FieldStorageConfig::create([
        'field_name' => 'field_second_ckeditor5_field',
        'entity_type' => 'node',
        'type' => 'text_with_summary',
        'cardinality' => 1,
    ]);
    $field_storage->save();
    // Attach an instance of the field to the page content type.
    FieldConfig::create([
        'field_storage' => $field_storage,
        'bundle' => 'page',
        'label' => 'Second CKEditor5 field',
    ])->save();
    $this->container
        ->get('entity_display.repository')
        ->getFormDisplay('node', 'page')
        ->setComponent('field_second_ckeditor5_field', [
        'type' => 'text_textarea_with_summary',
    ])
        ->save();
}

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