function IconTest::testPreRenderIconEmptyValues

Test the Icon::preRenderIcon method.

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconTest.php, line 218

Class

IconTest
@coversDefaultClass \Drupal\Core\Render\Element\Icon[[api-linebreak]]

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testPreRenderIconEmptyValues() : void {
  $element = [
    '#type' => 'icon',
    '#pack_id' => '',
    '#icon_id' => '',
  ];
  $prophecy = $this->prophesize(IconPackManagerInterface::class);
  $prophecy->getIcon(':')
    ->willReturn(NULL);
  $pluginManagerIconPack = $prophecy->reveal();
  $this->container
    ->set('plugin.manager.icon_pack', $pluginManagerIconPack);
  $actual = Icon::preRenderIcon($element);
  $this->assertEquals($element, $actual);
}

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