function ImageUploadTest::createEditorWithUpload

Same name in other branches
  1. 10 core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php \Drupal\Tests\ckeditor5\Functional\ImageUploadTest::createEditorWithUpload()
  2. 11.x core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php \Drupal\Tests\ckeditor5\Functional\ImageUploadTest::createEditorWithUpload()

Create an editor entity with image_upload config.

Parameters

array $upload_config: The editor image_upload config.

Return value

\Drupal\Core\Entity\EntityBase|\Drupal\Core\Entity\EntityInterface The text editor entity.

Throws

\Drupal\Core\Entity\EntityStorageException

4 calls to ImageUploadTest::createEditorWithUpload()
ImageUploadAccessTest::testCkeditor5ImageUploadRoute in core/modules/ckeditor5/tests/src/Functional/ImageUploadAccessTest.php
Test access to the CKEditor 5 image upload controller.
ImageUploadTest::testFileUploadLargerFileSize in core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php
Tests using the file upload route with a file size larger than allowed.
ImageUploadTest::testLockAfterFailedValidation in core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php
Test that lock is removed after a failed validation.
ImageUploadTest::testUploadFileExtension in core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php
Tests using the file upload route with a disallowed extension.

File

core/modules/ckeditor5/tests/src/Functional/ImageUploadTest.php, line 217

Class

ImageUploadTest
Test image upload.

Namespace

Drupal\Tests\ckeditor5\Functional

Code

protected function createEditorWithUpload(array $upload_config) {
    $editor = Editor::create([
        'editor' => 'ckeditor5',
        'format' => 'basic_html',
        'settings' => [
            'toolbar' => [
                'items' => [
                    'drupalInsertImage',
                ],
            ],
            'plugins' => [],
        ],
        'image_upload' => $upload_config,
    ]);
    $editor->save();
    return $editor;
}

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