Skip to content

Commit

Permalink
Don't output domain files when merge is enabled.
Browse files Browse the repository at this point in the history
When merged pot files are requested, don't output both the merged file
and the individual pot files.

Refs #7345
  • Loading branch information
markstory committed Sep 5, 2015
1 parent 530719b commit ec0e14a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Shell/Task/ExtractTask.php
Expand Up @@ -482,9 +482,10 @@ protected function _buildFiles()
$sentence .= "msgstr[1] \"\"\n\n";
}

$this->_store($domain, $header, $sentence);
if ($domain !== 'default' && $this->_merge) {
$this->_store('default', $header, $sentence);
} else {
$this->_store($domain, $header, $sentence);
}
}
}
Expand Down
27 changes: 25 additions & 2 deletions tests/TestCase/Shell/Task/ExtractTaskTest.php
Expand Up @@ -69,11 +69,11 @@ public function tearDown()
*/
public function testExecute()
{
$this->Task->interactive = false;

$this->Task->params['paths'] = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages';
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['extract-core'] = 'no';
$this->Task->params['merge'] = 'no';

$this->Task->expects($this->never())->method('err');
$this->Task->expects($this->any())->method('in')
->will($this->returnValue('y'));
Expand Down Expand Up @@ -132,6 +132,29 @@ public function testExecute()
$this->assertRegExp($pattern, $result);
}

/**
* testExecute with merging on method
*
* @return void
*/
public function testExecuteMerge()
{
$this->Task->params['paths'] = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages';
$this->Task->params['output'] = $this->path . DS;
$this->Task->params['extract-core'] = 'no';
$this->Task->params['merge'] = 'yes';

$this->Task->expects($this->never())->method('err');
$this->Task->expects($this->any())->method('in')
->will($this->returnValue('y'));
$this->Task->expects($this->never())->method('_stop');

$this->Task->main();
$this->assertFileExists($this->path . DS . 'default.pot');
$this->assertFileNotExists($this->path . DS . 'cake.pot');
$this->assertFileNotExists($this->path . DS . 'domain.pot');
}

/**
* test exclusions
*
Expand Down

0 comments on commit ec0e14a

Please sign in to comment.