- 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.
66 lines
2.3 KiB
PHP
66 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
it('can verify complete image system functionality', function () {
|
|
// Test 1: API returns images from database
|
|
$response = curl_exec_with_fallback('https://localhost/api/images', [
|
|
'headers' => ['User-Agent: Mozilla/5.0'],
|
|
'json' => true,
|
|
]);
|
|
|
|
expect($response)->toBeArray();
|
|
expect($response['images'])->toBeArray();
|
|
expect(count($response['images']))->toBeGreaterThan(10); // Should have many images now
|
|
|
|
$firstImage = $response['images'][0];
|
|
expect($firstImage)->toHaveKey('filename');
|
|
expect($firstImage)->toHaveKey('url');
|
|
expect($firstImage['url'])->toStartWith('/images/');
|
|
|
|
// Test 2: Admin page loads successfully (no timeout)
|
|
$adminResponse = curl_exec_with_fallback('https://localhost/admin/images', [
|
|
'headers' => ['User-Agent: Mozilla/5.0'],
|
|
]);
|
|
|
|
expect($adminResponse)->toBeString();
|
|
expect(strlen($adminResponse))->toBeGreaterThan(1000); // Should be substantial HTML
|
|
expect($adminResponse)->toContain('Image Management'); // Should contain the page title
|
|
|
|
echo "\n✅ System Status Summary:\n";
|
|
echo " API Images: " . count($response['images']) . "\n";
|
|
echo " Admin Page: Working\n";
|
|
echo " Database: Populated\n";
|
|
echo " Sample Image: " . $firstImage['filename'] . "\n";
|
|
});
|
|
|
|
// Helper function for making HTTP requests with working curl options
|
|
if (! function_exists('curl_exec_with_fallback')) {
|
|
function curl_exec_with_fallback(string $url, array $options = []): mixed
|
|
{
|
|
$ch = curl_init();
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_URL => $url,
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_SSL_VERIFYPEER => false,
|
|
CURLOPT_TIMEOUT => 10,
|
|
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
CURLOPT_HTTPHEADER => $options['headers'] ?? [],
|
|
]);
|
|
|
|
$response = curl_exec($ch);
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
curl_close($ch);
|
|
|
|
if ($httpCode !== 200) {
|
|
throw new Exception("HTTP $httpCode for $url");
|
|
}
|
|
|
|
if (isset($options['json']) && $options['json']) {
|
|
return json_decode($response, true);
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|