function IconTest::testGetInfo

Test the Icon::getInfo method.

File

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

Class

IconTest
@coversDefaultClass \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.