feat(catalog): add GroupLayout enum and integrate into FeaturedGroup model, migrations, and seeders
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Tests\Unit\Catalog;
|
||||
|
||||
use App\Domains\Attachable\Models\Attachment;
|
||||
use App\Domains\Catalog\Enums\CatalogItemType;
|
||||
use App\Domains\Catalog\Enums\GroupLayout;
|
||||
use App\Domains\Catalog\Enums\InventoryPolicy;
|
||||
use App\Domains\Catalog\Enums\ProductLayout;
|
||||
use App\Domains\Catalog\Models\Attribute;
|
||||
@@ -25,6 +26,16 @@ use Tests\TestCase;
|
||||
|
||||
class CatalogModelsTest extends TestCase
|
||||
{
|
||||
public function test_group_layout_has_all_supported_values(): void
|
||||
{
|
||||
$this->assertSame([
|
||||
'paginated',
|
||||
'simple',
|
||||
'simple_vertical',
|
||||
'carousel',
|
||||
], GroupLayout::values());
|
||||
}
|
||||
|
||||
public function test_attribute_maps_its_values_and_relations(): void
|
||||
{
|
||||
$attribute = new Attribute;
|
||||
@@ -83,6 +94,7 @@ class CatalogModelsTest extends TestCase
|
||||
$group = new FeaturedGroup;
|
||||
$group->setRawAttributes([
|
||||
'product_layout' => ProductLayout::ColumnWithImage->value,
|
||||
'group_layout' => GroupLayout::SimpleVertical->value,
|
||||
'group_order' => '2',
|
||||
]);
|
||||
$featuredItem = new FeaturedItem;
|
||||
@@ -95,6 +107,7 @@ class CatalogModelsTest extends TestCase
|
||||
$this->assertSame('featured_groups', $group->getTable());
|
||||
$this->assertFalse($group->usesTimestamps());
|
||||
$this->assertSame(ProductLayout::ColumnWithImage, $group->product_layout);
|
||||
$this->assertSame(GroupLayout::SimpleVertical, $group->group_layout);
|
||||
$this->assertSame(2, $group->group_order);
|
||||
$this->assertInstanceOf(Tenant::class, $group->tenant()->getRelated());
|
||||
$this->assertInstanceOf(FeaturedItem::class, $group->featuredItems()->getRelated());
|
||||
|
||||
Reference in New Issue
Block a user