Throw specific error if file is found to be empty

This commit is contained in:
2024-01-11 16:22:14 +00:00
parent a19f1f4438
commit 3da5e00361
2 changed files with 12 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ namespace Pcm\IconBundle\Tests\Twig\Functions;
use Pcm\IconBundle\DependencyInjection\Configuration;
use Pcm\IconBundle\Exception\ColourNotFound;
use Pcm\IconBundle\Exception\EmptyFileException;
use Pcm\IconBundle\Exception\IconNotFound;
use Pcm\IconBundle\Twig\Runtime\IconRuntime;
use PHPUnit\Framework\TestCase;
@@ -50,6 +51,12 @@ class IconRuntimeTest extends TestCase
$this->icon->renderIcon(['icon' => random_bytes(8)]);
}
public function testThrowsIfPassedInAnEmptyFile(): void
{
$this->expectException(EmptyFileException::class);
$this->icon->renderIcon(['icon' => 'empty']);
}
public function testNoTitleExistsIfNotPassedIn(): void
{
$content = $this->icon->renderIcon(['icon' => self::ICON]);