function ExtractorTest::testLoadIcon
Test the IconExtractorBase:loadIcon.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ Plugin/ ExtractorTest.php, line 153
Class
- ExtractorTest
- Tests icon extractor with base and finder base plugin.
Namespace
Drupal\Tests\Core\Theme\Icon\PluginCode
public function testLoadIcon() : void {
$icon_data = [
'icon_id' => 'foo',
'source' => 'path/foo.svg',
'group' => 'bar',
];
$extractorPlugin = new TestExtractor([
'id' => $this->pluginId,
'template' => '_bar_',
], $this->pluginId, []);
$icon = $extractorPlugin->loadIcon($icon_data);
$this->assertInstanceOf(IconDefinitionInterface::class, $icon);
$this->assertSame($icon_data['icon_id'], $icon->getIconId());
$this->assertSame($icon_data['source'], $icon->getSource());
$this->assertSame($icon_data['group'] ?? NULL, $icon->getGroup());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.