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'); }); });