Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -9,26 +9,24 @@
|
||||
|
||||
namespace App\Tests\Invoice\NumberGenerator;
|
||||
|
||||
use App\Configuration\SystemConfiguration;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\User;
|
||||
use App\Invoice\NumberGenerator\ConfigurableNumberGenerator;
|
||||
use App\Repository\InvoiceRepository;
|
||||
use App\Tests\Invoice\DebugFormatter;
|
||||
use App\Tests\Mocks\InvoiceModelFactoryFactory;
|
||||
use App\Tests\Mocks\SystemConfigurationFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Invoice\NumberGenerator\ConfigurableNumberGenerator
|
||||
* @covers \App\Utils\NumberGenerator
|
||||
*/
|
||||
class ConfigurableNumberGeneratorTest extends TestCase
|
||||
{
|
||||
private function getSut(string $format, int $counter = 1)
|
||||
{
|
||||
$config = $this->createMock(SystemConfiguration::class);
|
||||
$config->expects($this->any())
|
||||
->method('find')
|
||||
->willReturn($format);
|
||||
$config = SystemConfigurationFactory::createStub(['invoice' => ['number_format' => $format]]);
|
||||
|
||||
$repository = $this->createMock(InvoiceRepository::class);
|
||||
$repository
|
||||
@@ -147,8 +145,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
*/
|
||||
public function testGetInvoiceNumber(string $format, string $expectedInvoiceNumber, \DateTime $invoiceDate, int $counter = 1)
|
||||
{
|
||||
$customer = new Customer();
|
||||
$customer->setName('Acme company');
|
||||
$customer = new Customer('Acme company');
|
||||
$customer->setNumber('0815');
|
||||
|
||||
$user = $this->createMock(User::class);
|
||||
@@ -199,7 +196,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
$sut = $this->getSut($format);
|
||||
$model = (new InvoiceModelFactoryFactory($this))->create()->createModel(new DebugFormatter());
|
||||
$model->setInvoiceDate($invoiceDate);
|
||||
$model->setCustomer(new Customer());
|
||||
$model->setCustomer(new Customer('foo'));
|
||||
$sut->setModel($model);
|
||||
|
||||
$sut->getInvoiceNumber();
|
||||
|
||||
Reference in New Issue
Block a user