Correcting how ExtractTask collects files. Test added. Fixes #775

This commit is contained in:
mark_story 2010-06-06 22:39:04 -04:00
parent 0eea0ce0f8
commit 94fc492623
2 changed files with 30 additions and 1 deletions

View file

@ -488,7 +488,7 @@ class ExtractTask extends Shell {
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);
}
}
}

View file

@ -155,4 +155,33 @@ class ExtractTaskTest extends CakeTestCase {
$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);
}
}