Release 2.0.2 (#3856)
* allow to overwrite global spreadsheet styles * bump version * fix deprecations in vcard download * bump composer packages * added help page for all registered locales * fix menu id's, cleanup times route, fix configurable homepage redirect * format duration without leading zero in hours (unify javascript with php behavior) * fix active records in all screen sizes * improved responsiveness in XS * fixed invoice number for customer null fields * fix javascript respects multiple recent-activity dropdowns * show recent activities on small screens * fix user-profile layout column in XS * fix search is always marked as active
This commit is contained in:
@@ -24,7 +24,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class ConfigurableNumberGeneratorTest extends TestCase
|
||||
{
|
||||
private function getSut(string $format, int $counter = 1)
|
||||
private function getSut(string $format, int $counter = 1): ConfigurableNumberGenerator
|
||||
{
|
||||
$config = SystemConfigurationFactory::createStub(['invoice' => ['number_format' => $format]]);
|
||||
|
||||
@@ -53,7 +53,10 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
return new ConfigurableNumberGenerator($repository, $config);
|
||||
}
|
||||
|
||||
public function getTestData()
|
||||
/**
|
||||
* @return array<int, array<int, string|\DateTime|int>>
|
||||
*/
|
||||
public function getTestData(): array
|
||||
{
|
||||
$invoiceDate = new \DateTime();
|
||||
|
||||
@@ -143,7 +146,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testGetInvoiceNumber(string $format, string $expectedInvoiceNumber, \DateTime $invoiceDate, int $counter = 1)
|
||||
public function testGetInvoiceNumber(string $format, string $expectedInvoiceNumber, \DateTime $invoiceDate, int $counter = 1): void
|
||||
{
|
||||
$customer = new Customer('Acme company');
|
||||
$customer->setNumber('0815');
|
||||
@@ -163,7 +166,10 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
$this->assertEquals('default', $sut->getId());
|
||||
}
|
||||
|
||||
public function getInvalidTestData()
|
||||
/**
|
||||
* @return array<int, array<int, string|\DateTime>>
|
||||
*/
|
||||
public function getInvalidTestData(): array
|
||||
{
|
||||
$invoiceDate = new \DateTime();
|
||||
|
||||
@@ -188,7 +194,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getInvalidTestData
|
||||
*/
|
||||
public function testInvalidGetInvoiceNumber(string $format, \DateTime $invoiceDate, string $brokenPart)
|
||||
public function testInvalidGetInvoiceNumber(string $format, \DateTime $invoiceDate, string $brokenPart): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage(sprintf('Unknown %s found', $brokenPart));
|
||||
@@ -201,4 +207,40 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
|
||||
$sut->getInvoiceNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string>>
|
||||
*/
|
||||
public function getMissingFieldTestData(): array
|
||||
{
|
||||
return [
|
||||
['{Y}/{cnumber}_{ccy,3}', 'Customer has no number, replacer {cnumber} failed evaluation'],
|
||||
['{Y}/{cname}_{ccy,3}', 'Customer has no name, replacer {cname} failed evaluation'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getMissingFieldTestData
|
||||
*/
|
||||
public function testCustomerHasMissingField(string $format, string $message): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage($message);
|
||||
|
||||
$user = $this->createMock(User::class);
|
||||
$user->method('getId')->willReturn(13);
|
||||
$user->method('getAccountNumber')->willReturn('0815');
|
||||
|
||||
$customer = new Customer('');
|
||||
$customer->setName(null);
|
||||
|
||||
$sut = $this->getSut($format);
|
||||
$model = (new InvoiceModelFactoryFactory($this))->create()->createModel(new DebugFormatter());
|
||||
$model->setInvoiceDate(new \DateTime());
|
||||
$model->setCustomer($customer);
|
||||
$model->setUser($user);
|
||||
$sut->setModel($model);
|
||||
|
||||
$sut->getInvoiceNumber();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user