function EditorSanitizeImageUploadSettingsUpdateTest::testUpdateRemoveMeaninglessImageUploadSettings

Same name in other branches
  1. 11.x core/modules/editor/tests/src/Functional/Update/EditorSanitizeImageUploadSettingsUpdateTest.php \Drupal\Tests\editor\Functional\Update\EditorSanitizeImageUploadSettingsUpdateTest::testUpdateRemoveMeaninglessImageUploadSettings()

Ensure image upload settings for Text Editor config entities are corrected.

See also

editor_post_update_sanitize_image_upload_settings()

File

core/modules/editor/tests/src/Functional/Update/EditorSanitizeImageUploadSettingsUpdateTest.php, line 36

Class

EditorSanitizeImageUploadSettingsUpdateTest
@group Update @group editor

Namespace

Drupal\Tests\editor\Functional\Update

Code

public function testUpdateRemoveMeaninglessImageUploadSettings() : void {
    $basic_html_before = $this->config('editor.editor.basic_html');
    $this->assertSame([
        'status' => TRUE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => '',
        'max_dimensions' => [
            'width' => 0,
            'height' => 0,
        ],
    ], $basic_html_before->get('image_upload'));
    $full_html_before = $this->config('editor.editor.full_html');
    $this->assertSame([
        'status' => TRUE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => '',
        'max_dimensions' => [
            'width' => 0,
            'height' => 0,
        ],
    ], $full_html_before->get('image_upload'));
    $umami_basic_html_before = $this->config('editor.editor.umami_basic_html');
    $this->assertSame([
        'status' => FALSE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => '',
        'max_dimensions' => [
            'width' => NULL,
            'height' => NULL,
        ],
    ], $umami_basic_html_before->get('image_upload'));
    $this->runUpdates();
    $basic_html_after = $this->config('editor.editor.basic_html');
    $this->assertNotSame($basic_html_before->get('image_upload'), $basic_html_after->get('image_upload'));
    $this->assertSame([
        'status' => TRUE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => NULL,
        'max_dimensions' => [
            'width' => NULL,
            'height' => NULL,
        ],
    ], $basic_html_after->get('image_upload'));
    $full_html_after = $this->config('editor.editor.full_html');
    $this->assertNotSame($full_html_before->get('image_upload'), $full_html_after->get('image_upload'));
    $this->assertSame([
        'status' => TRUE,
        'scheme' => 'public',
        'directory' => 'inline-images',
        'max_size' => NULL,
        'max_dimensions' => [
            'width' => NULL,
            'height' => NULL,
        ],
    ], $full_html_after->get('image_upload'));
    $umami_basic_html_after = $this->config('editor.editor.umami_basic_html');
    $this->assertNotSame($umami_basic_html_before->get('image_upload'), $umami_basic_html_after->get('image_upload'));
    $this->assertSame([
        'status' => FALSE,
    ], $umami_basic_html_after->get('image_upload'));
}

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