- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
99 lines
3.2 KiB
PHP
99 lines
3.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\QrCode\QrCodeGenerator;
|
|
use App\Framework\QrCode\QrCodeRenderer;
|
|
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
|
|
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
|
|
use App\Framework\QrCode\ValueObjects\EncodingMode;
|
|
|
|
echo "=== QR Code Phase 3 Test - Version 1-3 ===\n\n";
|
|
|
|
$testCases = [
|
|
[
|
|
'data' => "HELLO WORLD", // 11 bytes
|
|
'version' => 1,
|
|
'description' => 'Version 1 - Simple text (11 bytes)'
|
|
],
|
|
[
|
|
'data' => "https://github.com", // 18 bytes
|
|
'version' => 1,
|
|
'description' => 'Version 1 - URL (18 bytes)'
|
|
],
|
|
[
|
|
'data' => str_repeat("A", 30), // 30 bytes
|
|
'version' => 2,
|
|
'description' => 'Version 2 - 30 bytes (requires Version 2)'
|
|
],
|
|
[
|
|
'data' => str_repeat("B", 50), // 50 bytes
|
|
'version' => 3,
|
|
'description' => 'Version 3 - 50 bytes (requires Version 3)'
|
|
],
|
|
];
|
|
|
|
foreach ($testCases as $index => $testCase) {
|
|
echo "=== Test Case " . ($index + 1) . ": {$testCase['description']} ===\n";
|
|
echo "Data: '" . substr($testCase['data'], 0, 50) . (strlen($testCase['data']) > 50 ? '...' : '') . "'\n";
|
|
echo "Length: " . strlen($testCase['data']) . " bytes\n";
|
|
echo "Expected Version: {$testCase['version']}\n\n";
|
|
|
|
try {
|
|
// Create config
|
|
$config = new QrCodeConfig(
|
|
version: QrCodeVersion::fromNumber($testCase['version']),
|
|
errorCorrectionLevel: ErrorCorrectionLevel::M,
|
|
encodingMode: EncodingMode::BYTE
|
|
);
|
|
|
|
// Generate QR Code
|
|
$matrix = QrCodeGenerator::generate($testCase['data'], $config);
|
|
|
|
echo "✅ Generated successfully!\n";
|
|
echo " Matrix Size: {$matrix->getSize()}x{$matrix->getSize()}\n";
|
|
echo " Version: {$matrix->getVersion()->getVersionNumber()}\n";
|
|
|
|
// Count modules
|
|
$darkCount = 0;
|
|
$lightCount = 0;
|
|
$size = $matrix->getSize();
|
|
|
|
for ($row = 0; $row < $size; $row++) {
|
|
for ($col = 0; $col < $size; $col++) {
|
|
if ($matrix->getModuleAt($row, $col)->isDark()) {
|
|
$darkCount++;
|
|
} else {
|
|
$lightCount++;
|
|
}
|
|
}
|
|
}
|
|
|
|
$darkRatio = round(($darkCount / ($darkCount + $lightCount)) * 100, 2);
|
|
echo " Dark modules: {$darkCount} ({$darkRatio}%)\n";
|
|
|
|
// Render SVG
|
|
$renderer = new QrCodeRenderer();
|
|
$svg = $renderer->renderSvg($matrix);
|
|
|
|
$filename = "qrcode-v{$testCase['version']}-test" . ($index + 1) . ".svg";
|
|
$outputPath = __DIR__ . '/../../public/' . $filename;
|
|
file_put_contents($outputPath, $svg);
|
|
|
|
echo " ✅ SVG saved: {$filename}\n";
|
|
echo " URL: https://localhost/{$filename}\n";
|
|
} catch (\Exception $e) {
|
|
echo "❌ Error: {$e->getMessage()}\n";
|
|
echo " File: {$e->getFile()}:{$e->getLine()}\n";
|
|
}
|
|
|
|
echo "\n" . str_repeat("-", 60) . "\n\n";
|
|
}
|
|
|
|
echo "=== Test Summary ===\n";
|
|
echo "All test cases completed!\n";
|
|
echo "Scan the generated QR codes to verify they work correctly.\n";
|