feat: Introduce source type for featured groups; add category association and implement FeaturedGroupService for item sourcing
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Tests\Unit\Catalog;
|
||||
use App\Domains\Attachable\Models\Attachment;
|
||||
use App\Domains\Catalog\Enums\CatalogItemType;
|
||||
use App\Domains\Catalog\Enums\EventProductType;
|
||||
use App\Domains\Catalog\Enums\FeaturedGroupSource;
|
||||
use App\Domains\Catalog\Enums\GroupLayout;
|
||||
use App\Domains\Catalog\Enums\InventoryPolicy;
|
||||
use App\Domains\Catalog\Enums\ProductLayout;
|
||||
@@ -104,6 +105,8 @@ class CatalogModelsTest extends TestCase
|
||||
{
|
||||
$group = new FeaturedGroup;
|
||||
$group->setRawAttributes([
|
||||
'source_type' => FeaturedGroupSource::Category->value,
|
||||
'category_id' => '4',
|
||||
'product_layout' => ProductLayout::ColumnWithImage->value,
|
||||
'group_layout' => GroupLayout::SimpleVertical->value,
|
||||
'group_order' => '2',
|
||||
@@ -118,9 +121,12 @@ class CatalogModelsTest extends TestCase
|
||||
$this->assertSame('featured_groups', $group->getTable());
|
||||
$this->assertFalse($group->usesTimestamps());
|
||||
$this->assertSame(ProductLayout::ColumnWithImage, $group->product_layout);
|
||||
$this->assertSame(FeaturedGroupSource::Category, $group->source_type);
|
||||
$this->assertSame(4, $group->category_id);
|
||||
$this->assertSame(GroupLayout::SimpleVertical, $group->group_layout);
|
||||
$this->assertSame(2, $group->group_order);
|
||||
$this->assertInstanceOf(Tenant::class, $group->tenant()->getRelated());
|
||||
$this->assertInstanceOf(Category::class, $group->category()->getRelated());
|
||||
$this->assertInstanceOf(FeaturedItem::class, $group->featuredItems()->getRelated());
|
||||
|
||||
$this->assertSame('featured_items', $featuredItem->getTable());
|
||||
|
||||
Reference in New Issue
Block a user