49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Migrations;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class AddCartEditingEnabledToTenantsTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_it_migrates_the_boolean_to_the_equivalent_policy(): void
|
|
{
|
|
$migration = require database_path(
|
|
'migrations/2026_08_19_000000_replace_cart_editing_enabled_with_policy.php'
|
|
);
|
|
|
|
$migration->down();
|
|
$migration->up();
|
|
|
|
$this->assertDatabaseHas('tenants', [
|
|
'codigo' => 'desfile_pura_tendencia',
|
|
'cart_editing_policy' => 'disabled',
|
|
]);
|
|
|
|
$this->assertDatabaseHas('tenants', [
|
|
'codigo' => 'sonder',
|
|
'cart_editing_policy' => 'quantity_and_remove',
|
|
]);
|
|
|
|
$this->assertDatabaseHas('tenants', [
|
|
'codigo' => 'fiesta_futbol_infantil',
|
|
'cart_editing_policy' => 'full',
|
|
]);
|
|
|
|
DB::table('tenants')->insert([
|
|
'codigo' => 'cart-editing-default',
|
|
'nombre' => 'Cart editing default',
|
|
'dominio' => 'cart-editing-default.test',
|
|
]);
|
|
|
|
$this->assertDatabaseHas('tenants', [
|
|
'codigo' => 'cart-editing-default',
|
|
'cart_editing_policy' => 'full',
|
|
]);
|
|
}
|
|
}
|