Created
March 23, 2016 13:59
-
-
Save korchasa/370c079a88725149f93a to your computer and use it in GitHub Desktop.
Find not a test with valid phpunit suffix
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 | |
require_once __DIR__.'/../src/test/bootstrap.php'; | |
$finder = new \Symfony\Component\Finder\Finder(); | |
$finder->in(__DIR__.'/../src') | |
->name('*Test.php') | |
->files(); | |
foreach($finder as $file) { | |
/** @var \Symfony\Component\Finder\SplFileInfo $file */ | |
if (!isTest($file->getPathname())) { | |
echo $file->getPathname().PHP_EOL; | |
} | |
} | |
function isTest($filename) | |
{ | |
$ref = new \Go\ParserReflection\ReflectionFile($filename); | |
foreach ($ref->getFileNamespaces() as $namespace) { | |
foreach ($namespace->getClasses() as $class) { | |
require_once $filename; | |
return $class->isSubclassOf(\PHPUnit_Framework_TestCase::class); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment