markTestSkipped('SchoolCore directory not present in this test installation.'); } $violations = []; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root)) as $file) { if (! $file instanceof SplFileInfo || $file->getExtension() !== 'php') { continue; } $contents = file_get_contents($file->getPathname()) ?: ''; foreach ($forbidden as $needle) { if (str_contains($contents, $needle)) { $violations[] = $file->getPathname() . ' contains ' . $needle; } } } $this->assertSame([], $violations); } }