added json, xml and txt invoice renderer (#1576)

This commit is contained in:
Kevin Papst
2020-03-21 01:01:47 +01:00
committed by GitHub
parent c89750fe94
commit 1ca1b00d11
19 changed files with 560 additions and 53 deletions

View File

@@ -50,7 +50,7 @@ class ExtensionsTest extends TestCase
public function testGetFilters()
{
$filters = ['duration', 'duration_decimal', 'money', 'currency', 'country', 'language', 'amount', 'docu_link'];
$filters = ['duration', 'duration_decimal', 'money', 'currency', 'country', 'language', 'amount', 'docu_link', 'multiline_indent'];
$sut = $this->getSut($this->localeDe);
$twigFilters = $sut->getFilters();
$this->assertCount(count($filters), $twigFilters);
@@ -305,4 +305,43 @@ class ExtensionsTest extends TestCase
$this->assertNull($sut->getClassName(null));
$this->assertEquals('App\Entity\User', $sut->getClassName(new User()));
}
public function getMultilineTestData()
{
return [
[' ', null, ['']],
[' ', '', ['']],
[' ', 0, [' 0']],
[' ', 'sdfsdf
sdfsdf
aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh
dfsdfsdfsdfsdf',
[' sdfsdf', ' sdfsdf', ' ', ' aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh', ' dfsdfsdfsdfsdf']
],
['###', 'sdfsdf' . PHP_EOL .
'sdfsdf' . PHP_EOL .
'' . PHP_EOL .
' aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh' . PHP_EOL .
'dfsdfsdfsdfsdf',
['###sdfsdf', '###sdfsdf', '###', '### aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh', '###dfsdfsdfsdfsdf']
],
[' ', 'sdfsdf' . "\r\n" .
'sdfsdf' . "\r\n" .
'' . "\r\n" .
' aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh' . "\r\n" .
'dfsdfsdfsdfsdf',
[' sdfsdf', ' sdfsdf', ' ', ' aksljdfh laksjd hflka sjhdf lakjhsdflak jsdfh', ' dfsdfsdfsdfsdf']
],
];
}
/**
* @dataProvider getMultilineTestData
*/
public function testMultilineIndent($indent, $string, $expected)
{
$sut = $this->getSut($this->localeEn);
self::assertEquals(implode("\n", $expected), $sut->multilineIndent($string, $indent));
}
}