Fixes for doubling up on company_token with name TOKEN

This commit is contained in:
David Bomba 2020-10-14 00:06:25 +11:00
parent 080c82770e
commit 8087cd7c88

View File

@ -83,6 +83,8 @@ trait MockAccountData
public $expense_category; public $expense_category;
public $cu;
public function makeTestData() public function makeTestData()
{ {
@ -149,12 +151,12 @@ trait MockAccountData
$this->user->password = Hash::make('ALongAndBriliantPassword'); $this->user->password = Hash::make('ALongAndBriliantPassword');
$cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id); $this->cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id);
$cu->is_owner = true; $this->cu->is_owner = true;
$cu->is_admin = true; $this->cu->is_admin = true;
$cu->save(); $this->cu->save();
$this->token = 'TOKEN'; $this->token = \Illuminate\Support\Str::random(64);
$company_token = new CompanyToken; $company_token = new CompanyToken;
$company_token->user_id = $this->user->id; $company_token->user_id = $this->user->id;
@ -166,6 +168,8 @@ trait MockAccountData
$company_token->save(); $company_token->save();
//todo create one token withe token name TOKEN - use firstOrCreate
Product::factory()->create([ Product::factory()->create([
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'company_id' => $this->company->id, 'company_id' => $this->company->id,