- 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.
54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Framework\MagicLinks\ValueObjects\Metadata;
|
|
|
|
describe('Metadata', function () {
|
|
it('creates empty metadata', function () {
|
|
$metadata = Metadata::empty();
|
|
|
|
expect($metadata->isEmpty())->toBeTrue();
|
|
expect($metadata->toArray())->toBe([]);
|
|
});
|
|
|
|
it('creates from array', function () {
|
|
$metadata = Metadata::fromArray(['source' => 'email', 'campaign' => 'welcome']);
|
|
|
|
expect($metadata->isEmpty())->toBeFalse();
|
|
expect($metadata->toArray())->toBe(['source' => 'email', 'campaign' => 'welcome']);
|
|
});
|
|
|
|
it('adds values immutably', function () {
|
|
$metadata = Metadata::empty();
|
|
$updated = $metadata->with('source', 'email');
|
|
|
|
expect($metadata->has('source'))->toBeFalse();
|
|
expect($updated->has('source'))->toBeTrue();
|
|
expect($updated->get('source'))->toBe('email');
|
|
});
|
|
|
|
it('removes values immutably', function () {
|
|
$metadata = Metadata::fromArray(['source' => 'email', 'campaign' => 'welcome']);
|
|
$updated = $metadata->without('campaign');
|
|
|
|
expect($metadata->has('campaign'))->toBeTrue();
|
|
expect($updated->has('campaign'))->toBeFalse();
|
|
expect($updated->has('source'))->toBeTrue();
|
|
});
|
|
|
|
it('merges metadata', function () {
|
|
$meta1 = Metadata::fromArray(['source' => 'email']);
|
|
$meta2 = Metadata::fromArray(['campaign' => 'welcome']);
|
|
$merged = $meta1->merge($meta2);
|
|
|
|
expect($merged->toArray())->toBe(['source' => 'email', 'campaign' => 'welcome']);
|
|
});
|
|
|
|
it('returns keys', function () {
|
|
$metadata = Metadata::fromArray(['source' => 'email', 'campaign' => 'welcome']);
|
|
|
|
expect($metadata->keys())->toBe(['source', 'campaign']);
|
|
});
|
|
});
|