From 99bf34b20f3ec1e189ff7a34de5c844bb00a1231 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 18 Jun 2024 11:48:04 +1000 Subject: [PATCH] Fixes for tests --- tests/Feature/PurchaseOrderTest.php | 24 +++++++++++++----------- tests/MockAccountData.php | 5 ----- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tests/Feature/PurchaseOrderTest.php b/tests/Feature/PurchaseOrderTest.php index fc6d44dce848..3fc8908409e2 100644 --- a/tests/Feature/PurchaseOrderTest.php +++ b/tests/Feature/PurchaseOrderTest.php @@ -99,7 +99,19 @@ class PurchaseOrderTest extends TestCase { $this->purchase_order->service()->createInvitations()->save(); - $i = $this->purchase_order->fresh()->invitations->first(); + $i = $this->purchase_order->invitations->first(); + + $data = [ + 'ids' => [$this->purchase_order->hashed_id], + 'action' => 'download', + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post("/api/v1/purchase_orders/bulk", $data) + ->assertStatus(200); + $data = [ 'ids' =>[$this->purchase_order->hashed_id], @@ -146,16 +158,6 @@ class PurchaseOrderTest extends TestCase ])->post("/api/v1/purchase_orders/bulk", $data) ->assertStatus(200); - $data = [ - 'ids' =>[$this->purchase_order->hashed_id], - 'action' => 'download', - ]; - - $response = $this->withHeaders([ - 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token, - ])->post("/api/v1/purchase_orders/bulk", $data) - ->assertStatus(200); $data = [ 'ids' =>[], diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index acc16c8f86ed..27af80502ec0 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -600,11 +600,6 @@ trait MockAccountData 'purchase_order_id' => $this->purchase_order->id, ]); - $purchase_order_invitations = PurchaseOrderInvitation::whereCompanyId($this->purchase_order->company_id) - ->wherePurchaseOrderId($this->purchase_order->id); - - $this->purchase_order->setRelation('invitations', $purchase_order_invitations); - $this->purchase_order->service()->markSent(); $this->purchase_order->setRelation('vendor', $this->vendor);