Home » Testing » PHPUnit » Bug #5341
GUI SetupDecorator fails under symlinked directory
Details
| Submitted | 2005-09-08 16:52 UTC |
|---|---|
| From | jbyers at jbyers dot com |
| Status | Closed |
| Package | PHPUnit |
| PHP Version | 4.3.10 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-09-08 16:52 UTC] jbyers at jbyers dot com
Description:
------------
In PHPUnit 1.3.0, PHPUnit_GUI_SetupDecorator::getSuitesFromDir fails to load tests contained in a path under a symlink. The call to _getFiles on SetupDecorator.php line 99 calls realpath on $rootDir but not on $dir. _getFiles is then unable to strip rootDir from the file paths to construct class names.
For example:
/1/2
/1/symlink -> 2
/1/2/3
/1/2/3/TestOne.php
/1/2/3/TestTwo.php
If getSuitesFromDir is called with $dir as /1/symlink/3, _getFiles will attempt to strip /1/2 from the path.
Patch below adding realpath() call to make both paths match.
Test script:
---------------
Index: SetupDecorator.php
===================================================================
--- SetupDecorator.php (revision 2046)
+++ SetupDecorator.php (working copy)
@@ -96,7 +96,7 @@
$dir = substr($dir, 0, -1);
}
- $files = $this->_getFiles($dir, $filenamePattern, $exclude, realpath($dir . '/..'));
+ $files = $this->_getFiles(realpath($dir), $filenamePattern, $exclude, realpath($dir . '/..'));
asort($files);
foreach ($files as $className => $aFile) {