\PDO::ERRMODE_EXCEPTION, ]); } catch (\PDOException $e) { self::markTestSkipped('Database connection failed: ' . $e->getMessage()); } } public function testMigrationTablesExist(): void { if (self::$pdo === null) { $this->markTestSkipped('Database connection not available.'); } $expectedTables = [ 'categories', 'files', 'folders', 'import_items', 'import_jobs', 'model_tags', 'models', 'tags', 'thumbnails', 'phinxlog', ]; foreach ($expectedTables as $table) { $stmt = self::$pdo->query( "SELECT 1 FROM information_schema.tables WHERE table_schema = 'public' AND table_name = '{$table}'" ); $this->assertNotFalse($stmt, "Query failed for table {$table}"); $this->assertNotEmpty($stmt->fetch(), "Table {$table} does not exist"); } } public function testSeedDataExists(): void { if (self::$pdo === null) { $this->markTestSkipped('Database connection not available.'); } $categories = self::$pdo->query("SELECT name FROM categories ORDER BY name")->fetchAll(\PDO::FETCH_COLUMN); $this->assertContains('Aircraft', $categories); $this->assertContains('Automotive', $categories); $this->assertContains('Tools', $categories); $tags = self::$pdo->query("SELECT name FROM tags ORDER BY name")->fetchAll(\PDO::FETCH_COLUMN); $this->assertContains('wip', $tags); $this->assertContains('completed', $tags); $this->assertContains('print-ready', $tags); } }