function SvgSpriteExtractorTest::providerDiscoverIconsSvgSprite
Data provider for ::testDiscoverIconsSvgSprite().
Return value
\Generator The test cases.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ Plugin/ SvgSpriteExtractorTest.php, line 67
Class
- SvgSpriteExtractorTest
- @coversDefaultClass \Drupal\Core\Theme\Plugin\IconExtractor\SvgSpriteExtractor
Namespace
Drupal\Tests\Core\Theme\Icon\PluginCode
public static function providerDiscoverIconsSvgSprite() : iterable {
(yield 'empty' => []);
(yield 'svg not sprite is ignored' => [
[
'foo' => [
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
[
'/path/source/foo.svg',
'<svg xmlns="https://www.w3.org/2000/svg"><path d="M8 15a.5.5 0 0 0"/></svg>',
],
],
[],
]);
(yield 'svg sprite with one symbol' => [
[
'foo' => [
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
'group' => NULL,
],
],
[
[
'/path/source/foo.svg',
'<svg><symbol id="bar"></symbol></svg>',
],
],
[
'bar',
],
]);
(yield 'single file with multiple symbol' => [
[
'foo' => [
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
[
'/path/source/foo.svg',
'<svg><symbol id="foo"></symbol><symbol id="bar"></symbol></svg>',
],
],
[
'foo',
'bar',
],
]);
(yield 'single file with multiple symbol in defs' => [
[
'foo' => [
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
[
'/path/source/foo.svg',
'<svg><defs><symbol id="foo"></symbol><symbol id="bar"></symbol></defs></svg>',
],
],
[
'foo',
'bar',
],
]);
(yield 'suspicious symbol id ignored' => [
[
'foo' => [
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
[
'/path/source/foo.svg',
'<svg><symbol id="!script"></symbol><symbol id="not valid"></symbol><symbol id="_foo-bar_"></symbol></svg>',
],
],
[
'_foo-bar_',
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.