function IconDefinitionTest::testGetRenderable

Test the IconDefinition::getRenderable method.

File

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

Class

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

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetRenderable() : void {
    $icon = IconDefinition::create('foo', 'bar', '_template_');
    $expected = [
        '#type' => 'icon',
        '#pack_id' => 'foo',
        '#icon_id' => 'bar',
        '#settings' => [
            'baz' => 'corge',
        ],
    ];
    $actual = IconDefinition::getRenderable('foo:bar', [
        'baz' => 'corge',
    ]);
    $this->assertEquals($expected, $actual);
}

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