- 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.
70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Framework\Process\ValueObjects\EnvironmentVariables;
|
|
|
|
describe('EnvironmentVariables Value Object', function () {
|
|
it('can be created empty', function () {
|
|
$env = EnvironmentVariables::empty();
|
|
|
|
expect($env->isEmpty())->toBeTrue()
|
|
->and($env->toArray())->toBe([]);
|
|
});
|
|
|
|
it('can be created from array', function () {
|
|
$env = EnvironmentVariables::fromArray([
|
|
'FOO' => 'bar',
|
|
'BAZ' => 'qux',
|
|
]);
|
|
|
|
expect($env->isEmpty())->toBeFalse()
|
|
->and($env->has('FOO'))->toBeTrue()
|
|
->and($env->get('FOO'))->toBe('bar')
|
|
->and($env->get('BAZ'))->toBe('qux');
|
|
});
|
|
|
|
it('can merge variables', function () {
|
|
$env1 = EnvironmentVariables::fromArray(['FOO' => 'bar']);
|
|
$env2 = $env1->merge(['BAZ' => 'qux']);
|
|
|
|
expect($env2->has('FOO'))->toBeTrue()
|
|
->and($env2->has('BAZ'))->toBeTrue()
|
|
->and($env2->toArray())->toBe([
|
|
'FOO' => 'bar',
|
|
'BAZ' => 'qux',
|
|
]);
|
|
});
|
|
|
|
it('can add single variable', function () {
|
|
$env1 = EnvironmentVariables::empty();
|
|
$env2 = $env1->with('FOO', 'bar');
|
|
|
|
expect($env2->has('FOO'))->toBeTrue()
|
|
->and($env2->get('FOO'))->toBe('bar');
|
|
});
|
|
|
|
it('can remove variable', function () {
|
|
$env1 = EnvironmentVariables::fromArray(['FOO' => 'bar', 'BAZ' => 'qux']);
|
|
$env2 = $env1->without('FOO');
|
|
|
|
expect($env2->has('FOO'))->toBeFalse()
|
|
->and($env2->has('BAZ'))->toBeTrue();
|
|
});
|
|
|
|
it('returns default for missing variable', function () {
|
|
$env = EnvironmentVariables::empty();
|
|
|
|
expect($env->get('MISSING', 'default'))->toBe('default')
|
|
->and($env->get('MISSING'))->toBeNull();
|
|
});
|
|
|
|
it('preserves immutability', function () {
|
|
$env1 = EnvironmentVariables::fromArray(['FOO' => 'bar']);
|
|
$env2 = $env1->with('BAZ', 'qux');
|
|
|
|
expect($env1->has('BAZ'))->toBeFalse()
|
|
->and($env2->has('BAZ'))->toBeTrue();
|
|
});
|
|
});
|