added new invoice fields, improved invoice templates (#1258)
This commit is contained in:
@@ -33,7 +33,7 @@ class CsvRendererTest extends TestCase
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('timesheet.html.twig')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('foo.html.twig')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('export.csv')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('export.csv', true)));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods')));
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class CsvRendererTest extends TestCase
|
||||
{
|
||||
/** @var CsvRenderer $sut */
|
||||
$sut = $this->getAbstractRenderer(CsvRenderer::class);
|
||||
$document = $this->getInvoiceDocument('export.csv');
|
||||
$document = $this->getInvoiceDocument('export.csv', true);
|
||||
/** @var BinaryFileResponse $response */
|
||||
$response = $sut->render($document, $model);
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ class DebugRendererTest extends TestCase
|
||||
'template.title',
|
||||
'template.payment_terms',
|
||||
'template.due_days',
|
||||
'template.vat_id',
|
||||
'template.contact',
|
||||
'template.payment_details',
|
||||
'query.begin',
|
||||
'query.day',
|
||||
'query.end',
|
||||
@@ -84,6 +87,7 @@ class DebugRendererTest extends TestCase
|
||||
'customer.name',
|
||||
'customer.contact',
|
||||
'customer.company',
|
||||
'customer.vat',
|
||||
'customer.country',
|
||||
'customer.number',
|
||||
'customer.homepage',
|
||||
|
||||
@@ -35,7 +35,7 @@ class OdsRendererTest extends TestCase
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('export.csv')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods', true)));
|
||||
}
|
||||
|
||||
public function getTestModel()
|
||||
@@ -52,7 +52,7 @@ class OdsRendererTest extends TestCase
|
||||
/** @var OdsRenderer $sut */
|
||||
$sut = $this->getAbstractRenderer(OdsRenderer::class);
|
||||
$model = $this->getInvoiceModel();
|
||||
$document = $this->getInvoiceDocument('open-spreadsheet.ods');
|
||||
$document = $this->getInvoiceDocument('open-spreadsheet.ods', true);
|
||||
/** @var BinaryFileResponse $response */
|
||||
$response = $sut->render($document, $model);
|
||||
|
||||
|
||||
@@ -47,10 +47,16 @@ trait RendererTestTrait
|
||||
* @param string $filename
|
||||
* @return InvoiceDocument
|
||||
*/
|
||||
protected function getInvoiceDocument(string $filename)
|
||||
protected function getInvoiceDocument(string $filename, bool $testOnly = false)
|
||||
{
|
||||
if (!$testOnly) {
|
||||
return new InvoiceDocument(
|
||||
new \SplFileInfo($this->getInvoiceTemplatePath() . $filename)
|
||||
);
|
||||
}
|
||||
|
||||
return new InvoiceDocument(
|
||||
new \SplFileInfo($this->getInvoiceTemplatePath() . $filename)
|
||||
new \SplFileInfo(__DIR__ . '/../templates/' . $filename)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class XlsxRendererTest extends TestCase
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('foo.html.twig')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx')));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('export.csv')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx')));
|
||||
$this->assertTrue($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx', true)));
|
||||
$this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods')));
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class XlsxRendererTest extends TestCase
|
||||
/** @var XlsxRenderer $sut */
|
||||
$sut = $this->getAbstractRenderer(XlsxRenderer::class);
|
||||
$model = $this->getInvoiceModel();
|
||||
$document = $this->getInvoiceDocument('spreadsheet.xlsx');
|
||||
$document = $this->getInvoiceDocument('spreadsheet.xlsx', true);
|
||||
/** @var BinaryFileResponse $response */
|
||||
$response = $sut->render($document, $model);
|
||||
|
||||
|
||||
2
tests/Invoice/templates/export.csv
Normal file
2
tests/Invoice/templates/export.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
start_date,start_timestamp,end_date,end_timestamp,duration,username,description,rate,amount,total
|
||||
${entry.begin},${entry.begin_timestamp},${entry.end},${entry.end_timestamp},${entry.duration},${entry.user_name},${entry.description},${entry.rate},${entry.amount},${entry.total}
|
||||
|
BIN
tests/Invoice/templates/open-spreadsheet.ods
Normal file
BIN
tests/Invoice/templates/open-spreadsheet.ods
Normal file
Binary file not shown.
BIN
tests/Invoice/templates/spreadsheet.xlsx
Normal file
BIN
tests/Invoice/templates/spreadsheet.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user