Fixes for types in tests

This commit is contained in:
David Bomba 2023-09-26 07:52:44 +10:00
parent 8c7e02aa62
commit 5925dae07b
2 changed files with 18 additions and 6 deletions

View File

@ -62,6 +62,10 @@ class BaseApiTest extends TestCase
{
use MockAccountData;
public CompanyUser $owner_cu;
public CompanyUser $low_cu;
private $list_routes = [
'products',
'clients',
@ -94,9 +98,11 @@ class BaseApiTest extends TestCase
'bank_transaction_rules',
];
private string $low_token;
public string $low_token;
private string $owner_token;
public string $owner_token;
public $faker;
protected function setUp() :void
{
@ -573,10 +579,13 @@ class BaseApiTest extends TestCase
])->get('/api/v1/companies/'.$this->company->hashed_id)
->assertStatus(200);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->low_token,
])->get('/api/v1/client_gateway_tokens')
->assertStatus(403);
])->get('/api/v1/client_gateway_tokens');
$response->assertStatus(403);
}
}

View File

@ -50,7 +50,11 @@ class InvitationTest extends TestCase
$this->assertEquals(1, count($invites));
$this->invoice->invitations = $invites;
$this->invoice->invitations()->each(function ($invite){
if(!$invite->contact->is_primary)
$invite->forceDelete();
});
$this->invoice->line_items = [];
@ -80,7 +84,6 @@ class InvitationTest extends TestCase
$new_invite->key = $this->createDbHash(config('database.default'));
$invitations = $this->invoice->invitations()->get();
$invitations->push($new_invite);
$this->invoice->invitations = $invitations->toArray();