Created
September 7, 2019 12:56
-
-
Save alister/88a72240aeace3666bb0bece0a04c00e to your computer and use it in GitHub Desktop.
Find phpunit.xml* files, not in specific sub-dirs, esp not vendors/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Finder\Finder; | |
require 'vendor/autoload.php'; | |
$excludeDirs = [ | |
'assets', | |
'bin', | |
'bower_components', | |
'build', | |
'docs', | |
'features', | |
'log', | |
'var', | |
'node_modules', | |
'vendor', | |
'web', | |
'.rules', | |
'tmp-phpqa', | |
'app/', | |
'src/*', | |
'templates', | |
'tests/', | |
]; | |
// echo "Looking for phpunit.xml* files in ", __DIR__, PHP_EOL; | |
$finder = new Finder(); | |
$finder->files() | |
->in(__DIR__) | |
->files() | |
->name('phpunit.xml*') | |
->exclude($excludeDirs) | |
->notPath($excludeDirs) | |
->ignoreUnreadableDirs() | |
->ignoreVCS(true) | |
->ignoreVCSIgnored(true) | |
; | |
if (!$finder->hasResults()) { | |
echo "no files found.", PHP_EOL; | |
exit; | |
} | |
foreach ($finder as $file) { | |
$fileNameWithExtension = $file->getRelativePathname(); | |
echo $file->getPath(), ',', $file->getRealPath(), PHP_EOL; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment