Files
michaelschiemer/tests/debug/test-simple-queue.php
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- Move 12 markdown files from root to docs/ subdirectories
- Organize documentation by category:
  • docs/troubleshooting/ (1 file)  - Technical troubleshooting guides
  • docs/deployment/      (4 files) - Deployment and security documentation
  • docs/guides/          (3 files) - Feature-specific guides
  • docs/planning/        (4 files) - Planning and improvement proposals

Root directory cleanup:
- Reduced from 16 to 4 markdown files in root
- Only essential project files remain:
  • CLAUDE.md (AI instructions)
  • README.md (Main project readme)
  • CLEANUP_PLAN.md (Current cleanup plan)
  • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements)

This improves:
 Documentation discoverability
 Logical organization by purpose
 Clean root directory
 Better maintainability
2025-10-05 11:05:04 +02:00

111 lines
3.7 KiB
PHP

<?php
declare(strict_types=1);
require_once '/var/www/html/vendor/autoload.php';
require_once '/var/www/html/tests/bootstrap.php';
use App\Framework\Database\ConnectionInterface;
echo "🧪 Testing Queue System with Simple Approach...\n\n";
// Test 1: Check Database Tables exist using Framework Configuration
echo "1. Testing Database Tables (using Framework Configuration):\n";
try {
// Use framework's test container creation function
$container = createTestContainer();
$connection = $container->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";