Files
michaelschiemer/tests/Framework/MagicLinks/ValueObjects/ExecutionContextTest.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

54 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
use App\Framework\MagicLinks\ValueObjects\ExecutionContext;
describe('ExecutionContext', function () {
it('creates empty context', function () {
$context = ExecutionContext::empty();
expect($context->isEmpty())->toBeTrue();
expect($context->toArray())->toBe([]);
});
it('creates context from array', function () {
$context = ExecutionContext::fromArray(['ip' => '127.0.0.1', 'user_agent' => 'Test']);
expect($context->isEmpty())->toBeFalse();
expect($context->toArray())->toBe(['ip' => '127.0.0.1', 'user_agent' => 'Test']);
});
it('adds values immutably', function () {
$context = ExecutionContext::empty();
$updated = $context->with('ip', '127.0.0.1');
expect($context->has('ip'))->toBeFalse();
expect($updated->has('ip'))->toBeTrue();
expect($updated->get('ip'))->toBe('127.0.0.1');
});
it('retrieves values with defaults', function () {
$context = ExecutionContext::fromArray(['ip' => '127.0.0.1']);
expect($context->get('ip'))->toBe('127.0.0.1');
expect($context->get('missing', 'default'))->toBe('default');
});
it('merges contexts', function () {
$context1 = ExecutionContext::fromArray(['ip' => '127.0.0.1']);
$context2 = ExecutionContext::fromArray(['user_agent' => 'Test']);
$merged = $context1->merge($context2);
expect($merged->toArray())->toBe(['ip' => '127.0.0.1', 'user_agent' => 'Test']);
});
it('merges with override', function () {
$context1 = ExecutionContext::fromArray(['ip' => '127.0.0.1']);
$context2 = ExecutionContext::fromArray(['ip' => '192.168.1.1']);
$merged = $context1->merge($context2);
expect($merged->get('ip'))->toBe('192.168.1.1');
});
});