Upgraded testing to Laravel 8 - disabled most tests pending code optimisation

This commit is contained in:
Deon George
2021-06-30 14:00:41 +10:00
parent d7ef04fc25
commit ec738d590c
19 changed files with 414 additions and 206 deletions

View File

@@ -1,15 +1,60 @@
<?php
use Faker\Generator as Faker;
namespace Database\Factories;
$factory->define(App\Models\Account::class, function (Faker $faker) {
return [
'id'=>1,
];
});
use Illuminate\Database\Eloquent\Factories\Factory;
$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;
});
use App\Models\{Account,Country,Currency,Language};
class AccountFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Account::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
// Create Dependencies - should be loaded by seeding.
$co = Country::findOrFail(61);
$lo = Language::findOrFail(1);
$cyo = Currency::findOrFail(6);
return [
'id' => $this->faker->numberBetween(2048,65535),
// 'date_orig',
// 'date_last',
//* 'site_id', // Needs to be passed in
// 'date_expire',
'language_id' => $lo->id,
'country_id' => $co->id,
// 'rtm_id',
'currency_id' => $cyo->id,
// 'username',
// 'password',
'active' => TRUE,
// 'first_name',
// 'last_name',
// 'title',
// 'email',
// 'company',
// 'address1',
// 'address2',
// 'city',
// 'state',
// 'zip',
// 'email_type',
// 'invoice_delivery',
// 'mail_type',
// 'remember_token',
// 'user_id',
];
}
}