Skip to content

Commit

Permalink
Updating ExtractTaskTest to pass under PHPUnit.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 21, 2010
1 parent fad2610 commit 9ace010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/extract.php
Expand Up @@ -17,7 +17,7 @@
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::import('Core', 'File');
/**
* Language string extractor
*
Expand Down
17 changes: 7 additions & 10 deletions cake/tests/cases/console/libs/tasks/extract.test.php
Expand Up @@ -35,12 +35,6 @@

require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'extract.php';


Mock::generatePartial(
'ShellDispatcher', 'TestExtractTaskMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
);

/**
* ExtractTaskTest class
*
Expand All @@ -55,7 +49,9 @@ class ExtractTaskTest extends CakeTestCase {
* @return void
*/
public function setUp() {
$this->Dispatcher =& new TestExtractTaskMockShellDispatcher();
$this->Dispatcher = $this->getMock('ShellDispatcher', array(
'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment'
));
$this->Task =& new ExtractTask($this->Dispatcher);
}

Expand All @@ -81,8 +77,9 @@ public function testExecute() {

$this->Task->params['paths'] = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'pages';
$this->Task->params['output'] = $path . DS;
$this->Task->Dispatch->expectNever('stderr');
$this->Task->Dispatch->expectNever('_stop');
$this->Dispatcher->expects($this->never())->method('stderr');
$this->Dispatcher->expects($this->never())->method('_stop');

$this->Task->execute();
$this->assertTrue(file_exists($path . DS . 'default.pot'));
$result = file_get_contents($path . DS . 'default.pot');
Expand Down Expand Up @@ -132,7 +129,7 @@ public function testExecute() {
$this->assertPattern($pattern, $result);

$pattern = '/\#: (\\\\|\/)extract\.ctp:14\n';
$pattern .= '\#: (\\\\|\/)home\.ctp:74\n';
$pattern .= '\#: (\\\\|\/)home\.ctp:66\n';
$pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
$this->assertPattern($pattern, $result);

Expand Down

0 comments on commit 9ace010

Please sign in to comment.