From 088fefbb34c4b04e40eb6be5e6b6308604928b53 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 30 May 2021 18:11:59 +1000 Subject: [PATCH] Importing Company Ledger --- tests/Feature/Import/ImportCompanyTest.php | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/Feature/Import/ImportCompanyTest.php b/tests/Feature/Import/ImportCompanyTest.php index 25b4ddfb6b1b..7bdfe001eaa9 100644 --- a/tests/Feature/Import/ImportCompanyTest.php +++ b/tests/Feature/Import/ImportCompanyTest.php @@ -19,6 +19,7 @@ use App\Models\ClientContact; use App\Models\ClientGatewayToken; use App\Models\Company; use App\Models\CompanyGateway; +use App\Models\CompanyLedger; use App\Models\CompanyToken; use App\Models\CompanyUser; use App\Models\Credit; @@ -823,8 +824,19 @@ class ImportCompanyTest extends TestCase // Backup // Company Ledger + $this->assertEquals(3, count($this->backup_json_object->company_ledger)); + $this->genericImport(CompanyLedger::class, + ['company_id', 'user_id', 'client_id', 'activity_id', 'id','account_id'], + [ + ['users' => 'user_id'], + ['clients' => 'client_id'], + ['activities' => 'activity_id'], + ], + 'company_ledger', + 'created_at'); + $this->assertEquals(3, CompanyLedger::count()); // Company Ledger } @@ -966,7 +978,11 @@ class ImportCompanyTest extends TestCase $new_obj->save(['timestamps' => false]); - $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; + if($new_obj instanceof CompanyLedger){ + + } + else + $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; } @@ -1010,7 +1026,10 @@ class ImportCompanyTest extends TestCase $new_obj->save(['timestamps' => false]); - $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; + if($new_obj instanceof CompanyLedger){ + } + else + $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; }