Skip to content

Commit

Permalink
Fix plugin path filtering when directories do not exist.
Browse files Browse the repository at this point in the history
When paths do not exist we should correctly remove them from the output
paths.

Fixes #2748
  • Loading branch information
markstory committed Jan 31, 2014
1 parent 605351d commit 4d57d3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Cake/Console/Command/Task/PluginTask.php
Expand Up @@ -191,9 +191,11 @@ public function findPath($pathOptions) {
$valid = false;
foreach ($pathOptions as $i => $path) {
if (!is_dir($path)) {
array_splice($pathOptions, $i, 1);
unset($pathOptions[$i]);
}
}
$pathOptions = array_values($pathOptions);

$max = count($pathOptions);
while (!$valid) {
foreach ($pathOptions as $i => $option) {
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php
Expand Up @@ -185,7 +185,9 @@ public function testExecuteWithOneArg() {
public function testFindPathNonExistant() {
$paths = App::path('plugins');
$last = count($paths);
$paths[] = '/fake/path';

array_unshift($paths, '/fake/path');
$paths[] = '/fake/path2';

$this->Task = $this->getMock('PluginTask',
array('in', 'out', 'err', 'createFile', '_stop'),
Expand Down

0 comments on commit 4d57d3c

Please sign in to comment.