get(ConnectionInterface::class); echo " โœ… Framework database connection established\n"; $tables = [ 'queue_workers', 'distributed_locks', 'job_assignments', 'worker_health_checks', 'failover_events' ]; foreach ($tables as $table) { $stmt = $connection->prepare("SHOW TABLES LIKE ?"); $stmt->execute([$table]); if ($stmt->fetchColumn()) { echo " โœ… Table '$table' exists\n"; } else { echo " โŒ Table '$table' missing\n"; } } } catch (Exception $e) { echo " โŒ Database error: " . $e->getMessage() . "\n"; } // Test 2: Test Value Objects echo "\n2. Testing Value Objects:\n"; try { require_once '/var/www/html/vendor/autoload.php'; // Test WorkerId $workerId = \App\Framework\Queue\ValueObjects\WorkerId::generate(); echo " โœ… WorkerId generation: " . $workerId->toString() . "\n"; // Test QueueName $queueName = \App\Framework\Queue\ValueObjects\QueueName::forCommand('test'); echo " โœ… QueueName creation: " . $queueName->toString() . "\n"; // Test JobId $jobId = \App\Framework\Queue\ValueObjects\JobId::generate(); echo " โœ… JobId generation: " . $jobId->toString() . "\n"; // Test LockKey $lockKey = \App\Framework\Queue\ValueObjects\LockKey::forQueue($queueName); echo " โœ… LockKey creation: " . $lockKey->toString() . "\n"; } catch (Exception $e) { echo " โŒ Value Object error: " . $e->getMessage() . "\n"; } // Test 3: Test Console Commands are discoverable echo "\n3. Testing Console Commands Discovery:\n"; try { $output = shell_exec('docker exec php php console.php --help 2>/dev/null | grep worker'); if ($output && strpos($output, 'worker') !== false) { echo " โœ… Worker commands discovered\n"; echo " ๐Ÿ“ Found: " . trim($output) . "\n"; } else { echo " โŒ Worker commands not found or command failed\n"; } } catch (Exception $e) { echo " โŒ Console command discovery error: " . $e->getMessage() . "\n"; } // Test 4: Test database connectivity for queue tables echo "\n4. Testing Database Table Structure:\n"; try { // Test queue_workers table structure using DESCRIBE (MySQL/MariaDB) $stmt = $connection->prepare("DESCRIBE queue_workers"); $stmt->execute(); $columns = $stmt->fetchAll(PDO::FETCH_ASSOC); if (count($columns) > 0) { echo " โœ… queue_workers table has " . count($columns) . " columns\n"; $expectedColumns = ['id', 'worker_id', 'hostname', 'pid', 'queues', 'status', 'last_heartbeat', 'created_at', 'updated_at']; foreach ($expectedColumns as $col) { $found = false; foreach ($columns as $column) { if ($column['Field'] === $col) { // MySQL uses 'Field' not 'name' $found = true; break; } } if ($found) { echo " โœ… Column '$col' exists\n"; } else { echo " โŒ Column '$col' missing\n"; } } } } catch (Exception $e) { echo " โŒ Table structure error: " . $e->getMessage() . "\n"; } echo "\n๐ŸŽฏ Simple Queue System test completed!\n";