mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Testing PDF mocks
This commit is contained in:
parent
55cc1e46ce
commit
7772da95d3
@ -561,9 +561,9 @@ class PdfBuilder
|
||||
$data[$key][$table_type.".{$_table_type}4"] = strlen($item->custom_value4) >= 1 ? $helpers->formatCustomFieldValue($this->service->company->custom_fields, "{$_table_type}4", $item->custom_value4, $this->service->config->currency_entity) : '';
|
||||
|
||||
if ($item->quantity > 0 || $item->cost > 0) {
|
||||
$data[$key][$table_type.'.quantity'] = Number::formatValueNoTrailingZeroes($item->quantity, $this->service->config->currency_entity);
|
||||
$data[$key][$table_type.'.quantity'] = $this->service->config->formatMoney($item->quantity);
|
||||
|
||||
$data[$key][$table_type.'.unit_cost'] = Number::formatMoneyNoRounding($item->cost, $this->service->config->currency_entity);
|
||||
$data[$key][$table_type.'.unit_cost'] = $this->service->config->formatMoney($item->cost);
|
||||
|
||||
$data[$key][$table_type.'.cost'] = $this->service->config->formatMoney($item->cost);
|
||||
|
||||
|
@ -142,7 +142,7 @@ class PdfConfiguration
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
private function setPdfVariables() :self
|
||||
public function setPdfVariables() :self
|
||||
{
|
||||
$default = (array) CompanySettings::getEntityVariableDefaults();
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PdfMock
|
||||
private function getTaxMap()
|
||||
{
|
||||
|
||||
return collect( ['name' => 'GST', 'total' => 10]);
|
||||
return collect( [['name' => 'GST', 'total' => 10]]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,11 @@
|
||||
namespace Tests\Pdf;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Design;
|
||||
use App\Models\Country;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Currency;
|
||||
use App\Services\Pdf\PdfBuilder;
|
||||
use Tests\MockAccountData;
|
||||
use App\Services\Pdf\PdfMock;
|
||||
use Beganovich\Snappdf\Snappdf;
|
||||
@ -71,8 +73,25 @@ class PdfmockTest extends TestCase
|
||||
$pdf_config->entity_design_id = 'invoice_design_id';
|
||||
$pdf_config->settings_object = $mock->client;
|
||||
$pdf_config->entity_string = 'invoice';
|
||||
$pdf_config->settings = $pdf_config->service->company->settings;
|
||||
$pdf_config->settings = (object)$pdf_config->service->company->settings;
|
||||
$pdf_config->setPdfVariables();
|
||||
$pdf_config->design = Design::find(2);
|
||||
$pdf_config->currency_entity = $mock->client;
|
||||
|
||||
$pdf_service->config = $pdf_config;
|
||||
|
||||
$pdf_designer = (new \App\Services\Pdf\PdfDesigner($pdf_service))->build();
|
||||
$pdf_service->designer = $pdf_designer;
|
||||
|
||||
$pdf_service->html_variables = $this->getStubVariables();
|
||||
|
||||
$pdf_builder = (new PdfBuilder($pdf_service))->build();
|
||||
$pdf_service->builder = $pdf_builder;
|
||||
$this->assertNotNull($pdf_config);
|
||||
}
|
||||
|
||||
private function getStubVariables()
|
||||
{
|
||||
return ['values' => [], 'labels' => []];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user