mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Adjust client factories to allow contacts to be created by default
This commit is contained in:
parent
872ce3a3bc
commit
46bb38a20c
@ -33,8 +33,8 @@ class ClientFactory
|
||||
$client->client_hash = Str::random(40);
|
||||
$client->settings = ClientSettings::defaults();
|
||||
|
||||
$client_contact = ClientContactFactory::create($company_id, $user_id);
|
||||
$client->contacts->add($client_contact);
|
||||
// $client_contact = ClientContactFactory::create($company_id, $user_id);
|
||||
// $client->contacts->add($client_contact);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class ClientContactRepository extends BaseRepository
|
||||
} else {
|
||||
$contacts = collect();
|
||||
}
|
||||
info(print_r($client->contacts->toArray(),1));
|
||||
|
||||
$client->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) {
|
||||
ClientContact::destroy($contact);
|
||||
|
@ -78,7 +78,7 @@ class ClientRepository extends BaseRepository
|
||||
$data['name'] = $client->present()->name();
|
||||
}
|
||||
|
||||
info("{$client->present()->name} has a balance of {$client->balance} with a paid to date of {$client->paid_to_date}");
|
||||
//info("{$client->present()->name} has a balance of {$client->balance} with a paid to date of {$client->paid_to_date}");
|
||||
|
||||
if (array_key_exists('documents', $data)) {
|
||||
$this->saveDocuments($data['documents'], $client);
|
||||
|
@ -126,8 +126,8 @@ class FactoryCreationTest extends TestCase
|
||||
$cliz->save();
|
||||
|
||||
$this->assertNotNull($cliz->contacts);
|
||||
$this->assertEquals(1, $cliz->contacts->count());
|
||||
$this->assertInternalType("int", $cliz->contacts->first()->id);
|
||||
$this->assertEquals(0, $cliz->contacts->count());
|
||||
$this->assertInternalType("int", $cliz->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user