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