Skip to content

Commit

Permalink
Adding tests for and fixing the behavior of cake acl initdb it now …
Browse files Browse the repository at this point in the history
…correctly delegates to SchemaShell. Fixes #608
  • Loading branch information
markstory committed Apr 22, 2010
1 parent 81edcdf commit 568e9d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/acl.php
Expand Up @@ -379,7 +379,7 @@ function view() {
* @access public
*/
function initdb() {
$this->Dispatch->args = array('schema', 'run', 'create', 'DbAcl');
$this->Dispatch->args = array('schema', 'create', 'DbAcl');
$this->Dispatch->dispatch();
}

Expand Down
14 changes: 13 additions & 1 deletion cake/tests/cases/console/libs/acl.test.php
Expand Up @@ -36,7 +36,7 @@

Mock::generatePartial(
'ShellDispatcher', 'TestAclShellMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment', 'dispatch')
);
Mock::generatePartial(
'AclShell', 'MockAclShell',
Expand Down Expand Up @@ -331,5 +331,17 @@ function testGetPath() {
$this->Task->expectAt(3, 'out', array(' [4] Elrond'));
$this->Task->getPath();
}

/**
* test that initdb makes the correct call.
*
* @return void
*/
function testInitDb() {
$this->Task->Dispatch->expectOnce('dispatch');
$this->Task->initdb();

$this->assertEqual($this->Task->Dispatch->args, array('schema', 'create', 'DbAcl'));
}
}
?>

0 comments on commit 568e9d3

Please sign in to comment.