Files
michaelschiemer/tests/Support/InMemoryUploadSessionStore.php
Michael Schiemer fc3d7e6357 feat(Production): Complete production deployment infrastructure
- 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.
2025-10-25 19:18:37 +02:00

84 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Support;
use App\Framework\LiveComponents\Services\UploadSessionStore;
use App\Framework\LiveComponents\ValueObjects\UploadSession;
use App\Framework\LiveComponents\ValueObjects\UploadSessionId;
use DateTimeImmutable;
/**
* In-Memory Upload Session Store for Testing
*
* Thread-safe in-memory implementation of UploadSessionStore
* for use in tests. Does not require database or cache.
*/
final class InMemoryUploadSessionStore implements UploadSessionStore
{
/** @var array<string, UploadSession> */
private array $sessions = [];
public function save(UploadSession $session): void
{
$this->sessions[$session->sessionId->value] = $session;
}
public function get(UploadSessionId $sessionId): ?UploadSession
{
return $this->sessions[$sessionId->value] ?? null;
}
public function delete(UploadSessionId $sessionId): void
{
unset($this->sessions[$sessionId->value]);
}
public function exists(UploadSessionId $sessionId): bool
{
return isset($this->sessions[$sessionId->value]);
}
public function cleanupExpired(): int
{
$now = new DateTimeImmutable();
$cleaned = 0;
foreach ($this->sessions as $key => $session) {
if ($session->isExpired()) {
unset($this->sessions[$key]);
$cleaned++;
}
}
return $cleaned;
}
/**
* Get all stored sessions (for testing)
*
* @return array<UploadSession>
*/
public function getAll(): array
{
return array_values($this->sessions);
}
/**
* Get count of stored sessions (for testing)
*/
public function count(): int
{
return count($this->sessions);
}
/**
* Clear all sessions (for testing)
*/
public function clear(): void
{
$this->sessions = [];
}
}