<?php

namespace Tests\Feature\Migrations;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;

class AddDisplayCartItemImagesToTenantsTest extends TestCase
{
    use RefreshDatabase;

    public function test_it_hides_cart_item_images_only_for_desfile(): void
    {
        $migration = require database_path(
            'migrations/2026_08_18_061000_add_display_cart_item_images_to_tenants_table.php'
        );

        $migration->down();
        $migration->up();

        $this->assertDatabaseHas('tenants', [
            'codigo' => 'desfile_pura_tendencia',
            'display_cart_item_images' => false,
        ]);

        DB::table('tenants')->insert([
            'codigo' => 'cart-images-default',
            'nombre' => 'Cart images default',
            'dominio' => 'cart-images-default.test',
        ]);

        $this->assertDatabaseHas('tenants', [
            'codigo' => 'cart-images-default',
            'display_cart_item_images' => true,
        ]);
    }
}
