fixed laravel test

pull/22/head
A1Gard 1 year ago
parent 206daee778
commit f642fb29c2

@ -32,6 +32,6 @@ jobs:
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan migrate --seed
run: PIC_SEED=0 php artisan migrate --seed
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit

@ -87,8 +87,10 @@ class PostSeeder extends Seeder
$p->hash = date('Ym') . str_pad(dechex(crc32($p->slug)), 8, '0', STR_PAD_LEFT);
$p->save();
$p->categories()->sync([$item['category_id']]);
$num = rand(1, 6);
$p->addMedia(__DIR__ . "/img/$num/$num.jpg")->preservingOriginal()->toMediaCollection();
if (env('PIC_SEED') != 0){
$num = rand(1, 6);
$p->addMedia(__DIR__ . "/img/$num/$num.jpg")->preservingOriginal()->toMediaCollection();
}
$p->save();
}
}

@ -74,10 +74,12 @@ class ProductSeeder extends Seeder
$plan = 6;
}
$product->categories()->sync($plans[$plan]['cats']);
$num = rand(1, $plans[$plan]['max']);
$product->addMedia($plans[$plan]['dir'] . "$num.jpg")->preservingOriginal()->toMediaCollection();
$num = rand(1, $plans[$plan]['max']);
$product->addMedia($plans[$plan]['dir'] . "$num.jpg")->preservingOriginal()->toMediaCollection();
if (env('PIC_SEED') != 0){
$num = rand(1, $plans[$plan]['max']);
$product->addMedia($plans[$plan]['dir'] . "$num.jpg")->preservingOriginal()->toMediaCollection();
$num = rand(1, $plans[$plan]['max']);
$product->addMedia($plans[$plan]['dir'] . "$num.jpg")->preservingOriginal()->toMediaCollection();
}
$product->cat_id = $plans[$plan]['main'];
$product->save();
}

Loading…
Cancel
Save