Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -9,31 +9,35 @@
|
||||
|
||||
namespace App\Tests\Entity;
|
||||
|
||||
use App\Entity\InvoiceDocument;
|
||||
use App\Model\InvoiceDocument;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Entity\InvoiceDocument
|
||||
* @covers \App\Model\InvoiceDocument
|
||||
*/
|
||||
class InvoiceDocumentTest extends TestCase
|
||||
{
|
||||
public function testDefaultValues()
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$dir = realpath(__DIR__ . '/../../templates/invoice/renderer');
|
||||
$sut = new InvoiceDocument(new \SplFileInfo($dir . '/default.html.twig'));
|
||||
$sut = new InvoiceDocument(new \SplFileInfo($dir . '/invoice.html.twig'));
|
||||
|
||||
self::assertEquals('twig', $sut->getFileExtension());
|
||||
self::assertStringContainsString('templates/invoice/renderer/default.html.twig', $sut->getFilename());
|
||||
self::assertEquals('default', $sut->getId());
|
||||
self::assertEquals('default.html.twig', $sut->getName());
|
||||
self::assertStringContainsString('templates/invoice/renderer/invoice.html.twig', $sut->getFilename());
|
||||
self::assertEquals('invoice', $sut->getId());
|
||||
self::assertEquals('invoice.html.twig', $sut->getName());
|
||||
self::assertIsInt($sut->getLastChange());
|
||||
}
|
||||
|
||||
public function testThrowsOnDeletedFile()
|
||||
public function testThrowsOnDeletedFile(): void
|
||||
{
|
||||
$catchedException = false;
|
||||
|
||||
$dir = realpath(__DIR__ . '/../../templates/invoice/renderer');
|
||||
if ($dir === false) {
|
||||
throw new \Exception('Directory for invoice renderer could not be accessed');
|
||||
}
|
||||
|
||||
$file = tempnam($dir, 'invoice-renderer');
|
||||
|
||||
if ($file !== false) {
|
||||
|
||||
Reference in New Issue
Block a user