allow increasing invoice numbers per day (#2433)

This commit is contained in:
Kevin Papst
2021-03-14 13:53:36 +01:00
committed by GitHub
parent c0378b4f51
commit 9a2fd9ba91
8 changed files with 142 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ use App\Entity\Project;
use App\Invoice\InvoiceFilename;
use App\Invoice\InvoiceModel;
use App\Invoice\NumberGenerator\DateNumberGenerator;
use App\Repository\InvoiceRepository;
use App\Repository\Query\InvoiceQuery;
use PHPUnit\Framework\TestCase;
@@ -29,7 +30,7 @@ class InvoiceFilenameTest extends TestCase
$template = new InvoiceTemplate();
$model = new InvoiceModel(new DebugFormatter());
$model->setNumberGenerator(new DateNumberGenerator());
$model->setNumberGenerator($this->getNumberGeneratorSut());
$model->setTemplate($template);
$model->setCustomer($customer);
@@ -71,4 +72,15 @@ class InvoiceFilenameTest extends TestCase
$sut = new InvoiceFilename($model);
self::assertEquals($datePrefix . '-ss_n_--Demo_ProjecT1', $sut->getFilename());
}
private function getNumberGeneratorSut()
{
$repository = $this->createMock(InvoiceRepository::class);
$repository
->expects($this->any())
->method('hasInvoice')
->willReturn(false);
return new DateNumberGenerator($repository);
}
}