function SvgSpriteExtractorTest::testDiscoverIconsSvgSpriteInvalid
Test the SvgSpriteExtractor::discoverIcons() method with invalid svg.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ Plugin/ SvgSpriteExtractorTest.php, line 180
Class
- SvgSpriteExtractorTest
- @coversDefaultClass \Drupal\Core\Theme\Plugin\IconExtractor\SvgSpriteExtractor
Namespace
Drupal\Tests\Core\Theme\Icon\PluginCode
public function testDiscoverIconsSvgSpriteInvalid() : void {
$icon = [
'icon_id' => 'foo',
'source' => '/path/source/foo.svg',
];
$this->iconFinder
->method('getFilesFromSources')
->willReturn($icon);
$this->iconFinder
->method('getFileContents')
->willReturn('Not valid svg');
$icons = $this->svgSpriteExtractorPlugin
->discoverIcons();
$this->assertEmpty($icons);
foreach (libxml_get_errors() as $error) {
$this->assertSame("Start tag expected, '<' not found", trim($error->message));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.