minor #27508 [Finder] Update RealIteratorTestCase (flip111)
This PR was submitted for the master branch but it was squashed and merged into the 2.8 branch instead (closes #27508).
Discussion
----------
[Finder] Update RealIteratorTestCase
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #27480
| License | MIT
| Doc PR | n/a
Makes the entire test directory empty instead of trying to delete particular files and directories. The old method failed when trying to remove a directory which was not empty.
Commits
-------
7d0ebd41ab
[Finder] Update RealIteratorTestCase
This commit is contained in:
commit
9f1d1d82fb
@ -60,11 +60,20 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||||||
|
|
||||||
public static function tearDownAfterClass()
|
public static function tearDownAfterClass()
|
||||||
{
|
{
|
||||||
foreach (array_reverse(self::$files) as $file) {
|
$paths = new \RecursiveIteratorIterator(
|
||||||
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||||
@rmdir($file);
|
\RecursiveIteratorIterator::CHILD_FIRST
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
if ($path->isDir()) {
|
||||||
|
if ($path->isLink()) {
|
||||||
|
@unlink($path);
|
||||||
} else {
|
} else {
|
||||||
@unlink($file);
|
@rmdir($path);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
@unlink($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user