Files
api/services/nginx/app/tests/Unit/Search/SystemSearchRouteWiringTest.php
T

40 lines
1.8 KiB
PHP

<?php
it('registers system-wide search GET and POST endpoints with capped relevance support', function (): void {
$routeFile = app_path('routes/systemSearchRoute.php');
$content = file_get_contents($routeFile);
expect($content)->not->toBeFalse();
expect($content)->toContain('/search/system');
expect($content)->toContain("'max_results'");
expect($content)->toContain("'include_types'");
expect($content)->toContain("'exclude_types'");
expect($content)->toContain('new system_search_service()');
expect($content)->not->toContain("\$params['limit']");
expect($content)->not->toContain("'debug_intent'");
});
it('registers superuser cache clear and rebuild endpoints for system search', function (): void {
$routeFile = app_path('routes/systemSearchRoute.php');
$content = file_get_contents($routeFile);
expect($content)->not->toBeFalse();
expect($content)->toContain('/superuser/search/system/cache');
expect($content)->toContain('/superuser/search/system/cache/rebuild');
expect($content)->toContain("requirePermission('superuser_search_system_cache_clear')");
expect($content)->toContain("requirePermission('superuser_search_system_cache_rebuild')");
expect($content)->not->toContain('system_search_cache::clearIntentCaches()');
});
it('passes permission and own-scope context into system search service', function (): void {
$routeFile = app_path('routes/systemSearchRoute.php');
$content = file_get_contents($routeFile);
expect($content)->not->toBeFalse();
expect($content)->toContain("'allowed_types'");
expect($content)->toContain("'own_only_types'");
expect($content)->toContain("'own_customer_number'");
expect($content)->toContain("'permissions_catalog_all'");
expect($content)->toContain("'permissions_catalog_own'");
});