function HeadingPluginTest::providerGetDynamicPluginConfig

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

Provides a list of configs to test.

File

core/modules/ckeditor5/tests/src/Unit/HeadingPluginTest.php, line 22

Class

HeadingPluginTest
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language @group ckeditor5 @internal

Namespace

Drupal\Tests\ckeditor5\Unit

Code

public function providerGetDynamicPluginConfig() : array {
    // Prepare headings matching ckeditor5.ckeditor5.yml to also protect
    // against unexpected changes to the YAML file given the YAML file is used
    // to generate the dynamic plugin configuration.
    $paragraph = [
        'model' => 'paragraph',
        'title' => 'Paragraph',
        'class' => 'ck-heading_paragraph',
    ];
    $headings = [];
    foreach (range(2, 6) as $number) {
        $headings[$number] = [
            'model' => 'heading' . $number,
            'view' => 'h' . $number,
            'title' => 'Heading ' . $number,
            'class' => 'ck-heading_heading' . $number,
        ];
    }
    return [
        'All headings' => [
            Heading::DEFAULT_CONFIGURATION,
            [
                'heading' => [
                    'options' => [
                        $paragraph,
                        $headings[2],
                        $headings[3],
                        $headings[4],
                        $headings[5],
                        $headings[6],
                    ],
                ],
            ],
        ],
        'Only required headings' => [
            [
                'enabled_headings' => [],
            ],
            [
                'heading' => [
                    'options' => [
                        $paragraph,
                    ],
                ],
            ],
        ],
        'Heading 2 only' => [
            [
                'enabled_headings' => [
                    'heading2',
                ],
            ],
            [
                'heading' => [
                    'options' => [
                        $paragraph,
                        $headings[2],
                    ],
                ],
            ],
        ],
        'Heading 2 and 3 only' => [
            [
                'enabled_headings' => [
                    'heading2',
                    'heading3',
                ],
            ],
            [
                'heading' => [
                    'options' => [
                        $paragraph,
                        $headings[2],
                        $headings[3],
                    ],
                ],
            ],
        ],
    ];
}

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