mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 15:14:34 -04:00
Tests for taxes
This commit is contained in:
parent
0cd0a42d9a
commit
c9fab675c8
@ -31,7 +31,7 @@ class ClientPresenter extends EntityPresenter
|
||||
|
||||
$contact_name = 'No Contact Set';
|
||||
|
||||
if ($contact && (strlen($contact->first_name) >= 1 || strlen($contact->last_name) >= 1)) {
|
||||
if ($contact && ((is_string($contact->first_name) && strlen($contact->first_name) >= 1) || (is_string($contact->last_name) && strlen($contact->last_name) >= 1))) {
|
||||
$contact_name = $contact->first_name.' '.$contact->last_name;
|
||||
} elseif ($contact && (strlen($contact->email))) {
|
||||
$contact_name = $contact->email;
|
||||
|
@ -93,7 +93,7 @@ trait PdfMakerUtilities
|
||||
|
||||
if ($child['element'] !== 'script') {
|
||||
if (array_key_exists('process_markdown', $this->data) && array_key_exists('content', $child) && $this->data['process_markdown']) {
|
||||
$child['content'] = str_replace('<br>', "\r", $child['content']);
|
||||
$child['content'] = str_replace('<br>', "\r", ($child['content'] ?? ''));
|
||||
$child['content'] = $this->commonmark->convert($child['content'] ?? '');
|
||||
}
|
||||
}
|
||||
|
@ -24,23 +24,7 @@ class SumTaxTest extends TestCase
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
// $this->makeTestData();
|
||||
}
|
||||
|
||||
public function testSumOfInvoice()
|
||||
{
|
||||
|
||||
$response =
|
||||
public array $response =
|
||||
["results" => [
|
||||
[
|
||||
"geoPostalCode" => "92582",
|
||||
@ -81,6 +65,50 @@ class SumTaxTest extends TestCase
|
||||
]
|
||||
];
|
||||
|
||||
nlog($response);
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->withoutMiddleware(
|
||||
ThrottleRequests::class
|
||||
);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
// $this->makeTestData();
|
||||
}
|
||||
|
||||
public function testSumOfInvoice()
|
||||
{
|
||||
|
||||
$this->assertEquals("CA", $this->response['results'][0]['geoState']);
|
||||
|
||||
}
|
||||
|
||||
public function testSumOfTaxes()
|
||||
{
|
||||
$sum =
|
||||
$this->response['results'][0]['stateSalesTax'] +
|
||||
// $this->response['results'][0]['stateUseTax'] +
|
||||
$this->response['results'][0]['citySalesTax'] +
|
||||
// $this->response['results'][0]['cityUseTax'] +
|
||||
$this->response['results'][0]['countySalesTax'] +
|
||||
// $this->response['results'][0]['countyUseTax'] +
|
||||
$this->response['results'][0]['districtSalesTax'];
|
||||
// // $this->response['results'][0]['districtUseTax'] +
|
||||
// $this->response['results'][0]['district1SalesTax'] +
|
||||
// // $this->response['results'][0]['district1UseTax'] +
|
||||
// $this->response['results'][0]['district2SalesTax'] +
|
||||
// // $this->response['results'][0]['district2UseTax'] +
|
||||
// $this->response['results'][0]['district3SalesTax'] +
|
||||
// // $this->response['results'][0]['district3UseTax'] +
|
||||
// $this->response['results'][0]['district4SalesTax'] +
|
||||
// // $this->response['results'][0]['district4UseTax'] +
|
||||
// $this->response['results'][0]['district5SalesTax'];
|
||||
// $this->response['results'][0]['district5UseTax'];
|
||||
|
||||
$this->assertEquals(0.0875, $sum);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user