mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Fix new.test and code test runner
Using only the basename leads to collisions...
This commit is contained in:
parent
371c783344
commit
e45e31c218
@ -5,13 +5,14 @@ namespace PhpParser;
|
||||
abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function getTests($directory, $fileExtension) {
|
||||
$directory = realpath($directory);
|
||||
$it = new \RecursiveDirectoryIterator($directory);
|
||||
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY);
|
||||
$it = new \RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)');
|
||||
|
||||
$tests = array();
|
||||
foreach ($it as $file) {
|
||||
$fileName = realpath($file->getPathname());
|
||||
$fileName = $file->getPathname();
|
||||
$fileContents = file_get_contents($fileName);
|
||||
$fileContents = canonicalize($fileContents);
|
||||
|
||||
@ -29,7 +30,7 @@ abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase
|
||||
|
||||
// first part is the name
|
||||
$name = array_shift($parts) . ' (' . $fileName . ')';
|
||||
$shortName = basename($fileName, '.test');
|
||||
$shortName = ltrim(str_replace($directory, '', $fileName), '/\\');
|
||||
|
||||
// multiple sections possible with always two forming a pair
|
||||
$chunks = array_chunk($parts, 2);
|
||||
|
@ -50,6 +50,9 @@ array(
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // class name variations
|
||||
)
|
||||
)
|
||||
3: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
@ -84,6 +87,9 @@ array(
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // DNCR object access
|
||||
)
|
||||
)
|
||||
6: Expr_New(
|
||||
class: Expr_PropertyFetch(
|
||||
|
Loading…
Reference in New Issue
Block a user