fixed recursive iteration bug
This commit is contained in:
parent
3c47c48488
commit
175526841c
@ -32,6 +32,19 @@
|
||||
parent::__construct(new RecursiveDirectoryIterator($dir));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the children for the inner iterator
|
||||
*
|
||||
* @author Tommy Montgomery
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*
|
||||
* @return RecursivePhpFileIterator
|
||||
*/
|
||||
public function getChildren() {
|
||||
return new self($this->current()->getPathName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines acceptance criteria for iteration
|
||||
*
|
||||
@ -43,9 +56,12 @@
|
||||
*/
|
||||
public function accept() {
|
||||
return
|
||||
!$this->getInnerIterator()->isDot() &&
|
||||
strpos($this->current()->getPathName(), DIRECTORY_SEPARATOR . '.') === false &&
|
||||
substr($this->current()->getFileName(), -4) === '.php';
|
||||
strpos($this->current()->getPathName(), DIRECTORY_SEPARATOR . '.') === false && (
|
||||
$this->current()->isDir() || (
|
||||
!$this->getInnerIterator()->isDot() &&
|
||||
substr($this->current()->getFileName(), -4) === '.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
* @return array
|
||||
*/
|
||||
public static function getTestsFromDir($dir, $recursive = true) {
|
||||
$iterator = ($recursive) ? new RecursivePhpFileIterator($dir) : new PhpFileIterator($dir);
|
||||
$iterator = ($recursive) ? new RecursiveIteratorIterator(new RecursivePhpFileIterator($dir)) : new PhpFileIterator($dir);
|
||||
|
||||
$tests = array();
|
||||
foreach ($iterator as $file) {
|
||||
|
Loading…
Reference in New Issue
Block a user