feat(catalog): add GroupLayout enum and integrate into FeaturedGroup model, migrations, and seeders
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Tests\Feature\Catalog;
|
||||
|
||||
use App\Domains\Attachable\Enums\AttachmentType;
|
||||
use App\Domains\Attachable\Models\Attachment;
|
||||
use App\Domains\Catalog\Enums\GroupLayout;
|
||||
use App\Domains\Catalog\Enums\ProductLayout;
|
||||
use App\Domains\Catalog\Models\CatalogItem;
|
||||
use App\Domains\Catalog\Models\FeaturedGroup;
|
||||
@@ -21,7 +22,13 @@ class CatalogControllerTest extends TestCase
|
||||
{
|
||||
$tenant = $this->createTenant('catalog-index');
|
||||
$row = $this->createGroup($tenant, ProductLayout::Row, 'Row', 2);
|
||||
$cart = $this->createGroup($tenant, ProductLayout::ColumnWithCart, 'Cart', 1);
|
||||
$cart = $this->createGroup(
|
||||
$tenant,
|
||||
ProductLayout::ColumnWithCart,
|
||||
'Cart',
|
||||
1,
|
||||
GroupLayout::SimpleVertical,
|
||||
);
|
||||
|
||||
$directInventory = Inventory::query()->create([
|
||||
'real_stock' => 10,
|
||||
@@ -50,6 +57,7 @@ class CatalogControllerTest extends TestCase
|
||||
->assertJsonCount(2)
|
||||
->assertJsonPath('0.title', 'Cart')
|
||||
->assertJsonPath('0.layout', ProductLayout::ColumnWithCart->value)
|
||||
->assertJsonPath('0.group_layout', GroupLayout::SimpleVertical->value)
|
||||
->assertJsonPath('0.items.meta.current_page', 1)
|
||||
->assertJsonPath('0.items.data.0.nombre', 'Variants')
|
||||
->assertJsonPath('0.items.data.0.descripcion', 'Variants description')
|
||||
@@ -142,10 +150,12 @@ class CatalogControllerTest extends TestCase
|
||||
ProductLayout $layout,
|
||||
string $name,
|
||||
int $order = 0,
|
||||
GroupLayout $groupLayout = GroupLayout::Paginated,
|
||||
): FeaturedGroup {
|
||||
return FeaturedGroup::query()->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
'product_layout' => $layout,
|
||||
'group_layout' => $groupLayout,
|
||||
'group_name' => $name,
|
||||
'group_order' => $order,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user