Test for palletes not existing

This commit is contained in:
Brabli
2022-08-14 21:37:19 +01:00
parent 2ac5d686bb
commit 10c252ea6d
2 changed files with 31 additions and 12 deletions

View File

@@ -4,13 +4,10 @@ declare(strict_types=1);
namespace Pcm\IconBundle\Tests\Twig\Functions;
use InvalidArgumentException;
use Pcm\IconBundle\DependencyInjection\PcmIconExtension;
use Pcm\IconBundle\Tests\TestKernel;
use Pcm\IconBundle\Twig\Functions\IconExtension;
use Pcm\IconBundle\Twig\Functions\IconNotFound;
use Pcm\IconBundle\Twig\Functions\PalleteNotFound;
use PHPUnit\Framework\TestCase;
use TypeError;
class IconExtensionTest extends TestCase
{
@@ -20,12 +17,7 @@ class IconExtensionTest extends TestCase
'primary' => [
'stroke' => 'stroke-primary',
'fill' => 'fill-primary'
],
'white' => [
'stroke' => 'stroke-white',
'fill' => 'fill-white'
],
]
];
/**
@@ -212,4 +204,11 @@ class IconExtensionTest extends TestCase
$this->assertDoesNotMatchRegularExpression('/fill="\s*#black\s*"/', $content);
$this->assertDoesNotMatchRegularExpression('/fill="\s*rgb\(0,\s*0,\s*0\)\s*"/', $content);
}
public function testThrowsIfPalleteIsNotFound(): void
{
$this->expectException(PalleteNotFound::class);
$this->icon->renderIcon(['icon' => self::ICON, 'colour' => 'red']);
}
}