mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 12:10:41 -05:00
Adds published_at
Data to Factories
This commit is contained in:
parent
f94204e978
commit
0776ee426f
@ -5,6 +5,7 @@ namespace Database\Factories;
|
||||
use App\Models\License;
|
||||
use App\Models\Mod;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Random\RandomException;
|
||||
|
||||
@ -30,8 +31,9 @@ class ModFactory extends Factory
|
||||
'featured' => fake()->boolean(),
|
||||
'contains_ai_content' => fake()->boolean(),
|
||||
'contains_ads' => fake()->boolean(),
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
'published_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
'created_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
'updated_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,13 @@ class ModVersionFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'mod_id' => Mod::factory(),
|
||||
'version' => fake()->numerify('1.#.#'),
|
||||
'version' => fake()->numerify('#.#.#'),
|
||||
'description' => fake()->text(),
|
||||
'link' => fake()->url(),
|
||||
'spt_version_id' => SptVersion::factory(),
|
||||
'virus_total_link' => fake()->url(),
|
||||
'downloads' => fake()->randomNumber(),
|
||||
'published_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
'created_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
'updated_at' => Carbon::now()->subDays(rand(0, 365))->subHours(rand(0, 23)),
|
||||
];
|
||||
|
@ -3,6 +3,9 @@
|
||||
use App\Models\Mod;
|
||||
use App\Models\ModDependency;
|
||||
use App\Models\ModVersion;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('resolves mod version dependency when mod version is created', function () {
|
||||
$modA = Mod::factory()->create(['name' => 'Mod A']);
|
||||
|
@ -18,15 +18,14 @@ it('includes only published mod versions', function () {
|
||||
]);
|
||||
|
||||
$all = ModVersion::withoutGlobalScopes()->get();
|
||||
|
||||
expect($all)->toHaveCount(3);
|
||||
|
||||
$mods = ModVersion::all();
|
||||
|
||||
expect($mods)->toHaveCount(1);
|
||||
expect($mods->contains($publishedMod))->toBeTrue();
|
||||
expect($mods->contains($unpublishedMod))->toBeFalse();
|
||||
expect($mods->contains($noPublishedDateMod))->toBeFalse();
|
||||
expect($mods)->toHaveCount(1)
|
||||
->and($mods->contains($publishedMod))->toBeTrue()
|
||||
->and($mods->contains($unpublishedMod))->toBeFalse()
|
||||
->and($mods->contains($noPublishedDateMod))->toBeFalse();
|
||||
});
|
||||
|
||||
it('handles null published_at as not published', function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user