- 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.
82 lines
3.0 KiB
PHP
82 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Framework\Development\HotReload;
|
|
|
|
use App\Framework\Development\HotReload\FileChangeEvent;
|
|
use App\Framework\Development\HotReload\FileChangeType;
|
|
|
|
describe('FileChangeEvent', function () {
|
|
it('creates event for file creation', function () {
|
|
$event = FileChangeEvent::created('/path/to/file.php');
|
|
|
|
expect($event->getPath())->toBe('/path/to/file.php');
|
|
expect($event->getType())->toBe(FileChangeType::CREATED);
|
|
expect($event->getTimestamp())->not->toBeNull();
|
|
});
|
|
|
|
it('creates event for file modification', function () {
|
|
$event = FileChangeEvent::modified('/path/to/file.php', 'abc123');
|
|
|
|
expect($event->getPath())->toBe('/path/to/file.php');
|
|
expect($event->getType())->toBe(FileChangeType::MODIFIED);
|
|
expect($event->getHash())->toBe('abc123');
|
|
});
|
|
|
|
it('creates event for file deletion', function () {
|
|
$event = FileChangeEvent::deleted('/path/to/file.php');
|
|
|
|
expect($event->getPath())->toBe('/path/to/file.php');
|
|
expect($event->getType())->toBe(FileChangeType::DELETED);
|
|
});
|
|
|
|
it('identifies PHP files', function () {
|
|
$event = FileChangeEvent::created('/path/to/file.php');
|
|
expect($event->isPhpFile())->toBeTrue();
|
|
|
|
$event2 = FileChangeEvent::created('/path/to/file.js');
|
|
expect($event2->isPhpFile())->toBeFalse();
|
|
});
|
|
|
|
it('identifies view files', function () {
|
|
$event = FileChangeEvent::created('/path/views/template.view.php');
|
|
expect($event->isViewFile())->toBeTrue();
|
|
|
|
$event2 = FileChangeEvent::created('/src/Controller.php');
|
|
expect($event2->isViewFile())->toBeFalse();
|
|
});
|
|
|
|
it('identifies config files', function () {
|
|
$event = FileChangeEvent::created('/config/app.php');
|
|
expect($event->isConfigFile())->toBeTrue();
|
|
|
|
$event2 = FileChangeEvent::created('/src/Service.php');
|
|
expect($event2->isConfigFile())->toBeFalse();
|
|
});
|
|
|
|
it('identifies asset files', function () {
|
|
expect(FileChangeEvent::created('/styles/app.css')->isAssetFile())->toBeTrue();
|
|
expect(FileChangeEvent::created('/scripts/app.js')->isAssetFile())->toBeTrue();
|
|
expect(FileChangeEvent::created('/src/app.ts')->isAssetFile())->toBeTrue();
|
|
expect(FileChangeEvent::created('/styles/main.scss')->isAssetFile())->toBeTrue();
|
|
expect(FileChangeEvent::created('/src/Controller.php')->isAssetFile())->toBeFalse();
|
|
});
|
|
|
|
it('gets relative path from base path', function () {
|
|
$event = FileChangeEvent::created('/var/www/html/src/Controller.php');
|
|
|
|
$relative = $event->getRelativePath('/var/www/html');
|
|
|
|
expect($relative)->toBe('src/Controller.php');
|
|
});
|
|
|
|
it('returns full path when base path does not match', function () {
|
|
$event = FileChangeEvent::created('/var/www/html/src/Controller.php');
|
|
|
|
$relative = $event->getRelativePath('/other/path');
|
|
|
|
expect($relative)->toBe('/var/www/html/src/Controller.php');
|
|
});
|
|
});
|