function IconTest::testGetInfo

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

Test the Icon::getInfo method.

File

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

Class

IconTest
Tests Drupal\Core\Render\Element\Icon.

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testGetInfo() : void {
  $icon = new Icon([], 'test', 'test');
  $info = $icon->getInfo();
  $this->assertArrayHasKey('#pre_render', $info);
  $this->assertArrayHasKey('#pack_id', $info);
  $this->assertArrayHasKey('#icon_id', $info);
  $this->assertArrayHasKey('#settings', $info);
  $this->assertSame([
    [
      'Drupal\\Core\\Render\\Element\\Icon',
      'preRenderIcon',
    ],
  ], $info['#pre_render']);
  $this->assertSame([], $info['#settings']);
}

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