Throw more specific exception if an svg file's contents is invalid svg code
This commit is contained in:
@@ -8,6 +8,7 @@ use Pcm\IconBundle\DependencyInjection\Configuration;
|
||||
use Pcm\IconBundle\Exception\ColourNotFound;
|
||||
use Pcm\IconBundle\Exception\EmptyFileException;
|
||||
use Pcm\IconBundle\Exception\IconNotFound;
|
||||
use Pcm\IconBundle\Exception\InvalidSvgException;
|
||||
use Pcm\IconBundle\Twig\Runtime\IconRuntime;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -57,6 +58,12 @@ class IconRuntimeTest extends TestCase
|
||||
$this->icon->renderIcon(['icon' => 'empty']);
|
||||
}
|
||||
|
||||
public function testThrowsIfContentsIsNotValidSvg(): void
|
||||
{
|
||||
$this->expectException(InvalidSvgException::class);
|
||||
$this->icon->renderIcon(['icon' => 'invalid']);
|
||||
}
|
||||
|
||||
public function testNoTitleExistsIfNotPassedIn(): void
|
||||
{
|
||||
$content = $this->icon->renderIcon(['icon' => self::ICON]);
|
||||
|
||||
Reference in New Issue
Block a user