function IconDefinitionTest::providerCreateIcon

Data provider for ::testCreateIcon().

Return value

\Generator The test cases.

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconDefinitionTest.php, line 26

Class

IconDefinitionTest
@coversDefaultClass \Drupal\Core\Theme\Icon\IconDefinition

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public static function providerCreateIcon() : iterable {
    (yield 'minimal icon' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
        ],
    ]);
    (yield 'icon with source' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
            'source' => 'foo/bar',
        ],
    ]);
    (yield 'icon with empty source' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
            'source' => '',
        ],
    ]);
    (yield 'icon with empty data' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
            'source' => '',
            'group' => '',
            'data' => [
                'content' => '',
                'library' => '',
            ],
        ],
    ]);
    (yield 'icon with null data' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
            'source' => NULL,
            'group' => NULL,
            'data' => [
                'content' => NULL,
                'library' => NULL,
            ],
        ],
    ]);
    (yield 'icon with data' => [
        [
            'pack_id' => 'foo',
            'icon_id' => 'bar',
            'template' => 'baz',
            'source' => 'foo/bar',
            'group' => 'quux',
            'data' => [
                'content' => 'corge',
                'label' => new TranslatableMarkup('Qux'),
                'library' => 'foo/bar',
                'foo' => 'bar',
            ],
        ],
    ]);
}

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