function ExtractorTest::testCreateIcon

Test the IconExtractorBase:createIcon method.

File

core/tests/Drupal/Tests/Core/Theme/Icon/Plugin/ExtractorTest.php, line 93

Class

ExtractorTest
Tests icon extractor with base and finder base plugin.

Namespace

Drupal\Tests\Core\Theme\Icon\Plugin

Code

public function testCreateIcon() : void {
    $extractorPlugin = new TestExtractor([
        'id' => $this->pluginId,
        'template' => '_bar_',
    ], $this->pluginId, []);
    $icon = $extractorPlugin->createIcon('foo');
    $expected = IconDefinition::create($this->pluginId, 'foo', '_bar_', NULL, NULL, [
        'id' => $this->pluginId,
    ]);
    $this->assertEquals($expected, $icon);
    $icon = $extractorPlugin->createIcon('foo', 'bar', 'baz', [
        'corge' => 'qux',
    ]);
    $expected = IconDefinition::create($this->pluginId, 'foo', '_bar_', 'bar', 'baz', [
        'id' => $this->pluginId,
        'corge' => 'qux',
    ]);
    $this->assertEquals($expected, $icon);
}

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