feat(tenant): add main carousel images to tenant seeder and implement corresponding tests
This commit is contained in:
38
tests/Feature/Seeders/TenantSeederTest.php
Normal file
38
tests/Feature/Seeders/TenantSeederTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Seeders;
|
||||
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use Database\Seeders\TenantSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TenantSeederTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_it_loads_the_sonder_main_carousel_images_in_order(): void
|
||||
{
|
||||
Storage::fake('s3');
|
||||
|
||||
$this->seed(TenantSeeder::class);
|
||||
|
||||
$tenant = Tenant::query()->where('codigo', 'sonder')->firstOrFail();
|
||||
$images = $tenant->mainCarouselImages()->get();
|
||||
|
||||
$this->assertSame([
|
||||
'01-urban-team.png',
|
||||
'02-running-shoes.png',
|
||||
'03-streetwear.png',
|
||||
'04-football-training.png',
|
||||
'05-activewear-essentials.png',
|
||||
'06-city-runners.png',
|
||||
], $images->pluck('filename')->all());
|
||||
$this->assertSame([0, 1, 2, 3, 4, 5], $images->pluck('pivot.orden')->all());
|
||||
|
||||
foreach ($images as $image) {
|
||||
Storage::disk('s3')->assertExists($image->path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user