mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Tests for client currency conversion
This commit is contained in:
parent
293ad19bd8
commit
a293f53c08
@ -17,6 +17,8 @@ return new class extends Migration
|
||||
return;
|
||||
}
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
Invoice::withTrashed()
|
||||
->where('is_deleted', false)
|
||||
->cursor()
|
||||
|
@ -32,6 +32,8 @@ class ProductTest extends TestCase
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
protected $faker;
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -26,6 +27,20 @@ class CurrencyApiTest extends TestCase
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testConversionAudToEur()
|
||||
{
|
||||
$converter = new CurrencyApi();
|
||||
|
||||
$converted_amount = $converter->convert(100, 12, 3);
|
||||
|
||||
$aud_currency = Currency::find(12);
|
||||
$eur_currency = Currency::find(3);
|
||||
|
||||
$converted_synthetic = 100 / ($aud_currency->exchange_rate / $eur_currency->exchange_rate);
|
||||
|
||||
$this->assertEquals(round($converted_synthetic, 2), round($converted_amount, 2));
|
||||
}
|
||||
|
||||
public function testCurrencyConversionWorking()
|
||||
{
|
||||
$converter = new CurrencyApi();
|
||||
|
Loading…
x
Reference in New Issue
Block a user