get('DB_DRIVER', 'mysql'); echo " DB_DRIVER: {$dbDriver}\n"; // Test 2: Platform Initializer echo "\n2. Testing DatabasePlatformInitializer...\n"; $initializer = new DatabasePlatformInitializer($env); $platform = $initializer->__invoke(); echo " Platform: " . $platform->getName() . "\n"; // Test 3: MySQL Platform echo "\n3. Testing MySQLPlatform...\n"; $mysqlPlatform = new MySQLPlatform(); echo " Platform name: " . $mysqlPlatform->getName() . "\n"; echo " Supports JSON: " . ($mysqlPlatform->supportsFeature('json_columns') ? 'Yes' : 'No') . "\n"; // Test 4: Column Definition echo "\n4. Testing Column Definitions...\n"; $idColumn = ColumnDefinition::id(); echo " ID column: " . $idColumn->name . " (" . $idColumn->type->value . ")\n"; echo " Is Primary Key: " . ($idColumn->isPrimaryKey() ? 'Yes' : 'No') . "\n"; $stringColumn = ColumnDefinition::string('name', 255, false); echo " String column: " . $stringColumn->name . " (" . $stringColumn->type->value . ")\n"; // Test 5: SQL Generation echo "\n5. Testing SQL Generation...\n"; $columns = [ ColumnDefinition::id(), ColumnDefinition::string('name', 255, false), ColumnDefinition::text('description'), ColumnDefinition::timestamp('created_at', false), ]; $options = TableOptions::default()->withComment('Test table'); try { $sql = $mysqlPlatform->getCreateTableSQL('test_users', $columns, $options); echo " CREATE TABLE SQL:\n"; echo " " . $sql . "\n"; } catch (\Throwable $e) { echo " ERROR: " . $e->getMessage() . "\n"; } // Test 6: Column Type SQL echo "\n6. Testing Column Type SQL...\n"; $tests = [ ['varchar', ['length' => 255]], ['integer', ['unsigned' => true]], ['text', []], ['timestamp', []], ]; foreach ($tests as [$type, $options]) { try { $typeSQL = $mysqlPlatform->getColumnTypeSQL($type, $options); echo " {$type}: {$typeSQL}\n"; } catch (\Throwable $e) { echo " {$type}: ERROR - " . $e->getMessage() . "\n"; } } echo "\n=== Test completed ===\n";