Files
michaelschiemer/tests/Framework/MagicLinks/Commands/GenerateMagicLinkCommandTest.php
Michael Schiemer 5050c7d73a docs: consolidate documentation into organized structure
- 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
2025-10-05 11:05:04 +02:00

59 lines
2.1 KiB
PHP

<?php
use App\Framework\MagicLinks\Commands\GenerateMagicLinkCommand;
use App\Framework\MagicLinks\TokenAction;
use App\Framework\MagicLinks\TokenConfig;
use App\Framework\MagicLinks\ValueObjects\MagicLinkPayload;
describe('GenerateMagicLinkCommand', function () {
it('creates command with required parameters', function () {
$action = new TokenAction('email_verification');
$payload = MagicLinkPayload::fromArray(['email' => 'test@example.com']);
$command = new GenerateMagicLinkCommand(
action: $action,
payload: $payload
);
expect($command->action)->toBe($action);
expect($command->payload)->toBe($payload);
expect($command->config)->toBeNull();
expect($command->baseUrl)->toBeNull();
});
it('creates command with all parameters', function () {
$action = new TokenAction('email_verification');
$payload = MagicLinkPayload::fromArray(['email' => 'test@example.com']);
$config = new TokenConfig(expiryHours: 24);
$command = new GenerateMagicLinkCommand(
action: $action,
payload: $payload,
config: $config,
baseUrl: 'https://example.com',
createdByIp: '127.0.0.1',
userAgent: 'Test Agent'
);
expect($command->action)->toBe($action);
expect($command->payload)->toBe($payload);
expect($command->config)->toBe($config);
expect($command->baseUrl)->toBe('https://example.com');
expect($command->createdByIp)->toBe('127.0.0.1');
expect($command->userAgent)->toBe('Test Agent');
});
it('payload is MagicLinkPayload value object', function () {
$action = new TokenAction('test');
$payload = MagicLinkPayload::fromArray(['test' => 'value']);
$command = new GenerateMagicLinkCommand(
action: $action,
payload: $payload
);
expect($command->payload)->toBeInstanceOf(MagicLinkPayload::class);
expect($command->payload->toArray())->toBe(['test' => 'value']);
});
});