39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
it('keeps every legacy PHP test accounted for in the manifest', function (): void {
|
|
$manifest = require app_path('tests/Support/legacy_test_manifest.php');
|
|
$manifestPaths = array_map(
|
|
static fn(array $entry): string => str_replace('\\', '/', $entry['path']),
|
|
$manifest
|
|
);
|
|
sort($manifestPaths);
|
|
|
|
$testsRoot = app_path('tests');
|
|
$iterator = new RecursiveIteratorIterator(
|
|
new RecursiveDirectoryIterator($testsRoot, FilesystemIterator::SKIP_DOTS)
|
|
);
|
|
|
|
$actual = [];
|
|
foreach ($iterator as $file) {
|
|
if (!$file instanceof SplFileInfo || !$file->isFile()) {
|
|
continue;
|
|
}
|
|
|
|
if (!str_ends_with($file->getFilename(), 'Test.php')) {
|
|
continue;
|
|
}
|
|
|
|
$relative = str_replace('\\', '/', substr($file->getPathname(), strlen(app_path()) + 1));
|
|
if (preg_match('#^tests/(Unit|Integration|Api|Legacy)/#', $relative) === 1) {
|
|
continue;
|
|
}
|
|
|
|
$actual[] = $relative;
|
|
}
|
|
sort($actual);
|
|
|
|
expect($actual)->toBe($manifestPaths);
|
|
});
|