- 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.
49 lines
1.5 KiB
PHP
49 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Framework\OAuth\ValueObjects\RefreshToken;
|
|
|
|
describe('RefreshToken Value Object', function () {
|
|
it('creates valid refresh token', function () {
|
|
$token = RefreshToken::create('valid_refresh_token_1234567890');
|
|
|
|
expect($token->toString())->toBe('valid_refresh_token_1234567890');
|
|
});
|
|
|
|
it('rejects empty token', function () {
|
|
RefreshToken::create('');
|
|
})->throws(\InvalidArgumentException::class, 'Refresh token cannot be empty');
|
|
|
|
it('rejects too short token', function () {
|
|
RefreshToken::create('short');
|
|
})->throws(\InvalidArgumentException::class, 'Refresh token appears invalid (too short)');
|
|
|
|
it('masks token for logging', function () {
|
|
$token = RefreshToken::create('1234567890abcdefghijklmnop');
|
|
|
|
$masked = $token->getMasked();
|
|
|
|
expect($masked)->toStartWith('1234');
|
|
expect($masked)->toEndWith('mnop');
|
|
expect($masked)->toContain('*');
|
|
expect(strlen($masked))->toBe(strlen('1234567890abcdefghijklmnop'));
|
|
});
|
|
|
|
it('fully masks very short tokens', function () {
|
|
$token = RefreshToken::create('short_token_');
|
|
|
|
$masked = $token->getMasked();
|
|
|
|
expect($masked)->toBe('************');
|
|
expect(str_contains($masked, 's'))->toBeFalse();
|
|
expect(str_contains($masked, '_'))->toBeFalse();
|
|
});
|
|
|
|
it('converts to string as masked', function () {
|
|
$token = RefreshToken::create('1234567890abcdefghijklmnop');
|
|
|
|
expect((string) $token)->toBe($token->getMasked());
|
|
});
|
|
});
|