TenantAtlas/apps/platform/tests/Architecture/Spec392DeprecatedCustomerOutputDownloadGuardTest.php
Ahmed Darrazi 59b45becc1
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m35s
feat: enforce Spec392 customer output gating
2026-06-20 22:52:43 +02:00

58 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
it('keeps deprecated customer-output limited download vocabulary out of product surfaces', function (): void {
$forbiddenTerms = [
'download_review_pack_with_limitations',
'Download review pack with limitations',
'Download with limitations',
];
$roots = [
app_path(),
base_path('routes'),
resource_path(),
base_path('lang'),
base_path('tests'),
];
$self = realpath(__FILE__);
$violations = [];
foreach ($roots as $root) {
if (! is_dir($root)) {
continue;
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS),
);
foreach ($iterator as $file) {
if (! $file instanceof SplFileInfo || ! $file->isFile()) {
continue;
}
$path = $file->getRealPath();
if (! is_string($path) || $path === $self || ! preg_match('/\.(blade\.php|php|js|ts|vue|json)$/', $path)) {
continue;
}
$contents = file_get_contents($path);
if (! is_string($contents)) {
continue;
}
foreach ($forbiddenTerms as $term) {
if (str_contains($contents, $term)) {
$violations[] = str_replace(base_path().DIRECTORY_SEPARATOR, '', $path).': '.$term;
}
}
}
}
expect($violations)->toBeEmpty();
});