Minor fixes for updateexchangeratestest
This commit is contained in:
parent
4ed0ccef95
commit
625d78af5d
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Jobs\Util\UpdateExchangeRates;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use App\Models\Currency;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\MockAccountData;
|
||||
use Tests\TestCase;
|
||||
use App\Models\Currency;
|
||||
use Tests\MockAccountData;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Util\UpdateExchangeRates;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -26,9 +27,7 @@ use Tests\TestCase;
|
|||
class UpdateExchangeRatesTest extends TestCase
|
||||
{
|
||||
use MakesHash;
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
|
@ -37,6 +36,10 @@ class UpdateExchangeRatesTest extends TestCase
|
|||
$this->markTestSkipped("no currency key set");
|
||||
}
|
||||
|
||||
if (Currency::count() == 0) {
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function testExchangeRate()
|
||||
|
|
@ -48,10 +51,11 @@ class UpdateExchangeRatesTest extends TestCase
|
|||
|
||||
$currency_api = json_decode($response->getBody());
|
||||
|
||||
UpdateExchangeRates::dispatchSync();
|
||||
(new UpdateExchangeRates())->handle();
|
||||
|
||||
$gbp_currency = \App\Models\Currency::find(2);
|
||||
|
||||
$this->assertNotNull($gbp_currency);
|
||||
$this->assertEquals($currency_api->rates->GBP, $gbp_currency->exchange_rate);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue