Add missing test factories
This commit is contained in:
parent
5cc0dcd8e1
commit
c5f171da95
15
database/factories/AccountFactory.php
Normal file
15
database/factories/AccountFactory.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
$factory->define(App\Models\Account::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'id'=>1,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
$factory->afterMaking(App\Models\Account::class, function ($service,$faker) {
|
||||||
|
$country = factory(App\Models\Country::class)->make();
|
||||||
|
$service->setRelation('country',$country);
|
||||||
|
$service->country_id = $country->id;
|
||||||
|
});
|
14
database/factories/CountryFactory.php
Normal file
14
database/factories/CountryFactory.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
$factory->define(App\Models\Country::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'id'=>1222,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
$factory->afterMaking(App\Models\Country::class, function ($service,$faker) {
|
||||||
|
$taxes = factory(App\Models\Tax::class,1)->make();
|
||||||
|
$service->setRelation('taxes',$taxes);
|
||||||
|
});
|
@ -4,16 +4,18 @@ use Faker\Generator as Faker;
|
|||||||
|
|
||||||
$factory->define(App\Models\Service::class, function (Faker $faker) {
|
$factory->define(App\Models\Service::class, function (Faker $faker) {
|
||||||
return [
|
return [
|
||||||
'account_id'=>1,
|
|
||||||
'active'=>1,
|
'active'=>1,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
$factory->afterMaking(App\Models\Service::class, function ($service,$faker) {
|
$factory->afterMaking(App\Models\Service::class, function ($service,$faker) {
|
||||||
$product = factory(App\Models\Product::class)->make();
|
$product = factory(App\Models\Product::class)->make();
|
||||||
|
|
||||||
$service->setRelation('product',$product);
|
$service->setRelation('product',$product);
|
||||||
$service->product_id = $product->id;
|
$service->product_id = $product->id;
|
||||||
|
|
||||||
|
$account = factory(App\Models\Account::class)->make();
|
||||||
|
$service->setRelation('account',$account);
|
||||||
|
$service->account_id = $account->id;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Weekly
|
// Weekly
|
||||||
|
11
database/factories/TaxFactory.php
Normal file
11
database/factories/TaxFactory.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
$factory->define(App\Models\Tax::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'id'=>1,
|
||||||
|
'rate'=>0.1,
|
||||||
|
'description'=>'GST',
|
||||||
|
];
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user