Skip to content

Instantly share code, notes, and snippets.

@korchasa
Created March 23, 2016 13:59
Show Gist options
  • Save korchasa/370c079a88725149f93a to your computer and use it in GitHub Desktop.
Save korchasa/370c079a88725149f93a to your computer and use it in GitHub Desktop.
Find not a test with valid phpunit suffix
<?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