function CKEditor5UpdateImageToolbarItemTest::provider

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateImageToolbarItemTest.php \Drupal\Tests\ckeditor5\Functional\Update\CKEditor5UpdateImageToolbarItemTest::provider()
  2. 11.x core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateImageToolbarItemTest.php \Drupal\Tests\ckeditor5\Functional\Update\CKEditor5UpdateImageToolbarItemTest::provider()

Data provider for ::test().

Return value

array The test cases.

File

core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateImageToolbarItemTest.php, line 158

Class

CKEditor5UpdateImageToolbarItemTest
Tests the update path for the CKEditor 5 image toolbar item.

Namespace

Drupal\Tests\ckeditor5\Functional\Update

Code

public static function provider() : array {
    // There are 3 aspects that need to be verified, each can be true or false,
    // making for 8 test cases in total.
    $test_cases = [];
    foreach ([
        TRUE,
        FALSE,
    ] as $filter_html_is_enabled) {
        $test_case_label_part_one = sprintf("filter_html %s", $filter_html_is_enabled ? 'enabled' : 'disabled');
        foreach ([
            TRUE,
            FALSE,
        ] as $image_uploads_enabled) {
            $test_case_label_part_two = sprintf("image uploads %s", $image_uploads_enabled ? 'enabled' : 'disabled');
            foreach ([
                TRUE,
                FALSE,
            ] as $source_editing_already_enabled) {
                $test_case_label_part_three = sprintf("sourceEditing initially %s", $source_editing_already_enabled ? 'enabled' : 'disabled');
                // Generate the test case.
                $label = implode(', ', [
                    $test_case_label_part_one,
                    $test_case_label_part_two,
                    $test_case_label_part_three,
                ]);
                $test_cases[$label] = [
                    'filter_html' => $filter_html_is_enabled,
                    'image uploads' => $image_uploads_enabled,
                    'sourceEditing already enabled' => $source_editing_already_enabled,
                    'expected sourceEditing additions' => $image_uploads_enabled ? [] : [
                        '<img data-entity-uuid data-entity-type>',
                    ],
                ];
            }
        }
    }
    return $test_cases;
}

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