From 8087cd7c8840e229d2dda34030a4717f8eed6b42 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Oct 2020 00:06:25 +1100 Subject: [PATCH] Fixes for doubling up on company_token with name TOKEN --- tests/MockAccountData.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index 5ae73d2f8820..b1056c26630c 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -83,6 +83,8 @@ trait MockAccountData public $expense_category; + public $cu; + public function makeTestData() { @@ -149,12 +151,12 @@ trait MockAccountData $this->user->password = Hash::make('ALongAndBriliantPassword'); - $cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id); - $cu->is_owner = true; - $cu->is_admin = true; - $cu->save(); + $this->cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id); + $this->cu->is_owner = true; + $this->cu->is_admin = true; + $this->cu->save(); - $this->token = 'TOKEN'; + $this->token = \Illuminate\Support\Str::random(64); $company_token = new CompanyToken; $company_token->user_id = $this->user->id; @@ -166,6 +168,8 @@ trait MockAccountData $company_token->save(); + //todo create one token withe token name TOKEN - use firstOrCreate + Product::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id,