function EditorTest::createEntity

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/EditorTest.php \Drupal\Tests\jsonapi\Functional\EditorTest::createEntity()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/EditorTest.php \Drupal\Tests\jsonapi\Functional\EditorTest::createEntity()
  3. 10 core/modules/jsonapi/tests/src/Functional/EditorTest.php \Drupal\Tests\jsonapi\Functional\EditorTest::createEntity()

Overrides ResourceTestBase::createEntity

File

core/modules/jsonapi/tests/src/Functional/EditorTest.php, line 58

Class

EditorTest
JSON:API integration test for the "Editor" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {
    // Create a "Llama" filter format.
    $llama_format = FilterFormat::create([
        'name' => 'Llama',
        'format' => 'llama',
        'langcode' => 'es',
        'filters' => [
            'filter_html' => [
                'status' => TRUE,
                'settings' => [
                    'allowed_html' => '<p> <a> <b> <lo>',
                ],
            ],
        ],
    ]);
    $llama_format->save();
    // Create a "Camelids" editor.
    $camelids = Editor::create([
        'format' => 'llama',
        'editor' => 'ckeditor5',
        'image_upload' => [
            'status' => FALSE,
        ],
    ]);
    $camelids->setImageUploadSettings([
        'status' => TRUE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => NULL,
        'max_dimensions' => [
            'width' => NULL,
            'height' => NULL,
        ],
    ])
        ->save();
    return $camelids;
}

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