Fixes for tests

This commit is contained in:
David Bomba 2024-07-17 09:54:06 +10:00
parent 19a991e4c3
commit 6855be8b34

View File

@ -13,6 +13,7 @@ namespace Tests\Feature;
use App\Models\Client; use App\Models\Client;
use App\Models\CompanyGateway; use App\Models\CompanyGateway;
use App\Models\Credit;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -128,11 +129,17 @@ class CompanyGatewayResolutionTest extends TestCase
$this->client->country_id = 840; $this->client->country_id = 840;
$this->client->save(); $this->client->save();
Credit::query()->withTrashed()->cursor()->each(function ($c) {
$c->forceDelete();
});
$this->assertInstanceOf('\\stdClass', $this->cg->fees_and_limits); $this->assertInstanceOf('\\stdClass', $this->cg->fees_and_limits);
// $this->assertObjectHasAttribute('min_limit', $this->cg->fees_and_limits->{1}); // $this->assertObjectHasAttribute('min_limit', $this->cg->fees_and_limits->{1});
$this->assertNotNull($this->cg->fees_and_limits->{1}->min_limit); $this->assertNotNull($this->cg->fees_and_limits->{1}->min_limit);
$payment_methods = $this->client->service()->getPaymentMethods($amount); $payment_methods = $this->client->service()->getPaymentMethods($amount);
nlog($payment_methods);
$this->assertEquals(2, count($payment_methods)); $this->assertEquals(2, count($payment_methods));
} }
@ -143,6 +150,10 @@ class CompanyGatewayResolutionTest extends TestCase
CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg) { CompanyGateway::query()->withTrashed()->cursor()->each(function ($cg) {
$cg->forceDelete(); $cg->forceDelete();
}); });
Credit::query()->withTrashed()->cursor()->each(function ($c) {
$c->forceDelete();
});
$data = []; $data = [];
$data[1]['min_limit'] = -1; $data[1]['min_limit'] = -1;