From b56b139631e25402b3db97d63b7acce4bf804c87 Mon Sep 17 00:00:00 2001 From: ncoronel Date: Thu, 1 Oct 2026 13:57:59 -0300 Subject: [PATCH] feat(colors): update admin website colors in migration and seeder, add migration test --- ...opit_admin_secondary_and_danger_colors.php | 24 +++++++++ database/seeders/WebsiteTypeSeeder.php | 3 ++ .../UpdateShopitAdminColorsTest.php | 49 +++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 database/migrations/2026_10_01_000100_update_shopit_admin_secondary_and_danger_colors.php create mode 100644 tests/Feature/Migrations/UpdateShopitAdminColorsTest.php diff --git a/database/migrations/2026_10_01_000100_update_shopit_admin_secondary_and_danger_colors.php b/database/migrations/2026_10_01_000100_update_shopit_admin_secondary_and_danger_colors.php new file mode 100644 index 00000000..793e5baa --- /dev/null +++ b/database/migrations/2026_10_01_000100_update_shopit_admin_secondary_and_danger_colors.php @@ -0,0 +1,24 @@ +where('codigo', 'shopit') + ->update([ + 'secondary_color' => '#ADADAD', + 'danger_color' => '#FF8888', + 'success_color' => '#58B341', + 'updated_at' => now(), + ]); + } + + public function down(): void + { + // Presentation settings are operational data; preserve them on rollback. + } +}; diff --git a/database/seeders/WebsiteTypeSeeder.php b/database/seeders/WebsiteTypeSeeder.php index 1379136a..8d6dc9e0 100644 --- a/database/seeders/WebsiteTypeSeeder.php +++ b/database/seeders/WebsiteTypeSeeder.php @@ -49,6 +49,9 @@ class WebsiteTypeSeeder extends Seeder 'site_title' => 'ShopIt', ...self::PRESENTATION, 'primary_color' => '#2FD3AC', + 'secondary_color' => '#ADADAD', + 'danger_color' => '#FF8888', + 'success_color' => '#58B341', 'site_logo' => $this->shopItLogo(), 'footer_logo' => $this->shopItFooterLogo(), 'favicon' => $this->shopItFavicon(), diff --git a/tests/Feature/Migrations/UpdateShopitAdminColorsTest.php b/tests/Feature/Migrations/UpdateShopitAdminColorsTest.php new file mode 100644 index 00000000..b0251609 --- /dev/null +++ b/tests/Feature/Migrations/UpdateShopitAdminColorsTest.php @@ -0,0 +1,49 @@ +string('codigo')->primary(); + $table->string('primary_color'); + $table->string('secondary_color'); + $table->string('danger_color'); + $table->string('success_color'); + $table->timestamps(); + }); + foreach (['shopit', 'onticket'] as $code) { + DB::table('admin_website_types')->insert([ + 'codigo' => $code, + 'primary_color' => '#2FD3AC', + 'secondary_color' => '#777777', + 'danger_color' => '#E04A4A', + 'success_color' => '#81BC73', + ]); + } + + $migration = require database_path('migrations/2026_10_01_000100_update_shopit_admin_secondary_and_danger_colors.php'); + $migration->up(); + $shopit = DB::table('admin_website_types')->where('codigo', 'shopit')->first(); + $this->assertSame('#ADADAD', $shopit->secondary_color); + $this->assertSame('#FF8888', $shopit->danger_color); + $this->assertSame('#58B341', $shopit->success_color); + $this->assertSame('#2FD3AC', $shopit->primary_color); + $onticket = DB::table('admin_website_types')->where('codigo', 'onticket')->first(); + $this->assertSame('#777777', $onticket->secondary_color); + $this->assertSame('#E04A4A', $onticket->danger_color); + $this->assertSame('#81BC73', $onticket->success_color); + + $migration->down(); + $this->assertSame('#ADADAD', DB::table('admin_website_types')->where('codigo', 'shopit')->value('secondary_color')); + $this->assertSame('#FF8888', DB::table('admin_website_types')->where('codigo', 'shopit')->value('danger_color')); + $this->assertSame('#58B341', DB::table('admin_website_types')->where('codigo', 'shopit')->value('success_color')); + } +}