- 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.7 KiB
PHP
52 lines
1.7 KiB
PHP
<?php
|
|
|
|
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']);
|
|
});
|
|
});
|