Skip to content

Commit

Permalink
Correcting how ExtractTask collects files. Test added. Fixes #775
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 7, 2010
1 parent 0eea0ce commit 94fc492
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/extract.php
Expand Up @@ -488,7 +488,7 @@ function __searchFiles() {
foreach ($this->__paths as $path) {
$Folder = new Folder($path);
$files = $Folder->findRecursive('.*\.(php|ctp|thtml|inc|tpl)', true);
$this->__files += $files;
$this->__files = array_merge($this->__files, $files);
}
}
}
29 changes: 29 additions & 0 deletions cake/tests/cases/console/libs/tasks/extract.test.php
Expand Up @@ -155,4 +155,33 @@ function testExecute() {
$Folder = new Folder($path);
$Folder->delete();
}
function getTests() {
return array('start', 'startCase', 'testExtractMultiplePaths', 'endCase', 'end');
}

/**
* test extract can read more than one path.
*
* @return void
*/
function testExtractMultiplePaths() {
$path = TMP . 'tests' . DS . 'extract_task_test';
new Folder($path . DS . 'locale', true);

$this->Task->interactive = false;

$this->Task->params['paths'] =
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'pages,' .
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'posts';

$this->Task->params['output'] = $path . DS;
$this->Task->Dispatch->expectNever('stderr');
$this->Task->Dispatch->expectNever('_stop');
$this->Task->execute();

$result = file_get_contents($path . DS . 'default.pot');

$pattern = '/msgid "Add User"/';
$this->assertPattern($pattern, $result);
}
}

0 comments on commit 94fc492

Please sign in to comment.