- Move 12 markdown files from root to docs/ subdirectories - Organize documentation by category: • docs/troubleshooting/ (1 file) - Technical troubleshooting guides • docs/deployment/ (4 files) - Deployment and security documentation • docs/guides/ (3 files) - Feature-specific guides • docs/planning/ (4 files) - Planning and improvement proposals Root directory cleanup: - Reduced from 16 to 4 markdown files in root - Only essential project files remain: • CLAUDE.md (AI instructions) • README.md (Main project readme) • CLEANUP_PLAN.md (Current cleanup plan) • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements) This improves: ✅ Documentation discoverability ✅ Logical organization by purpose ✅ Clean root directory ✅ Better maintainability
52 lines
1.8 KiB
PHP
52 lines
1.8 KiB
PHP
<?php
|
|
|
|
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');
|
|
});
|
|
});
|