feat(website-type): add presentation fields and site logo relationship to WebsiteType model
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Tests\Feature\Tenant;
|
||||
|
||||
use App\Domains\Attachable\Enums\AttachmentType;
|
||||
use App\Domains\Attachable\Models\Attachment;
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use App\Domains\Tenant\Models\WebsiteType;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -20,6 +22,11 @@ class WebsiteExtrasTest extends TestCase
|
||||
'id',
|
||||
'codigo',
|
||||
'nombre',
|
||||
'primary_color',
|
||||
'secondary_color',
|
||||
'danger_color',
|
||||
'success_color',
|
||||
'site_logo',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
], Schema::getColumnListing('website_type'));
|
||||
@@ -49,9 +56,21 @@ class WebsiteExtrasTest extends TestCase
|
||||
|
||||
public function test_models_map_the_diagram_relations_and_casts(): void
|
||||
{
|
||||
$siteLogo = Attachment::query()->create([
|
||||
'key' => '92bb3986-fb22-4871-b98c-fc5663d78aa6',
|
||||
'path' => 'website-types/site-logo.png',
|
||||
'filename' => 'site-logo.png',
|
||||
'type' => AttachmentType::Image,
|
||||
'mime_type' => 'image/png',
|
||||
]);
|
||||
$type = WebsiteType::query()->create([
|
||||
'codigo' => 'store',
|
||||
'nombre' => 'Tienda',
|
||||
'primary_color' => '#111111',
|
||||
'secondary_color' => '#222222',
|
||||
'danger_color' => '#ff0000',
|
||||
'success_color' => '#00aa55',
|
||||
'site_logo' => $siteLogo->id,
|
||||
]);
|
||||
$typeExtra = $type->extras()->create([
|
||||
'codigo' => 'whatsapp',
|
||||
@@ -72,6 +91,11 @@ class WebsiteExtrasTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertTrue($type->extras()->firstOrFail()->is($typeExtra));
|
||||
$this->assertSame('#111111', $type->primary_color);
|
||||
$this->assertSame('#222222', $type->secondary_color);
|
||||
$this->assertSame('#ff0000', $type->danger_color);
|
||||
$this->assertSame('#00aa55', $type->success_color);
|
||||
$this->assertTrue($type->siteLogo()->firstOrFail()->is($siteLogo));
|
||||
$this->assertSame($type->codigo, $typeExtra->website_type_code);
|
||||
$this->assertSame('whatsapp', $typeExtra->codigo);
|
||||
$this->assertTrue($type->tenants()->firstOrFail()->is($tenant));
|
||||
|
||||
Reference in New Issue
Block a user