feat: add cart editing feature to tenants

- Added 'cart_editing_enabled' attribute to Tenant model with default value true.
- Updated StoreTenantRequest and UpdateTenantRequest to include validation for 'cart_editing_enabled'.
- Modified TenantResource to expose 'cart_editing_enabled' in API responses.
- Created migration to add 'cart_editing_enabled' column to tenants table, defaulting to true, and set to false for specific tenant.
- Updated DesfilePuraTendenciaSeeder to set 'cart_editing_enabled' to false for the desfile tenant.
- Enhanced Postman collection generation script to include 'cart_editing_enabled' in tenant creation and update requests.
- Added tests to verify the correct behavior of 'cart_editing_enabled' during migrations and tenant provisioning.
This commit is contained in:
2026-08-18 16:32:17 -03:00
parent d73b4d1daf
commit a2298c9de2
12 changed files with 5911 additions and 1459 deletions

View File

@@ -0,0 +1,38 @@
<?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_disables_cart_editing_only_for_desfile(): void
{
$migration = require database_path(
'migrations/2026_08_18_060000_add_cart_editing_enabled_to_tenants_table.php'
);
$migration->down();
$migration->up();
$this->assertDatabaseHas('tenants', [
'codigo' => 'desfile_pura_tendencia',
'cart_editing_enabled' => false,
]);
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_enabled' => true,
]);
}
}