- 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.
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Framework\MagicLinks\ValueObjects\ActionResultData;
|
|
|
|
describe('ActionResultData', function () {
|
|
it('creates empty result data', function () {
|
|
$data = ActionResultData::empty();
|
|
|
|
expect($data->isEmpty())->toBeTrue();
|
|
expect($data->toArray())->toBe([]);
|
|
});
|
|
|
|
it('creates from array', function () {
|
|
$data = ActionResultData::fromArray(['user_id' => 123, 'email' => 'test@example.com']);
|
|
|
|
expect($data->isEmpty())->toBeFalse();
|
|
expect($data->toArray())->toBe(['user_id' => 123, 'email' => 'test@example.com']);
|
|
});
|
|
|
|
it('adds values immutably', function () {
|
|
$data = ActionResultData::empty();
|
|
$updated = $data->with('status', 'success');
|
|
|
|
expect($data->has('status'))->toBeFalse();
|
|
expect($updated->has('status'))->toBeTrue();
|
|
expect($updated->get('status'))->toBe('success');
|
|
});
|
|
|
|
it('retrieves values with defaults', function () {
|
|
$data = ActionResultData::fromArray(['status' => 'success']);
|
|
|
|
expect($data->get('status'))->toBe('success');
|
|
expect($data->get('missing', 'default'))->toBe('default');
|
|
});
|
|
|
|
it('merges data', function () {
|
|
$data1 = ActionResultData::fromArray(['user_id' => 123]);
|
|
$data2 = ActionResultData::fromArray(['email' => 'test@example.com']);
|
|
$merged = $data1->merge($data2);
|
|
|
|
expect($merged->toArray())->toBe([
|
|
'user_id' => 123,
|
|
'email' => 'test@example.com',
|
|
]);
|
|
});
|
|
|
|
it('checks key existence', function () {
|
|
$data = ActionResultData::fromArray(['user_id' => 123]);
|
|
|
|
expect($data->has('user_id'))->toBeTrue();
|
|
expect($data->has('missing'))->toBeFalse();
|
|
});
|
|
});
|