diff --git a/tests/Feature/BaseApiTest.php b/tests/Feature/BaseApiTest.php index 1fd22a94acc8..68c85e3b9de6 100644 --- a/tests/Feature/BaseApiTest.php +++ b/tests/Feature/BaseApiTest.php @@ -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); } } diff --git a/tests/Unit/InvitationTest.php b/tests/Unit/InvitationTest.php index 8ed282052e20..2b185116721a 100644 --- a/tests/Unit/InvitationTest.php +++ b/tests/Unit/InvitationTest.php @@ -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();