mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 06:04:30 -04:00
tests for invocies
This commit is contained in:
parent
47e35fe4d1
commit
0a49bd4afa
@ -1338,7 +1338,8 @@ class CompanyImport implements ShouldQueue
|
||||
unset($obj_array[$un]);
|
||||
}
|
||||
|
||||
if ($class instanceof CompanyGateway) {
|
||||
if ($class == 'App\Models\CompanyGateway') {
|
||||
|
||||
if (Ninja::isHosted() && $obj_array['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23') {
|
||||
$obj_array['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34';
|
||||
}
|
||||
|
@ -11,13 +11,15 @@
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Invoice;
|
||||
use Tests\MockAccountData;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -47,6 +49,32 @@ class InvoiceTest extends TestCase
|
||||
$this->invoice_calc = new InvoiceSum($this->invoice);
|
||||
}
|
||||
|
||||
public function testRoundingWithLargeUnitCostPrecision()
|
||||
{
|
||||
$invoice = InvoiceFactory::create($this->company->id, $this->user->id);
|
||||
$invoice->client_id = $this->client->id;
|
||||
$invoice->uses_inclusive_taxes = false;
|
||||
|
||||
$line_items = [];
|
||||
|
||||
$line_item = new InvoiceItem;
|
||||
$line_item->quantity = 1;
|
||||
$line_item->cost = 82.6446;
|
||||
$line_item->tax_rate1 = 21;
|
||||
$line_item->tax_name1 = 'Test';
|
||||
$line_item->product_key = 'Test';
|
||||
$line_item->notes = 'Test';
|
||||
$line_items[] = $line_item;
|
||||
|
||||
$invoice->line_items = $line_items;
|
||||
$invoice->save();
|
||||
|
||||
$invoice = $invoice->calc()->getInvoice();
|
||||
|
||||
$this->assertEquals(100, $invoice->amount);
|
||||
|
||||
}
|
||||
|
||||
public function testInclusiveRounding()
|
||||
{
|
||||
$this->invoice->line_items = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user