function SvgExtractorTest::providerLoadIconSvg
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Theme/Icon/Plugin/SvgExtractorTest.php \Drupal\Tests\Core\Theme\Icon\Plugin\SvgExtractorTest::providerLoadIconSvg()
Data provider for ::testLoadIconSvg().
Return value
\Generator The test cases, icons data returned by SvgExtractor::discoverIcons.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ Plugin/ SvgExtractorTest.php, line 177
Class
Namespace
Drupal\Tests\Core\Theme\Icon\PluginCode
public static function providerLoadIconSvg() {
yield 'svg file empty' => [
[
[
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
'',
],
];
yield 'svg file' => [
[
[
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
'<svg xmlns="https://www.w3.org/2000/svg"><g><path d="M8 15a.5.5 0 0 0"/></g></svg>',
],
[
'<g><path d="M8 15a.5.5 0 0 0"/></g>',
],
];
yield 'svg file with group' => [
[
[
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
'group' => 'bar',
],
],
[
'<svg xmlns="https://www.w3.org/2000/svg"><g><path d="M8 15a.5.5 0 0 0"/></g></svg>',
],
[
'<g><path d="M8 15a.5.5 0 0 0"/></g>',
],
];
yield 'svg file with attributes' => [
[
[
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
'<svg xmlns="https://www.w3.org/2000/svg" data-foo="bar" data-baz="foo"><g><path d="M8 15a.5.5 0 0 0"/></g></svg>',
],
[
'<g><path d="M8 15a.5.5 0 0 0"/></g>',
],
[
[
'data-foo' => 'bar',
'data-baz' => 'foo',
],
],
];
yield 'svg sprite is ignored' => [
[
[
'icon_id' => 'foo',
'source' => 'source/foo.svg',
'absolute_path' => '/path/source/foo.svg',
],
],
[
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol id="foo"><g><path d="M8 15a.5.5 0 0 0"/></g></symbol>/svg>',
],
[
'',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.