function IconDefinitionTest::testGetRenderable

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Theme/Icon/IconDefinitionTest.php \Drupal\Tests\Core\Theme\Icon\IconDefinitionTest::testGetRenderable()

Test the IconDefinition::getRenderable method.

File

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

Class

IconDefinitionTest
Tests Drupal\Core\Theme\Icon\IconDefinition.

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetRenderable() : void {
  $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.