function SvgExtractorTest::testLoadIconSvgInvalid
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::testLoadIconSvgInvalid()
Test the SvgExtractor::loadIcon() method with invalid svg.
File
-
core/
tests/ Drupal/ Tests/ Core/ Theme/ Icon/ Plugin/ SvgExtractorTest.php, line 316
Class
Namespace
Drupal\Tests\Core\Theme\Icon\PluginCode
public function testLoadIconSvgInvalid() : void {
$icon = [
'icon_id' => 'foo',
'source' => '/path/source/foo.svg',
];
// IconFinder::getFileContents() will not be called because of an early
// return when $icon['absolute_path'] is not set.
$this->iconFinder
->expects($this->never())
->method('getFileContents');
$icon_loaded = $this->svgExtractorPlugin
->loadIcon($icon);
$this->assertNull($icon_loaded);
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.