Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Replace the old touchmark/PNG identity with the supplied lockup and monogram, segmented role-aware navigation, Live/Draft listing filters with generation-based cache invalidation, and admin Projects covering immutable file revisions, listing live pointers, and exact-decimal filament/packaging/shipping costing. Additive schema only; no Etsy publication. Isolated clone tests: 301 tests, 1162 assertions.
46 lines
1.9 KiB
PHP
46 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Tests\TestCase;
|
|
|
|
class LegacyRetentionTest extends TestCase
|
|
{
|
|
use LazilyRefreshDatabase;
|
|
|
|
public function test_additive_project_migrations_do_not_disturb_legacy_filament_rows(): void
|
|
{
|
|
$userId = DB::table('users')->insertGetId([
|
|
'username' => 'legacy-user', 'email' => 'legacy@example.test', 'password' => 'x', 'role' => 'user',
|
|
]);
|
|
$filamentId = DB::table('filamentTracker')->insertGetId([
|
|
'userId' => $userId, 'filamentName' => 'Legacy PLA', 'amazonUrl' => 'https://example.test/x',
|
|
'filamentWeight' => 1000, 'brand' => 'LegacyBrand', 'material' => 'PLA', 'color' => 'Black', 'itemDiameter' => 1.75,
|
|
]);
|
|
DB::table('filamentPriceHistory')->insert([
|
|
'filamentId' => $filamentId, 'price' => 19.99, 'recordedAt' => now(),
|
|
]);
|
|
|
|
// Re-running migrate must be a no-op for already-applied migrations and
|
|
// must not touch legacy rows that predate the project/costing tables.
|
|
Artisan::call('migrate', ['--force' => true]);
|
|
|
|
$this->assertDatabaseHas('filamentTracker', ['id' => $filamentId, 'filamentName' => 'Legacy PLA', 'userId' => $userId]);
|
|
$this->assertDatabaseHas('filamentPriceHistory', ['filamentId' => $filamentId, 'price' => 19.99]);
|
|
$this->assertDatabaseCount('filamentTracker', 1);
|
|
}
|
|
|
|
public function test_project_tables_are_additive_and_coexist_with_legacy_tables(): void
|
|
{
|
|
$this->assertTrue(Schema::hasTable('filamentTracker'));
|
|
$this->assertTrue(Schema::hasTable('filamentPriceHistory'));
|
|
$this->assertTrue(Schema::hasTable('bambuPrinters'));
|
|
$this->assertTrue(Schema::hasTable('projects'));
|
|
$this->assertTrue(Schema::hasTable('project_cost_snapshots'));
|
|
}
|
|
}
|