mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Correcting how ExtractTask collects files. Test added. Fixes #775
This commit is contained in:
parent
0eea0ce0f8
commit
94fc492623
2 changed files with 30 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue