make all test pass

updated seeder to be informative
fix seeder error on test
This commit is contained in:
Jack Goh
2018-08-01 15:30:19 +08:00
parent f197f856de
commit 5df307a165
13 changed files with 99 additions and 73 deletions
+2 -2
View File
@@ -21,6 +21,6 @@ $factory->define(App\User::class, function (Faker $faker) {
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'marking' => $faker->name,
'marking' => $faker->name,
];
});
});
+14 -14
View File
@@ -132,21 +132,21 @@ class RolesAndPermissionsSeeder extends Seeder {
}
$this->command->info($commandBullet."Attached $pcount permissions to $role[name] role");
// Update old records
if ($originalRole)
{
$userCount = 0;
$RoleUsers = DB::table(Config::get('entrust.role_user_table'))->where('role_id',$originalRole->id)->get();
foreach ($RoleUsers as $user) {
$u = User::where('id',$user->user_id)->first();
$u->attachRole($newRole);
$userCount++;
}
$this->command->info($commandBullet."Updated role attachment for $userCount users");
// Update old records : Temporary disabled
// if ($originalRole)
// {
// $userCount = 0;
// $RoleUsers = DB::table(Config::get('entrust.role_user_table'))->where('role_id',$originalRole->id)->get();
// foreach ($RoleUsers as $user) {
// $u = User::where('id',$user->user_id)->first();
// $u->attachRole($newRole);
// $userCount++;
// }
// $this->command->info($commandBullet."Updated role attachment for $userCount users");
Role::where('id',$originalRole->id)->delete(); // will also remove old role_user records
$this->command->info($commandBullet."Removed the original $role[name] role");
}
// Role::where('id',$originalRole->id)->delete(); // will also remove old role_user records
// $this->command->info($commandBullet."Removed the original $role[name] role");
// }
}
+2 -2
View File
@@ -15,13 +15,13 @@ class SettingActiveBankSeeder extends Seeder
{
$bankx1 = SettingMalaysiaBank::find(1);
$bankx2 = SettingMalaysiaBank::find(2);
$chinabank = SettingBeneficiary::where('acc_no', "=" ,'123456789')->first();
$beneficiary = SettingBeneficiary::find(2);
DB::table('setting_active_banks')->truncate();
DB::table('setting_active_banks')->insert([
'x1_bank_id' => $bankx1->id,
'x2_bank_id' => $bankx2->id,
'beneficiary_id' => $chinabank->id
'beneficiary_id' => $beneficiary->id
]);
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ class SettingBeneficiarySeeder extends Seeder
'bank_branch' => 'Putra'
]);
DB::table('setting_beneficiaries')->insert([
'company_name' => 'Bota',
'company_name' => 'CIEF1',
'bank_name' => 'CIMB',
'acc_no' => '123456789',
'bank_address' => 'Jalan cyberjaya',
+3 -3
View File
@@ -13,9 +13,9 @@ class SettingCreditSeeder extends Seeder
public function run()
{
DB::table('setting_credits')->insert([
'rmb_credit_limit' => '4000',
'usd_credit_limit' => '5000',
'time_limit' => '6000'
'rmb_credit_limit' => '100000',
'usd_credit_limit' => '100000',
'time_limit' => '60000'
]);
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ class SettingTaxRateSeeder extends Seeder
public function run()
{
DB::table('setting_tax_rates')->insert([
'tax_rate' => '1.1',
'tax_rate' => '1.0',
]);
}
}