From 568e9d3a891c8f033473873769d9f40f59bd36a4 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Wed, 21 Apr 2010 23:28:40 -0400 Subject: [PATCH] Adding tests for and fixing the behavior of `cake acl initdb` it now correctly delegates to SchemaShell. Fixes #608 --- cake/console/libs/acl.php | 2 +- cake/tests/cases/console/libs/acl.test.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cake/console/libs/acl.php b/cake/console/libs/acl.php index 2b28323c787..1db29bbdd63 100644 --- a/cake/console/libs/acl.php +++ b/cake/console/libs/acl.php @@ -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(); } diff --git a/cake/tests/cases/console/libs/acl.test.php b/cake/tests/cases/console/libs/acl.test.php index ccd3d04010f..02aba2c7a5b 100644 --- a/cake/tests/cases/console/libs/acl.test.php +++ b/cake/tests/cases/console/libs/acl.test.php @@ -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', @@ -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')); + } } ?> \ No newline at end of file