mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 16:31:33 +02:00
Improve test data quality (#3229)
This commit is contained in:
parent
a70b024d94
commit
8a202d54a0
@ -115,7 +115,6 @@ class CreateTestData extends Command
|
|||||||
'settings' => new \stdClass,
|
'settings' => new \stdClass,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$this->info('Creating '.$this->count. ' clients');
|
$this->info('Creating '.$this->count. ' clients');
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +124,23 @@ class CreateTestData extends Command
|
|||||||
|
|
||||||
$this->createClient($company, $user);
|
$this->createClient($company, $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($company->clients as $client) {
|
||||||
|
|
||||||
|
$this->info('creating invoice for client #'.$client->id);
|
||||||
|
$this->createInvoice($client);
|
||||||
|
|
||||||
|
$this->info('creating quote for client #'.$client->id);
|
||||||
|
$this->createQuote($client);
|
||||||
|
|
||||||
|
$this->info('creating expense for client #'.$client->id);
|
||||||
|
$this->createExpense($client);
|
||||||
|
|
||||||
|
$this->info('creating vendor for client #'.$client->id);
|
||||||
|
$this->createVendor($client);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMediumAccount()
|
private function createMediumAccount()
|
||||||
@ -172,13 +188,28 @@ class CreateTestData extends Command
|
|||||||
|
|
||||||
$this->info('Creating '.$this->count. ' clients');
|
$this->info('Creating '.$this->count. ' clients');
|
||||||
|
|
||||||
|
|
||||||
for ($x=0; $x<$this->count; $x++) {
|
for ($x=0; $x<$this->count; $x++) {
|
||||||
$z = $x+1;
|
$z = $x+1;
|
||||||
$this->info("Creating client # ".$z);
|
$this->info("Creating client # ".$z);
|
||||||
|
|
||||||
$this->createClient($company, $user);
|
$this->createClient($company, $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($company->clients as $client) {
|
||||||
|
|
||||||
|
$this->info('creating invoice for client #'.$client->id);
|
||||||
|
$this->createInvoice($client);
|
||||||
|
|
||||||
|
$this->info('creating quote for client #'.$client->id);
|
||||||
|
$this->createQuote($client);
|
||||||
|
|
||||||
|
$this->info('creating expense for client #'.$client->id);
|
||||||
|
$this->createExpense($client);
|
||||||
|
|
||||||
|
$this->info('creating vendor for client #'.$client->id);
|
||||||
|
$this->createVendor($client);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createLargeAccount()
|
private function createLargeAccount()
|
||||||
@ -236,10 +267,16 @@ class CreateTestData extends Command
|
|||||||
|
|
||||||
foreach($company->clients as $client) {
|
foreach($company->clients as $client) {
|
||||||
|
|
||||||
|
$this->info('creating invoice for client #'.$client->id);
|
||||||
$this->createInvoice($client);
|
$this->createInvoice($client);
|
||||||
|
|
||||||
|
$this->info('creating quote for client #'.$client->id);
|
||||||
$this->createQuote($client);
|
$this->createQuote($client);
|
||||||
|
|
||||||
|
$this->info('creating expense for client #'.$client->id);
|
||||||
$this->createExpense($client);
|
$this->createExpense($client);
|
||||||
|
|
||||||
|
$this->info('creating vendor for client #'.$client->id);
|
||||||
$this->createVendor($client);
|
$this->createVendor($client);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -273,7 +310,7 @@ class CreateTestData extends Command
|
|||||||
private function createExpense($client)
|
private function createExpense($client)
|
||||||
{
|
{
|
||||||
|
|
||||||
factory(\App\Models\Expense::class, rand(10, 50))->create([
|
factory(\App\Models\Expense::class, rand(1, 5))->create([
|
||||||
'user_id' => $client->user->id,
|
'user_id' => $client->user->id,
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'company_id' => $client->company->id
|
'company_id' => $client->company->id
|
||||||
@ -297,7 +334,7 @@ class CreateTestData extends Command
|
|||||||
'is_primary' => 1
|
'is_primary' => 1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
factory(\App\Models\VendorContact::class, rand(1, 50))->create([
|
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
|
||||||
'user_id' => $client->user->id,
|
'user_id' => $client->user->id,
|
||||||
'vendor_id' => $vendor->id,
|
'vendor_id' => $vendor->id,
|
||||||
'company_id' => $client->company->id,
|
'company_id' => $client->company->id,
|
||||||
|
Loading…
Reference in New Issue
Block a user