You are here

protected function EditorTest::createEntity in JSON:API 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/EditorTest.php \Drupal\Tests\jsonapi\Functional\EditorTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides ResourceTestBase::createEntity

File

tests/src/Functional/EditorTest.php, line 50

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' => 'ckeditor',
  ]);
  $camelids
    ->setImageUploadSettings([
    'status' => FALSE,
    'scheme' => file_default_scheme(),
    'directory' => 'inline-images',
    'max_size' => '',
    'max_dimensions' => [
      'width' => '',
      'height' => '',
    ],
  ])
    ->save();
  return $camelids;
}