Reformatting and adding missing documentation blocks.

This commit is contained in:
predominant 2009-11-14 23:18:31 +11:00
parent 2ea6047c80
commit 5092262d4d
15 changed files with 591 additions and 183 deletions

View file

@ -83,8 +83,8 @@ class TestShellDispatcher extends ShellDispatcher {
/** /**
* _initEnvironment method * _initEnvironment method
* *
* @access protected
* @return void * @return void
* @access protected
*/ */
function _initEnvironment() { function _initEnvironment() {
} }
@ -92,8 +92,8 @@ class TestShellDispatcher extends ShellDispatcher {
/** /**
* stderr method * stderr method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function stderr($string) { function stderr($string) {
$this->stderr .= rtrim($string, ' '); $this->stderr .= rtrim($string, ' ');
@ -102,8 +102,8 @@ class TestShellDispatcher extends ShellDispatcher {
/** /**
* stdout method * stdout method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function stdout($string, $newline = true) { function stdout($string, $newline = true) {
if ($newline) { if ($newline) {
@ -116,8 +116,8 @@ class TestShellDispatcher extends ShellDispatcher {
/** /**
* clear method * clear method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function clear() { function clear() {
@ -126,8 +126,8 @@ class TestShellDispatcher extends ShellDispatcher {
/** /**
* _stop method * _stop method
* *
* @access protected
* @return void * @return void
* @access protected
*/ */
function _stop($status = 0) { function _stop($status = 0) {
$this->stopped = 'Stopped with status: ' . $status; $this->stopped = 'Stopped with status: ' . $status;
@ -138,8 +138,8 @@ class TestShellDispatcher extends ShellDispatcher {
* getShell * getShell
* *
* @param mixed $plugin * @param mixed $plugin
* @access public
* @return mixed * @return mixed
* @access public
*/ */
function getShell($plugin = null) { function getShell($plugin = null) {
return $this->_getShell($plugin); return $this->_getShell($plugin);
@ -149,8 +149,8 @@ class TestShellDispatcher extends ShellDispatcher {
* _getShell * _getShell
* *
* @param mixed $plugin * @param mixed $plugin
* @access protected
* @return mixed * @return mixed
* @access protected
*/ */
function _getShell($plugin = null) { function _getShell($plugin = null) {
if (isset($this->TestShell)) { if (isset($this->TestShell)) {
@ -171,8 +171,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* setUp method * setUp method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function setUp() { function setUp() {
App::build(array( App::build(array(
@ -189,8 +189,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* tearDown method * tearDown method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function tearDown() { function tearDown() {
App::build(); App::build();
@ -199,8 +199,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* testParseParams method * testParseParams method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testParseParams() { function testParseParams() {
$Dispatcher =& new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
@ -458,8 +458,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* testBuildPaths method * testBuildPaths method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testBuildPaths() { function testBuildPaths() {
$Dispatcher =& new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
@ -481,8 +481,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify loading of (plugin-) shells * Verify loading of (plugin-) shells
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testGetShell() { function testGetShell() {
$this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded'); $this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded');
@ -510,8 +510,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify correct dispatch of Shell subclasses with a main method * Verify correct dispatch of Shell subclasses with a main method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testDispatchShellWithMain() { function testDispatchShellWithMain() {
Mock::generate('Shell', 'MockWithMainShell', array('main', '_secret')); Mock::generate('Shell', 'MockWithMainShell', array('main', '_secret'));
@ -601,8 +601,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify correct dispatch of Shell subclasses without a main method * Verify correct dispatch of Shell subclasses without a main method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testDispatchShellWithoutMain() { function testDispatchShellWithoutMain() {
Mock::generate('Shell', 'MockWithoutMainShell', array('initDb', '_secret')); Mock::generate('Shell', 'MockWithoutMainShell', array('initDb', '_secret'));
@ -673,8 +673,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify correct dispatch of custom classes with a main method * Verify correct dispatch of custom classes with a main method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testDispatchNotAShellWithMain() { function testDispatchNotAShellWithMain() {
Mock::generate('Object', 'MockWithMainNotAShell', Mock::generate('Object', 'MockWithMainNotAShell',
@ -753,8 +753,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify correct dispatch of custom classes without a main method * Verify correct dispatch of custom classes without a main method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testDispatchNotAShellWithoutMain() { function testDispatchNotAShellWithoutMain() {
Mock::generate('Object', 'MockWithoutMainNotAShell', Mock::generate('Object', 'MockWithoutMainNotAShell',
@ -824,8 +824,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify that a task is called instead of the shell if the first arg equals * Verify that a task is called instead of the shell if the first arg equals
* the name of the task * the name of the task
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testDispatchTask() { function testDispatchTask() {
Mock::generate('Shell', 'MockWeekShell', array('main')); Mock::generate('Shell', 'MockWeekShell', array('main'));
@ -872,8 +872,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* Verify shifting of arguments * Verify shifting of arguments
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testShiftArgs() { function testShiftArgs() {
$Dispatcher =& new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
@ -902,8 +902,8 @@ class ShellDispatcherTest extends CakeTestCase {
/** /**
* testHelpCommand method * testHelpCommand method
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testHelpCommand() { function testHelpCommand() {
$Dispatcher =& new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();

View file

@ -52,13 +52,21 @@ Mock::generate('AclComponent', 'MockAclShellAclComponent');
* @subpackage cake.tests.cases.console.libs.tasks * @subpackage cake.tests.cases.console.libs.tasks
*/ */
class AclShellTest extends CakeTestCase { class AclShellTest extends CakeTestCase {
/**
* Fixtures
*
* @var array
* @access public
*/
var $fixtures = array('core.aco', 'core.aro', 'core.aros_aco'); var $fixtures = array('core.aco', 'core.aro', 'core.aros_aco');
/** /**
* configure Configure for testcase * configure Configure for testcase
* *
* @return void * @return void
**/ * @access public
*/
function startCase() { function startCase() {
$this->_aclDb = Configure::read('Acl.database'); $this->_aclDb = Configure::read('Acl.database');
$this->_aclClass = Configure::read('Acl.classname'); $this->_aclClass = Configure::read('Acl.classname');
@ -71,7 +79,8 @@ class AclShellTest extends CakeTestCase {
* restore Environment settings * restore Environment settings
* *
* @return void * @return void
**/ * @access public
*/
function endCase() { function endCase() {
Configure::write('Acl.database', $this->_aclDb); Configure::write('Acl.database', $this->_aclDb);
Configure::write('Acl.classname', $this->_aclClass); Configure::write('Acl.classname', $this->_aclClass);
@ -107,7 +116,8 @@ class AclShellTest extends CakeTestCase {
* test that model.foreign_key output works when looking at acl rows * test that model.foreign_key output works when looking at acl rows
* *
* @return void * @return void
**/ * @access public
*/
function testViewWithModelForeignKeyOutput() { function testViewWithModelForeignKeyOutput() {
$this->Task->command = 'view'; $this->Task->command = 'view';
$this->Task->startup(); $this->Task->startup();
@ -132,7 +142,8 @@ class AclShellTest extends CakeTestCase {
* test view with an argument * test view with an argument
* *
* @return void * @return void
**/ * @access public
*/
function testViewWithArgument() { function testViewWithArgument() {
$this->Task->args = array('aro', 'admins'); $this->Task->args = array('aro', 'admins');
$this->Task->expectAt(0, 'out', array('Aro tree:')); $this->Task->expectAt(0, 'out', array('Aro tree:'));
@ -146,7 +157,8 @@ class AclShellTest extends CakeTestCase {
* test the method that splits model.foreign key. and that it returns an array. * test the method that splits model.foreign key. and that it returns an array.
* *
* @return void * @return void
**/ * @access public
*/
function testParsingModelAndForeignKey() { function testParsingModelAndForeignKey() {
$result = $this->Task->parseIdentifier('Model.foreignKey'); $result = $this->Task->parseIdentifier('Model.foreignKey');
$expected = array('model' => 'Model', 'foreign_key' => 'foreignKey'); $expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
@ -162,7 +174,8 @@ class AclShellTest extends CakeTestCase {
* test creating aro/aco nodes * test creating aro/aco nodes
* *
* @return void * @return void
**/ * @access public
*/
function testCreate() { function testCreate() {
$this->Task->args = array('aro', 'root', 'User.1'); $this->Task->args = array('aro', 'root', 'User.1');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*')); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*'));
@ -202,7 +215,8 @@ class AclShellTest extends CakeTestCase {
* test the delete method with different node types. * test the delete method with different node types.
* *
* @return void * @return void
**/ * @access public
*/
function testDelete() { function testDelete() {
$this->Task->args = array('aro', 'AuthUser.1'); $this->Task->args = array('aro', 'AuthUser.1');
$this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true)); $this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true));
@ -217,7 +231,8 @@ class AclShellTest extends CakeTestCase {
* test setParent method. * test setParent method.
* *
* @return void * @return void
**/ * @access public
*/
function testSetParent() { function testSetParent() {
$this->Task->args = array('aro', 'AuthUser.2', 'root'); $this->Task->args = array('aro', 'AuthUser.2', 'root');
$this->Task->setParent(); $this->Task->setParent();
@ -231,7 +246,8 @@ class AclShellTest extends CakeTestCase {
* test grant * test grant
* *
* @return void * @return void
**/ * @access public
*/
function testGrant() { function testGrant() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true)); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
@ -246,7 +262,8 @@ class AclShellTest extends CakeTestCase {
* test deny * test deny
* *
* @return void * @return void
**/ * @access public
*/
function testDeny() { function testDeny() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission denied/'), true)); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission denied/'), true));
@ -261,7 +278,8 @@ class AclShellTest extends CakeTestCase {
* test checking allowed and denied perms * test checking allowed and denied perms
* *
* @return void * @return void
**/ * @access public
*/
function testCheck() { function testCheck() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', '*'); $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', '*');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/not allowed/'), true)); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/not allowed/'), true));
@ -284,7 +302,8 @@ class AclShellTest extends CakeTestCase {
* test inherit and that it 0's the permission fields. * test inherit and that it 0's the permission fields.
* *
* @return void * @return void
**/ * @access public
*/
function testInherit() { function testInherit() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true)); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
@ -303,7 +322,8 @@ class AclShellTest extends CakeTestCase {
* test getting the path for an aro/aco * test getting the path for an aro/aco
* *
* @return void * @return void
**/ * @access public
*/
function testGetPath() { function testGetPath() {
$this->Task->args = array('aro', 'AuthUser.2'); $this->Task->args = array('aro', 'AuthUser.2');
$this->Task->expectAt(1, 'out', array('[1] ROOT')); $this->Task->expectAt(1, 'out', array('[1] ROOT'));
@ -311,6 +331,5 @@ class AclShellTest extends CakeTestCase {
$this->Task->expectAt(3, 'out', array(' [4] Elrond')); $this->Task->expectAt(3, 'out', array(' [4] Elrond'));
$this->Task->getPath(); $this->Task->getPath();
} }
} }
?> ?>

View file

@ -76,8 +76,8 @@ class ApiShellTest extends CakeTestCase {
/** /**
* Test that method names are detected properly including those with no arguments. * Test that method names are detected properly including those with no arguments.
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testMethodNameDetection () { function testMethodNameDetection () {
$this->Shell->setReturnValueAt(0, 'in', 'q'); $this->Shell->setReturnValueAt(0, 'in', 'q');

View file

@ -61,14 +61,16 @@ class BakeShellTestCase extends CakeTestCase {
* fixtures * fixtures
* *
* @var array * @var array
**/ * @access public
*/
var $fixtures = array('core.user'); var $fixtures = array('core.user');
/** /**
* start test * start test
* *
* @return void * @return void
**/ * @access public
*/
function startTest() { function startTest() {
$this->Dispatch =& new BakeShellMockShellDispatcher(); $this->Dispatch =& new BakeShellMockShellDispatcher();
$this->Shell =& new MockBakeShell(); $this->Shell =& new MockBakeShell();
@ -80,7 +82,8 @@ class BakeShellTestCase extends CakeTestCase {
* endTest method * endTest method
* *
* @return void * @return void
**/ * @access public
*/
function endTest() { function endTest() {
unset($this->Dispatch, $this->Shell); unset($this->Dispatch, $this->Shell);
} }
@ -89,7 +92,8 @@ class BakeShellTestCase extends CakeTestCase {
* test bake all * test bake all
* *
* @return void * @return void
**/ * @access public
*/
function testAllWithModelName() { function testAllWithModelName() {
$this->Shell->Model =& new BakeShellMockModelTask(); $this->Shell->Model =& new BakeShellMockModelTask();
$this->Shell->Controller =& new BakeShellMockControllerTask(); $this->Shell->Controller =& new BakeShellMockControllerTask();
@ -119,3 +123,4 @@ class BakeShellTestCase extends CakeTestCase {
$this->Shell->all(); $this->Shell->all();
} }
} }
?>

View file

@ -115,7 +115,14 @@ class SchemaShellTestSchema extends CakeSchema {
*/ */
class SchemaShellTest extends CakeTestCase { class SchemaShellTest extends CakeTestCase {
/**
* Fixtures
*
* @var array
* @access public
*/
var $fixtures = array('core.article', 'core.user', 'core.post', 'core.auth_user'); var $fixtures = array('core.article', 'core.user', 'core.post', 'core.auth_user');
/** /**
* startTest method * startTest method
* *
@ -142,7 +149,8 @@ class SchemaShellTest extends CakeTestCase {
* test startup method * test startup method
* *
* @return void * @return void
**/ * @access public
*/
function testStartup() { function testStartup() {
$this->Shell->startup(); $this->Shell->startup();
$this->assertTrue(isset($this->Shell->Schema)); $this->assertTrue(isset($this->Shell->Schema));
@ -177,7 +185,8 @@ class SchemaShellTest extends CakeTestCase {
* Test View - and that it dumps the schema file to stdout * Test View - and that it dumps the schema file to stdout
* *
* @return void * @return void
**/ * @access public
*/
function testView() { function testView() {
$this->Shell->startup(); $this->Shell->startup();
$this->Shell->Schema->path = APP . 'config' . DS . 'schema'; $this->Shell->Schema->path = APP . 'config' . DS . 'schema';
@ -191,7 +200,8 @@ class SchemaShellTest extends CakeTestCase {
* test that view() can find plugin schema files. * test that view() can find plugin schema files.
* *
* @return void * @return void
**/ * @access public
*/
function testViewWithPlugins() { function testViewWithPlugins() {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
@ -214,7 +224,8 @@ class SchemaShellTest extends CakeTestCase {
* test dump() with sql file generation * test dump() with sql file generation
* *
* @return void * @return void
**/ * @access public
*/
function testDumpWithFileWriting() { function testDumpWithFileWriting() {
$this->Shell->params = array( $this->Shell->params = array(
'name' => 'i18n', 'name' => 'i18n',
@ -242,7 +253,8 @@ class SchemaShellTest extends CakeTestCase {
* test that dump() can find and work with plugin schema files. * test that dump() can find and work with plugin schema files.
* *
* @return void * @return void
**/ * @access public
*/
function testDumpFileWritingWithPlugins() { function testDumpFileWritingWithPlugins() {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
@ -271,6 +283,7 @@ class SchemaShellTest extends CakeTestCase {
* test generate with snapshot generation * test generate with snapshot generation
* *
* @return void * @return void
* @access public
*/ */
function testGenerateSnaphot() { function testGenerateSnaphot() {
$this->Shell->path = TMP; $this->Shell->path = TMP;
@ -290,7 +303,8 @@ class SchemaShellTest extends CakeTestCase {
* test generate without a snapshot. * test generate without a snapshot.
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateNoOverwrite() { function testGenerateNoOverwrite() {
touch(TMP . 'schema.php'); touch(TMP . 'schema.php');
$this->Shell->params['file'] = 'schema.php'; $this->Shell->params['file'] = 'schema.php';
@ -309,7 +323,8 @@ class SchemaShellTest extends CakeTestCase {
* test generate with overwriting of the schema files. * test generate with overwriting of the schema files.
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateOverwrite() { function testGenerateOverwrite() {
touch(TMP . 'schema.php'); touch(TMP . 'schema.php');
$this->Shell->params['file'] = 'schema.php'; $this->Shell->params['file'] = 'schema.php';
@ -334,7 +349,8 @@ class SchemaShellTest extends CakeTestCase {
* in a plugin. * in a plugin.
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateWithPlugins() { function testGenerateWithPlugins() {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
@ -363,7 +379,8 @@ class SchemaShellTest extends CakeTestCase {
* Test schema run create with no table args. * Test schema run create with no table args.
* *
* @return void * @return void
**/ * @access public
*/
function testCreateNoArgs() { function testCreateNoArgs() {
$this->Shell->params = array( $this->Shell->params = array(
'connection' => 'test_suite', 'connection' => 'test_suite',
@ -386,7 +403,8 @@ class SchemaShellTest extends CakeTestCase {
* Test schema run create with no table args. * Test schema run create with no table args.
* *
* @return void * @return void
**/ * @access public
*/
function testCreateWithTableArgs() { function testCreateWithTableArgs() {
$this->Shell->params = array( $this->Shell->params = array(
'connection' => 'test_suite', 'connection' => 'test_suite',
@ -411,7 +429,8 @@ class SchemaShellTest extends CakeTestCase {
* test run update with a table arg. * test run update with a table arg.
* *
* @return void * @return void
**/ * @access public
*/
function testUpdateWithTable() { function testUpdateWithTable() {
$this->Shell->params = array( $this->Shell->params = array(
'connection' => 'test_suite', 'connection' => 'test_suite',
@ -434,7 +453,8 @@ class SchemaShellTest extends CakeTestCase {
* test that the plugin param creates the correct path in the schema object. * test that the plugin param creates the correct path in the schema object.
* *
* @return void * @return void
**/ * @access public
*/
function testPluginParam() { function testPluginParam() {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
@ -454,7 +474,8 @@ class SchemaShellTest extends CakeTestCase {
* test that using Plugin.name with write. * test that using Plugin.name with write.
* *
* @return void * @return void
**/ * @access public
*/
function testPluginDotSyntaxWithCreate() { function testPluginDotSyntaxWithCreate() {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)

View file

@ -46,7 +46,7 @@ Mock::generatePartial('ShellDispatcher', 'TestShellMockShellDispatcher', array(
*/ */
class TestShell extends Shell { class TestShell extends Shell {
/* /**
* name property * name property
* *
* @var name * @var name
@ -257,8 +257,8 @@ class ShellTest extends CakeTestCase {
/** /**
* testNl * testNl
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testNl() { function testNl() {
$this->assertEqual($this->Shell->nl(), "\n"); $this->assertEqual($this->Shell->nl(), "\n");
@ -271,8 +271,8 @@ class ShellTest extends CakeTestCase {
/** /**
* testHr * testHr
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testHr() { function testHr() {
$bar = '---------------------------------------------------------------'; $bar = '---------------------------------------------------------------';
@ -296,8 +296,8 @@ class ShellTest extends CakeTestCase {
/** /**
* testError * testError
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testError() { function testError() {
$this->Shell->Dispatch->expectAt(0, 'stderr', array("Error: Foo Not Found\n")); $this->Shell->Dispatch->expectAt(0, 'stderr', array("Error: Foo Not Found\n"));

View file

@ -88,7 +88,8 @@ class ControllerTaskTest extends CakeTestCase {
* fixtures * fixtures
* *
* @var array * @var array
**/ * @access public
*/
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/** /**
@ -124,7 +125,8 @@ class ControllerTaskTest extends CakeTestCase {
* test ListAll * test ListAll
* *
* @return void * @return void
**/ * @access public
*/
function testListAll() { function testListAll() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->interactive = true; $this->Task->interactive = true;
@ -153,7 +155,8 @@ class ControllerTaskTest extends CakeTestCase {
* Test that getName interacts with the user and returns the controller name. * Test that getName interacts with the user and returns the controller name.
* *
* @return void * @return void
**/ * @access public
*/
function testGetName() { function testGetName() {
$this->Task->setReturnValue('in', 1); $this->Task->setReturnValue('in', 1);
@ -180,7 +183,8 @@ class ControllerTaskTest extends CakeTestCase {
* test helper interactions * test helper interactions
* *
* @return void * @return void
**/ * @access public
*/
function testDoHelpers() { function testDoHelpers() {
$this->Task->setReturnValue('in', 'n'); $this->Task->setReturnValue('in', 'n');
$result = $this->Task->doHelpers(); $result = $this->Task->doHelpers();
@ -203,7 +207,8 @@ class ControllerTaskTest extends CakeTestCase {
* test component interactions * test component interactions
* *
* @return void * @return void
**/ * @access public
*/
function testDoComponents() { function testDoComponents() {
$this->Task->setReturnValue('in', 'n'); $this->Task->setReturnValue('in', 'n');
$result = $this->Task->doComponents(); $result = $this->Task->doComponents();
@ -226,7 +231,8 @@ class ControllerTaskTest extends CakeTestCase {
* test Confirming controller user interaction * test Confirming controller user interaction
* *
* @return void * @return void
**/ * @access public
*/
function testConfirmController() { function testConfirmController() {
$controller = 'Posts'; $controller = 'Posts';
$scaffold = false; $scaffold = false;
@ -244,7 +250,8 @@ class ControllerTaskTest extends CakeTestCase {
* test the bake method * test the bake method
* *
* @return void * @return void
**/ * @access public
*/
function testBake() { function testBake() {
$helpers = array('Ajax', 'Time'); $helpers = array('Ajax', 'Time');
$components = array('Acl', 'Auth'); $components = array('Acl', 'Auth');
@ -267,7 +274,8 @@ class ControllerTaskTest extends CakeTestCase {
* test bake() with a -plugin param * test bake() with a -plugin param
* *
* @return void * @return void
**/ * @access public
*/
function testBakeWithPlugin() { function testBakeWithPlugin() {
$this->Task->plugin = 'ControllerTest'; $this->Task->plugin = 'ControllerTest';
$helpers = array('Ajax', 'Time'); $helpers = array('Ajax', 'Time');
@ -289,7 +297,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that bakeActions is creating the correct controller Code. (Using sessions) * test that bakeActions is creating the correct controller Code. (Using sessions)
* *
* @return void * @return void
**/ * @access public
*/
function testBakeActionsUsingSessions() { function testBakeActionsUsingSessions() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s'); 'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
@ -332,7 +341,8 @@ class ControllerTaskTest extends CakeTestCase {
* Test baking with Controller::flash() or no sessions. * Test baking with Controller::flash() or no sessions.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeActionsWithNoSessions() { function testBakeActionsWithNoSessions() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s'); 'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
@ -367,7 +377,8 @@ class ControllerTaskTest extends CakeTestCase {
* test baking a test * test baking a test
* *
* @return void * @return void
**/ * @access public
*/
function testBakeTest() { function testBakeTest() {
$this->Task->plugin = 'ControllerTest'; $this->Task->plugin = 'ControllerTest';
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
@ -383,7 +394,8 @@ class ControllerTaskTest extends CakeTestCase {
* test Interactive mode. * test Interactive mode.
* *
* @return void * @return void
**/ * @access public
*/
function testInteractive() { function testInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path'; $this->Task->path = '/my/path';
@ -407,7 +419,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that execute runs all when the first arg == all * test that execute runs all when the first arg == all
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoAll() { function testExecuteIntoAll() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s'); 'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s');
@ -432,7 +445,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos` works. * test that `cake bake controller foos` works.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithController() { function testExecuteWithController() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
@ -455,7 +469,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foo scaffold` works. * test that `cake bake controller foo scaffold` works.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithPublicParam() { function testExecuteWithPublicParam() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
@ -478,7 +493,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos both` works. * test that `cake bake controller foos both` works.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithControllerAndBoth() { function testExecuteWithControllerAndBoth() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
@ -502,7 +518,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos admin` works. * test that `cake bake controller foos admin` works.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithControllerAndAdmin() { function testExecuteWithControllerAndAdmin() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');

View file

@ -104,7 +104,8 @@ class DbConfigTaskTest extends CakeTestCase {
* Test the getConfig method. * Test the getConfig method.
* *
* @return void * @return void
**/ * @access public
*/
function testGetConfig() { function testGetConfig() {
$this->Task->setReturnValueAt(0, 'in', 'otherOne'); $this->Task->setReturnValueAt(0, 'in', 'otherOne');
$result = $this->Task->getConfig(); $result = $this->Task->getConfig();
@ -115,7 +116,8 @@ class DbConfigTaskTest extends CakeTestCase {
* test that initialize sets the path up. * test that initialize sets the path up.
* *
* @return void * @return void
**/ * @access public
*/
function testInitialize() { function testInitialize() {
$this->assertTrue(empty($this->Task->path)); $this->assertTrue(empty($this->Task->path));
$this->Task->initialize(); $this->Task->initialize();
@ -128,7 +130,8 @@ class DbConfigTaskTest extends CakeTestCase {
* test execute and by extension __interactive * test execute and by extension __interactive
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoInteractive() { function testExecuteIntoInteractive() {
$this->Task->initialize(); $this->Task->initialize();

View file

@ -60,7 +60,8 @@ class FixtureTaskTest extends CakeTestCase {
* fixtures * fixtures
* *
* @var array * @var array
**/ * @access public
*/
var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test'); var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test');
/** /**
@ -94,7 +95,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that initialize sets the path * test that initialize sets the path
* *
* @return void * @return void
**/ * @access public
*/
function testConstruct() { function testConstruct() {
$this->Dispatch->params['working'] = DS . 'my' . DS . 'path'; $this->Dispatch->params['working'] = DS . 'my' . DS . 'path';
$Task =& new FixtureTask($this->Dispatch); $Task =& new FixtureTask($this->Dispatch);
@ -107,7 +109,8 @@ class FixtureTaskTest extends CakeTestCase {
* test import option array generation * test import option array generation
* *
* @return void * @return void
**/ * @access public
*/
function testImportOptions() { function testImportOptions() {
$this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(0, 'in', 'y');
$this->Task->setReturnValueAt(1, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'y');
@ -136,7 +139,8 @@ class FixtureTaskTest extends CakeTestCase {
* test generating a fixture with database conditions. * test generating a fixture with database conditions.
* *
* @return void * @return void
**/ * @access public
*/
function testImportRecordsFromDatabaseWithConditions() { function testImportRecordsFromDatabaseWithConditions() {
$this->Task->setReturnValueAt(0, 'in', 'WHERE 1=1 LIMIT 10'); $this->Task->setReturnValueAt(0, 'in', 'WHERE 1=1 LIMIT 10');
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
@ -155,7 +159,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that execute passes runs bake depending with named model. * test that execute passes runs bake depending with named model.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithNamedModel() { function testExecuteWithNamedModel() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -169,7 +174,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that execute runs all() when args[0] = all * test that execute runs all() when args[0] = all
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoAll() { function testExecuteIntoAll() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -189,7 +195,8 @@ class FixtureTaskTest extends CakeTestCase {
* test using all() with -count and -records * test using all() with -count and -records
* *
* @return void * @return void
**/ * @access public
*/
function testAllWithCountAndRecordsFlags() { function testAllWithCountAndRecordsFlags() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -210,7 +217,8 @@ class FixtureTaskTest extends CakeTestCase {
* test interactive mode of execute * test interactive mode of execute
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteInteractive() { function testExecuteInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -228,7 +236,8 @@ class FixtureTaskTest extends CakeTestCase {
* Test that bake works * Test that bake works
* *
* @return void * @return void
**/ * @access public
*/
function testBake() { function testBake() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -263,7 +272,8 @@ class FixtureTaskTest extends CakeTestCase {
* test record generation with float and binary types * test record generation with float and binary types
* *
* @return void * @return void
**/ * @access public
*/
function testRecordGenerationForBinaryAndFloat() { function testRecordGenerationForBinaryAndFloat() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -279,7 +289,8 @@ class FixtureTaskTest extends CakeTestCase {
* Test that file generation includes headers and correct path for plugins. * Test that file generation includes headers and correct path for plugins.
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateFixtureFile() { function testGenerateFixtureFile() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -296,7 +307,8 @@ class FixtureTaskTest extends CakeTestCase {
* test generating files into plugins. * test generating files into plugins.
* *
* @return void * @return void
**/ * @access public
*/
function testGeneratePluginFixtureFile() { function testGeneratePluginFixtureFile() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';

View file

@ -65,7 +65,8 @@ class ModelTaskTest extends CakeTestCase {
* fixtures * fixtures
* *
* @var array * @var array
**/ * @access public
*/
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag', 'core.category_thread'); var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag', 'core.category_thread');
/** /**
@ -99,7 +100,8 @@ class ModelTaskTest extends CakeTestCase {
* Test that listAll scans the database connection and lists all the tables in it.s * Test that listAll scans the database connection and lists all the tables in it.s
* *
* @return void * @return void
**/ * @access public
*/
function testListAll() { function testListAll() {
$this->Task->expectAt(1, 'out', array('1. Article')); $this->Task->expectAt(1, 'out', array('1. Article'));
$this->Task->expectAt(2, 'out', array('2. ArticlesTag')); $this->Task->expectAt(2, 'out', array('2. ArticlesTag'));
@ -126,7 +128,8 @@ class ModelTaskTest extends CakeTestCase {
* Test that getName interacts with the user and returns the model name. * Test that getName interacts with the user and returns the model name.
* *
* @return void * @return void
**/ * @access public
*/
function testGetName() { function testGetName() {
$this->Task->setReturnValue('in', 1); $this->Task->setReturnValue('in', 1);
@ -153,7 +156,8 @@ class ModelTaskTest extends CakeTestCase {
* Test table name interactions * Test table name interactions
* *
* @return void * @return void
**/ * @access public
*/
function testGetTableName() { function testGetTableName() {
$this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(0, 'in', 'y');
$result = $this->Task->getTable('Article', 'test_suite'); $result = $this->Task->getTable('Article', 'test_suite');
@ -171,7 +175,8 @@ class ModelTaskTest extends CakeTestCase {
* test that initializing the validations works. * test that initializing the validations works.
* *
* @return void * @return void
**/ * @access public
*/
function testInitValidations() { function testInitValidations() {
$result = $this->Task->initValidations(); $result = $this->Task->initValidations();
$this->assertTrue(in_array('notempty', $result)); $this->assertTrue(in_array('notempty', $result));
@ -182,7 +187,8 @@ class ModelTaskTest extends CakeTestCase {
* tests the guessing features of validation * tests the guessing features of validation
* *
* @return void * @return void
**/ * @access public
*/
function testFieldValidationGuessing() { function testFieldValidationGuessing() {
$this->Task->interactive = false; $this->Task->interactive = false;
$this->Task->initValidations(); $this->Task->initValidations();
@ -210,7 +216,8 @@ class ModelTaskTest extends CakeTestCase {
* test that interactive field validation works and returns multiple validators. * test that interactive field validation works and returns multiple validators.
* *
* @return void * @return void
**/ * @access public
*/
function testInteractiveFieldValidation() { function testInteractiveFieldValidation() {
$this->Task->initValidations(); $this->Task->initValidations();
$this->Task->interactive = true; $this->Task->interactive = true;
@ -228,7 +235,8 @@ class ModelTaskTest extends CakeTestCase {
* test the validation Generation routine * test the validation Generation routine
* *
* @return void * @return void
**/ * @access public
*/
function testNonInteractiveDoValidation() { function testNonInteractiveDoValidation() {
$Model =& new MockModelTaskModel(); $Model =& new MockModelTaskModel();
$Model->primaryKey = 'id'; $Model->primaryKey = 'id';
@ -289,7 +297,8 @@ class ModelTaskTest extends CakeTestCase {
* test that finding primary key works * test that finding primary key works
* *
* @return void * @return void
**/ * @access public
*/
function testFindPrimaryKey() { function testFindPrimaryKey() {
$fields = array( $fields = array(
'one' => array(), 'one' => array(),
@ -307,7 +316,8 @@ class ModelTaskTest extends CakeTestCase {
* test finding Display field * test finding Display field
* *
* @return void * @return void
**/ * @access public
*/
function testFindDisplayField() { function testFindDisplayField() {
$fields = array('id' => array(), 'tagname' => array(), 'body' => array(), $fields = array('id' => array(), 'tagname' => array(), 'body' => array(),
'created' => array(), 'modified' => array()); 'created' => array(), 'modified' => array());
@ -327,7 +337,8 @@ class ModelTaskTest extends CakeTestCase {
* test that belongsTo generation works. * test that belongsTo generation works.
* *
* @return void * @return void
**/ * @access public
*/
function testBelongsToGeneration() { function testBelongsToGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Comment')); $model = new Model(array('ds' => 'test_suite', 'name' => 'Comment'));
$result = $this->Task->findBelongsTo($model, array()); $result = $this->Task->findBelongsTo($model, array());
@ -347,7 +358,6 @@ class ModelTaskTest extends CakeTestCase {
); );
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread')); $model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));
$result = $this->Task->findBelongsTo($model, array()); $result = $this->Task->findBelongsTo($model, array());
$expected = array( $expected = array(
@ -366,7 +376,8 @@ class ModelTaskTest extends CakeTestCase {
* test that hasOne and/or hasMany relations are generated properly. * test that hasOne and/or hasMany relations are generated properly.
* *
* @return void * @return void
**/ * @access public
*/
function testHasManyHasOneGeneration() { function testHasManyHasOneGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article')); $model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
@ -390,7 +401,6 @@ class ModelTaskTest extends CakeTestCase {
); );
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread')); $model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread'));
$result = $this->Task->findHasOneAndMany($model, array()); $result = $this->Task->findHasOneAndMany($model, array());
$expected = array( $expected = array(
@ -413,10 +423,11 @@ class ModelTaskTest extends CakeTestCase {
} }
/** /**
* test that habtm generation works * Test that HABTM generation works
* *
* @return void * @return void
**/ * @access public
*/
function testHasAndBelongsToManyGeneration() { function testHasAndBelongsToManyGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article')); $model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
@ -440,7 +451,8 @@ class ModelTaskTest extends CakeTestCase {
* test non interactive doAssociations * test non interactive doAssociations
* *
* @return void * @return void
**/ * @access public
*/
function testDoAssociationsNonInteractive() { function testDoAssociationsNonInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->interactive = false; $this->Task->interactive = false;
@ -464,14 +476,14 @@ class ModelTaskTest extends CakeTestCase {
), ),
), ),
); );
} }
/** /**
* Ensure that the fixutre object is correctly called. * Ensure that the fixutre object is correctly called.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeFixture() { function testBakeFixture() {
$this->Task->Fixture->expectAt(0, 'bake', array('Article', 'articles')); $this->Task->Fixture->expectAt(0, 'bake', array('Article', 'articles'));
$this->Task->bakeFixture('Article', 'articles'); $this->Task->bakeFixture('Article', 'articles');
@ -484,7 +496,8 @@ class ModelTaskTest extends CakeTestCase {
* Ensure that the test object is correctly called. * Ensure that the test object is correctly called.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeTest() { function testBakeTest() {
$this->Task->Test->expectAt(0, 'bake', array('Model', 'Article')); $this->Task->Test->expectAt(0, 'bake', array('Model', 'Article'));
$this->Task->bakeTest('Article'); $this->Task->bakeTest('Article');
@ -498,7 +511,8 @@ class ModelTaskTest extends CakeTestCase {
* a question for the hasOne is also not asked. * a question for the hasOne is also not asked.
* *
* @return void * @return void
**/ * @access public
*/
function testConfirmAssociations() { function testConfirmAssociations() {
$associations = array( $associations = array(
'hasOne' => array( 'hasOne' => array(
@ -538,7 +552,8 @@ class ModelTaskTest extends CakeTestCase {
* test that inOptions generates questions and only accepts a valid answer * test that inOptions generates questions and only accepts a valid answer
* *
* @return void * @return void
**/ * @access public
*/
function testInOptions() { function testInOptions() {
$options = array('one', 'two', 'three'); $options = array('one', 'two', 'three');
$this->Task->expectAt(0, 'out', array('1. one')); $this->Task->expectAt(0, 'out', array('1. one'));
@ -558,7 +573,8 @@ class ModelTaskTest extends CakeTestCase {
* test baking validation * test baking validation
* *
* @return void * @return void
**/ * @access public
*/
function testBakeValidation() { function testBakeValidation() {
$validate = array( $validate = array(
'name' => array( 'name' => array(
@ -586,7 +602,8 @@ class ModelTaskTest extends CakeTestCase {
* test baking relations * test baking relations
* *
* @return void * @return void
**/ * @access public
*/
function testBakeRelations() { function testBakeRelations() {
$associations = array( $associations = array(
'belongsTo' => array( 'belongsTo' => array(
@ -640,7 +657,8 @@ class ModelTaskTest extends CakeTestCase {
* test bake() with a -plugin param * test bake() with a -plugin param
* *
* @return void * @return void
**/ * @access public
*/
function testBakeWithPlugin() { function testBakeWithPlugin() {
$this->Task->plugin = 'ControllerTest'; $this->Task->plugin = 'ControllerTest';
@ -660,7 +678,8 @@ class ModelTaskTest extends CakeTestCase {
* test that execute passes runs bake depending with named model. * test that execute passes runs bake depending with named model.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithNamedModel() { function testExecuteWithNamedModel() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -675,7 +694,8 @@ class ModelTaskTest extends CakeTestCase {
* test that execute runs all() when args[0] = all * test that execute runs all() when args[0] = all
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoAll() { function testExecuteIntoAll() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -707,7 +727,8 @@ class ModelTaskTest extends CakeTestCase {
* test the interactive side of bake. * test the interactive side of bake.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoInteractive() { function testExecuteIntoInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
@ -736,7 +757,8 @@ class ModelTaskTest extends CakeTestCase {
* test using bake interactively with a table that does not exist. * test using bake interactively with a table that does not exist.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithNonExistantTableName() { function testExecuteWithNonExistantTableName() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';

View file

@ -72,7 +72,8 @@ class PluginTaskTest extends CakeTestCase {
* startCase methods * startCase methods
* *
* @return void * @return void
**/ * @access public
*/
function startCase() { function startCase() {
$this->_paths = $paths = App::path('plugins'); $this->_paths = $paths = App::path('plugins');
$this->_testPath = array_push($paths, TMP . 'tests' . DS); $this->_testPath = array_push($paths, TMP . 'tests' . DS);
@ -83,7 +84,8 @@ class PluginTaskTest extends CakeTestCase {
* endCase * endCase
* *
* @return void * @return void
**/ * @access public
*/
function endCase() { function endCase() {
App::build(array('plugins' => $this->_paths)); App::build(array('plugins' => $this->_paths));
} }
@ -102,7 +104,8 @@ class PluginTaskTest extends CakeTestCase {
* test bake() * test bake()
* *
* @return void * @return void
**/ * @access public
*/
function testBakeFoldersAndFiles() { function testBakeFoldersAndFiles() {
$this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'y');
@ -196,7 +199,8 @@ class PluginTaskTest extends CakeTestCase {
* test execute with no args, flowing into interactive, * test execute with no args, flowing into interactive,
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithNoArgs() { function testExecuteWithNoArgs() {
$this->Task->setReturnValueAt(0, 'in', 'TestPlugin'); $this->Task->setReturnValueAt(0, 'in', 'TestPlugin');
$this->Task->setReturnValueAt(1, 'in', '3'); $this->Task->setReturnValueAt(1, 'in', '3');
@ -221,7 +225,8 @@ class PluginTaskTest extends CakeTestCase {
* Test Execute * Test Execute
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithOneArg() { function testExecuteWithOneArg() {
$this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'y');
@ -245,7 +250,8 @@ class PluginTaskTest extends CakeTestCase {
* test execute chaining into MVC parts * test execute chaining into MVC parts
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithTwoArgs() { function testExecuteWithTwoArgs() {
$this->Task->Model =& new PluginTestMockModelTask(); $this->Task->Model =& new PluginTestMockModelTask();
$this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(0, 'in', $this->_testPath);

View file

@ -84,7 +84,8 @@ class ProjectTaskTest extends CakeTestCase {
* creates a test project that is used for testing project task. * creates a test project that is used for testing project task.
* *
* @return void * @return void
**/ * @access protected
*/
function _setupTestProject() { function _setupTestProject() {
$skel = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel'; $skel = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel';
$this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(0, 'in', 'y');
@ -96,7 +97,8 @@ class ProjectTaskTest extends CakeTestCase {
* test bake() method and directory creation. * test bake() method and directory creation.
* *
* @return void * @return void
**/ * @access public
*/
function testBake() { function testBake() {
$this->_setupTestProject(); $this->_setupTestProject();
@ -117,7 +119,8 @@ class ProjectTaskTest extends CakeTestCase {
* test generation of Security.salt * test generation of Security.salt
* *
* @return void * @return void
**/ * @access public
*/
function testSecuritySaltGeneration() { function testSecuritySaltGeneration() {
$this->_setupTestProject(); $this->_setupTestProject();
@ -134,7 +137,8 @@ class ProjectTaskTest extends CakeTestCase {
* Test that index.php is generated correctly. * Test that index.php is generated correctly.
* *
* @return void * @return void
**/ * @access public
*/
function testIndexPhpGeneration() { function testIndexPhpGeneration() {
$this->_setupTestProject(); $this->_setupTestProject();
@ -154,7 +158,8 @@ class ProjectTaskTest extends CakeTestCase {
* test getPrefix method, and that it returns Routing.prefix or writes to config file. * test getPrefix method, and that it returns Routing.prefix or writes to config file.
* *
* @return void * @return void
**/ * @access public
*/
function testGetPrefix() { function testGetPrefix() {
Configure::write('Routing.prefixes', array('admin')); Configure::write('Routing.prefixes', array('admin'));
$result = $this->Task->getPrefix(); $result = $this->Task->getPrefix();
@ -176,7 +181,8 @@ class ProjectTaskTest extends CakeTestCase {
* test cakeAdmin() writing core.php * test cakeAdmin() writing core.php
* *
* @return void * @return void
**/ * @access public
*/
function testCakeAdmin() { function testCakeAdmin() {
$file =& new File(CONFIGS . 'core.php'); $file =& new File(CONFIGS . 'core.php');
$contents = $file->read();; $contents = $file->read();;
@ -196,7 +202,8 @@ class ProjectTaskTest extends CakeTestCase {
* test getting the prefix with more than one prefix setup * test getting the prefix with more than one prefix setup
* *
* @return void * @return void
**/ * @access public
*/
function testGetPrefixWithMultiplePrefixes() { function testGetPrefixWithMultiplePrefixes() {
Configure::write('Routing.prefixes', array('admin', 'ninja', 'shinobi')); Configure::write('Routing.prefixes', array('admin', 'ninja', 'shinobi'));
$this->_setupTestProject(); $this->_setupTestProject();
@ -211,7 +218,8 @@ class ProjectTaskTest extends CakeTestCase {
* Test execute method with one param to destination folder. * Test execute method with one param to destination folder.
* *
* @return void * @return void
**/ * @access public
*/
function testExecute() { function testExecute() {
$this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . DS . 'console' . DS. 'templates' . DS . 'skel'; $this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . DS . 'console' . DS. 'templates' . DS . 'skel';
$this->Task->params['working'] = TMP . 'tests' . DS; $this->Task->params['working'] = TMP . 'tests' . DS;

View file

@ -81,7 +81,8 @@ class TemplateTaskTest extends CakeTestCase {
* test that set sets variables * test that set sets variables
* *
* @return void * @return void
**/ * @access public
*/
function testSet() { function testSet() {
$this->Task->set('one', 'two'); $this->Task->set('one', 'two');
$this->assertTrue(isset($this->Task->templateVars['one'])); $this->assertTrue(isset($this->Task->templateVars['one']));
@ -98,7 +99,8 @@ class TemplateTaskTest extends CakeTestCase {
* test finding themes installed in * test finding themes installed in
* *
* @return void * @return void
**/ * @access public
*/
function testFindingInstalledThemesForBake() { function testFindingInstalledThemesForBake() {
$consoleLibs = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS; $consoleLibs = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS;
$this->Task->Dispatch->shellPaths = array($consoleLibs); $this->Task->Dispatch->shellPaths = array($consoleLibs);
@ -111,7 +113,8 @@ class TemplateTaskTest extends CakeTestCase {
* that the user is not bugged. If there are more, find and return the correct theme name * that the user is not bugged. If there are more, find and return the correct theme name
* *
* @return void * @return void
**/ * @access public
*/
function testGetThemePath() { function testGetThemePath() {
$defaultTheme = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . 'templates' . DS . 'default' .DS; $defaultTheme = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . 'templates' . DS . 'default' .DS;
$this->Task->templatePaths = array('default' => $defaultTheme); $this->Task->templatePaths = array('default' => $defaultTheme);
@ -136,7 +139,8 @@ class TemplateTaskTest extends CakeTestCase {
* test generate * test generate
* *
* @return void * @return void
**/ * @access public
*/
function testGenerate() { function testGenerate() {
App::build(array( App::build(array(
'shells' => array( 'shells' => array(
@ -155,7 +159,8 @@ class TemplateTaskTest extends CakeTestCase {
* ensure fallback to default works. * ensure fallback to default works.
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateWithTemplateFallbacks() { function testGenerateWithTemplateFallbacks() {
App::build(array( App::build(array(
'shells' => array( 'shells' => array(

View file

@ -49,17 +49,48 @@ Mock::generatePartial(
); );
/** /**
* Test subject models for fixture generation * Test Article model
**/ *
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskArticle extends Model { class TestTaskArticle extends Model {
/**
* Model name
*
* @var string
* @access public
*/
var $name = 'TestTaskArticle'; var $name = 'TestTaskArticle';
/**
* Table name to use
*
* @var string
* @access public
*/
var $useTable = 'articles'; var $useTable = 'articles';
/**
* HasMany Associations
*
* @var array
* @access public
*/
var $hasMany = array( var $hasMany = array(
'Comment' => array( 'Comment' => array(
'className' => 'TestTask.TestTaskComment', 'className' => 'TestTask.TestTaskComment',
'foreignKey' => 'article_id', 'foreignKey' => 'article_id',
) )
); );
/**
* Has and Belongs To Many Associations
*
* @var array
* @access public
*/
var $hasAndBelongsToMany = array( var $hasAndBelongsToMany = array(
'Tag' => array( 'Tag' => array(
'className' => 'TestTaskTag', 'className' => 'TestTaskTag',
@ -68,19 +99,65 @@ class TestTaskArticle extends Model {
'associationForeignKey' => 'tag_id' 'associationForeignKey' => 'tag_id'
) )
); );
/**
* Example public method
*
* @return void
* @access public
*/
function doSomething() { function doSomething() {
} }
/**
* Example Secondary public method
*
* @return void
* @access public
*/
function doSomethingElse() { function doSomethingElse() {
} }
function _innerMethod() {
/**
* Example protected method
*
* @return void
* @access protected
*/
function _innerMethod() {
} }
} }
/**
* Tag Testing Model
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskTag extends Model { class TestTaskTag extends Model {
/**
* Model name
*
* @var string
* @access public
*/
var $name = 'TestTaskTag'; var $name = 'TestTaskTag';
/**
* Table name
*
* @var string
* @access public
*/
var $useTable = 'tags'; var $useTable = 'tags';
/**
* Has and Belongs To Many Associations
*
* @var array
* @access public
*/
var $hasAndBelongsToMany = array( var $hasAndBelongsToMany = array(
'Article' => array( 'Article' => array(
'className' => 'TestTaskArticle', 'className' => 'TestTaskArticle',
@ -92,14 +169,44 @@ class TestTaskTag extends Model {
} }
/** /**
* Simulated Plugin * Simulated plugin
**/ *
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskAppModel extends Model { class TestTaskAppModel extends Model {
} }
/**
* Testing AppMode (TaskComment)
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskComment extends TestTaskAppModel { class TestTaskComment extends TestTaskAppModel {
/**
* Model name
*
* @var string
* @access public
*/
var $name = 'TestTaskComment'; var $name = 'TestTaskComment';
/**
* Table name
*
* @var string
* @access public
*/
var $useTable = 'comments'; var $useTable = 'comments';
/**
* Belongs To Associations
*
* @var array
* @access public
*/
var $belongsTo = array( var $belongsTo = array(
'Article' => array( 'Article' => array(
'className' => 'TestTaskArticle', 'className' => 'TestTaskArticle',
@ -108,8 +215,28 @@ class TestTaskComment extends TestTaskAppModel {
); );
} }
/**
* Test Task Comments Controller
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskCommentsController extends Controller { class TestTaskCommentsController extends Controller {
/**
* Controller Name
*
* @var string
* @access public
*/
var $name = 'TestTaskComments'; var $name = 'TestTaskComments';
/**
* Models to use
*
* @var array
* @access public
*/
var $uses = array('TestTaskComment', 'TestTaskTag'); var $uses = array('TestTaskComment', 'TestTaskTag');
} }
@ -121,6 +248,12 @@ class TestTaskCommentsController extends Controller {
*/ */
class TestTaskTest extends CakeTestCase { class TestTaskTest extends CakeTestCase {
/**
* Fixtures
*
* @var string
* @access public
*/
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/** /**
@ -150,8 +283,8 @@ class TestTaskTest extends CakeTestCase {
/** /**
* Test that file path generation doesn't continuously append paths. * Test that file path generation doesn't continuously append paths.
* *
* @access public
* @return void * @return void
* @access public
*/ */
function testFilePathGeneration() { function testFilePathGeneration() {
$file = TESTS . 'cases' . DS . 'models' . DS . 'my_class.test.php'; $file = TESTS . 'cases' . DS . 'models' . DS . 'my_class.test.php';
@ -176,7 +309,7 @@ class TestTaskTest extends CakeTestCase {
* methods into the test case. * methods into the test case.
* *
* @return void * @return void
**/ */
function testMethodIntrospection() { function testMethodIntrospection() {
$result = $this->Task->getTestableMethods('TestTaskArticle'); $result = $this->Task->getTestableMethods('TestTaskArticle');
$expected = array('dosomething', 'dosomethingelse'); $expected = array('dosomething', 'dosomethingelse');
@ -187,7 +320,8 @@ class TestTaskTest extends CakeTestCase {
* test that the generation of fixtures works correctly. * test that the generation of fixtures works correctly.
* *
* @return void * @return void
**/ * @access public
*/
function testFixtureArrayGenerationFromModel() { function testFixtureArrayGenerationFromModel() {
$subject = ClassRegistry::init('TestTaskArticle'); $subject = ClassRegistry::init('TestTaskArticle');
$result = $this->Task->generateFixtureList($subject); $result = $this->Task->generateFixtureList($subject);
@ -201,7 +335,8 @@ class TestTaskTest extends CakeTestCase {
* test that the generation of fixtures works correctly. * test that the generation of fixtures works correctly.
* *
* @return void * @return void
**/ * @access public
*/
function testFixtureArrayGenerationFromController() { function testFixtureArrayGenerationFromController() {
$subject = new TestTaskCommentsController(); $subject = new TestTaskCommentsController();
$result = $this->Task->generateFixtureList($subject); $result = $this->Task->generateFixtureList($subject);
@ -215,7 +350,8 @@ class TestTaskTest extends CakeTestCase {
* test user interaction to get object type * test user interaction to get object type
* *
* @return void * @return void
**/ * @access public
*/
function testGetObjectType() { function testGetObjectType() {
$this->Task->expectOnce('_stop'); $this->Task->expectOnce('_stop');
$this->Task->setReturnValueAt(0, 'in', 'q'); $this->Task->setReturnValueAt(0, 'in', 'q');
@ -230,7 +366,8 @@ class TestTaskTest extends CakeTestCase {
* creating test subjects should clear the registry so the registry is always fresh * creating test subjects should clear the registry so the registry is always fresh
* *
* @return void * @return void
**/ * @access public
*/
function testRegistryClearWhenBuildingTestObjects() { function testRegistryClearWhenBuildingTestObjects() {
ClassRegistry::flush(); ClassRegistry::flush();
$model = ClassRegistry::init('TestTaskComment'); $model = ClassRegistry::init('TestTaskComment');
@ -254,7 +391,8 @@ class TestTaskTest extends CakeTestCase {
* test that getClassName returns the user choice as a classname. * test that getClassName returns the user choice as a classname.
* *
* @return void * @return void
**/ * @access public
*/
function testGetClassName() { function testGetClassName() {
$objects = App::objects('model'); $objects = App::objects('model');
$skip = $this->skipIf(empty($objects), 'No models in app, this test will fail. %s'); $skip = $this->skipIf(empty($objects), 'No models in app, this test will fail. %s');
@ -275,7 +413,8 @@ class TestTaskTest extends CakeTestCase {
* Test the user interaction for defining additional fixtures. * Test the user interaction for defining additional fixtures.
* *
* @return void * @return void
**/ * @access public
*/
function testGetUserFixtures() { function testGetUserFixtures() {
$this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(0, 'in', 'y');
$this->Task->setReturnValueAt(1, 'in', 'app.pizza, app.topping, app.side_dish'); $this->Task->setReturnValueAt(1, 'in', 'app.pizza, app.topping, app.side_dish');
@ -288,7 +427,8 @@ class TestTaskTest extends CakeTestCase {
* test that resolving classnames works * test that resolving classnames works
* *
* @return void * @return void
**/ * @access public
*/
function testGetRealClassname() { function testGetRealClassname() {
$result = $this->Task->getRealClassname('Model', 'Post'); $result = $this->Task->getRealClassname('Model', 'Post');
$this->assertEqual($result, 'Post'); $this->assertEqual($result, 'Post');
@ -311,7 +451,8 @@ class TestTaskTest extends CakeTestCase {
* as PHP4 classnames are all lower case, breaking the plugin path inflection. * as PHP4 classnames are all lower case, breaking the plugin path inflection.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeModelTest() { function testBakeModelTest() {
$this->Task->setReturnValue('createFile', true); $this->Task->setReturnValue('createFile', true);
$this->Task->setReturnValue('isLoadableClass', true); $this->Task->setReturnValue('isLoadableClass', true);
@ -344,7 +485,8 @@ class TestTaskTest extends CakeTestCase {
* causing issues with inflection of path name from classname. * causing issues with inflection of path name from classname.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeControllerTest() { function testBakeControllerTest() {
$this->Task->setReturnValue('createFile', true); $this->Task->setReturnValue('createFile', true);
$this->Task->setReturnValue('isLoadableClass', true); $this->Task->setReturnValue('isLoadableClass', true);
@ -377,7 +519,8 @@ class TestTaskTest extends CakeTestCase {
* test Constructor generation ensure that constructClasses is called for controllers * test Constructor generation ensure that constructClasses is called for controllers
* *
* @return void * @return void
**/ * @access public
*/
function testGenerateContsructor() { function testGenerateContsructor() {
$result = $this->Task->generateConstructor('controller', 'PostsController'); $result = $this->Task->generateConstructor('controller', 'PostsController');
$expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n"; $expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n";
@ -396,7 +539,8 @@ class TestTaskTest extends CakeTestCase {
* Test that mock class generation works for the appropriate classes * Test that mock class generation works for the appropriate classes
* *
* @return void * @return void
**/ * @access public
*/
function testMockClassGeneration() { function testMockClassGeneration() {
$result = $this->Task->hasMockClass('controller'); $result = $this->Task->hasMockClass('controller');
$this->assertTrue($result); $this->assertTrue($result);
@ -406,7 +550,8 @@ class TestTaskTest extends CakeTestCase {
* test bake() with a -plugin param * test bake() with a -plugin param
* *
* @return void * @return void
**/ * @access public
*/
function testBakeWithPlugin() { function testBakeWithPlugin() {
$this->Task->plugin = 'TestTest'; $this->Task->plugin = 'TestTest';
@ -419,7 +564,8 @@ class TestTaskTest extends CakeTestCase {
* Test filename generation for each type + plugins * Test filename generation for each type + plugins
* *
* @return void * @return void
**/ * @access public
*/
function testTestCaseFileName() { function testTestCaseFileName() {
$this->Task->path = '/my/path/tests/'; $this->Task->path = '/my/path/tests/';
@ -453,7 +599,8 @@ class TestTaskTest extends CakeTestCase {
* test execute with a type defined * test execute with a type defined
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithOneArg() { function testExecuteWithOneArg() {
$this->Task->args[0] = 'Model'; $this->Task->args[0] = 'Model';
$this->Task->setReturnValueAt(0, 'in', 'TestTaskTag'); $this->Task->setReturnValueAt(0, 'in', 'TestTaskTag');
@ -466,7 +613,8 @@ class TestTaskTest extends CakeTestCase {
* test execute with type and class name defined * test execute with type and class name defined
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithTwoArgs() { function testExecuteWithTwoArgs() {
$this->Task->args = array('Model', 'TestTaskTag'); $this->Task->args = array('Model', 'TestTaskTag');
$this->Task->setReturnValueAt(0, 'in', 'TestTaskTag'); $this->Task->setReturnValueAt(0, 'in', 'TestTaskTag');

View file

@ -49,10 +49,36 @@ Mock::generatePartial(
Mock::generate('ControllerTask', 'ViewTaskMockControllerTask'); Mock::generate('ControllerTask', 'ViewTaskMockControllerTask');
Mock::generate('ProjectTask', 'ViewTaskMockProjectTask'); Mock::generate('ProjectTask', 'ViewTaskMockProjectTask');
/**
* Test View Task Comment Model
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class ViewTaskComment extends Model { class ViewTaskComment extends Model {
/**
* Model name
*
* @var string
* @access public
*/
var $name = 'ViewTaskComment'; var $name = 'ViewTaskComment';
/**
* Table name
*
* @var string
* @access public
*/
var $useTable = 'comments'; var $useTable = 'comments';
/**
* Belongs To Associations
*
* @var array
* @access public
*/
var $belongsTo = array( var $belongsTo = array(
'Article' => array( 'Article' => array(
'className' => 'ViewTaskArticle', 'className' => 'ViewTaskArticle',
@ -61,46 +87,143 @@ class ViewTaskComment extends Model {
); );
} }
/**
* Test View Task Article Model
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class ViewTaskArticle extends Model { class ViewTaskArticle extends Model {
/**
* Model name
*
* @var string
* @access public
*/
var $name = 'ViewTaskArticle'; var $name = 'ViewTaskArticle';
/**
* Table name
*
* @var string
* @access public
*/
var $useTable = 'articles'; var $useTable = 'articles';
} }
/**
* Test View Task Comments Controller
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class ViewTaskCommentsController extends Controller { class ViewTaskCommentsController extends Controller {
/**
* Controller name
*
* @var string
* @access public
*/
var $name = 'ViewTaskComments'; var $name = 'ViewTaskComments';
/**
* Testing public controller action
*
* @return void
* @access public
*/
function index() { function index() {
} }
function add() {
/**
* Testing public controller action
*
* @return void
* @access public
*/
function add() {
} }
} }
/**
* Test View Task Articles Controller
*
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class ViewTaskArticlesController extends Controller { class ViewTaskArticlesController extends Controller {
/**
* Controller name
*
* @var string
* @access public
*/
var $name = 'ViewTaskArticles'; var $name = 'ViewTaskArticles';
/**
* Test public controller action
*
* @return void
* @access public
*/
function index() { function index() {
} }
/**
* Test public controller action
*
* @return void
* @access public
*/
function add() { function add() {
} }
/**
* Test admin prefixed controller action
*
* @return void
* @access public
*/
function admin_index() { function admin_index() {
} }
/**
* Test admin prefixed controller action
*
* @return void
* @access public
*/
function admin_add() { function admin_add() {
} }
/**
* Test admin prefixed controller action
*
* @return void
* @access public
*/
function admin_view() { function admin_view() {
} }
/**
* Test admin prefixed controller action
*
* @return void
* @access public
*/
function admin_edit() { function admin_edit() {
} }
function admin_delete() {
/**
* Test admin prefixed controller action
*
* @return void
* @access public
*/
function admin_delete() {
} }
} }
@ -112,6 +235,12 @@ class ViewTaskArticlesController extends Controller {
*/ */
class ViewTaskTest extends CakeTestCase { class ViewTaskTest extends CakeTestCase {
/**
* Fixtures
*
* @var array
* @access public
*/
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/** /**
@ -148,7 +277,8 @@ class ViewTaskTest extends CakeTestCase {
* Test getContent and parsing of Templates. * Test getContent and parsing of Templates.
* *
* @return void * @return void
**/ * @access public
*/
function testGetContent() { function testGetContent() {
$vars = array( $vars = array(
'modelClass' => 'TestViewModel', 'modelClass' => 'TestViewModel',
@ -178,7 +308,8 @@ class ViewTaskTest extends CakeTestCase {
* test getContent() using an admin_prefixed action. * test getContent() using an admin_prefixed action.
* *
* @return void * @return void
**/ * @access public
*/
function testGetContentWithAdminAction() { function testGetContentWithAdminAction() {
$_back = Configure::read('Routing'); $_back = Configure::read('Routing');
Configure::write('Routing.prefixes', array('admin')); Configure::write('Routing.prefixes', array('admin'));
@ -212,7 +343,8 @@ class ViewTaskTest extends CakeTestCase {
* test Bake method * test Bake method
* *
* @return void * @return void
**/ * @access public
*/
function testBake() { function testBake() {
$this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments'; $this->Task->controllerPath = 'view_task_comments';
@ -237,7 +369,8 @@ class ViewTaskTest extends CakeTestCase {
* test bake() with a -plugin param * test bake() with a -plugin param
* *
* @return void * @return void
**/ * @access public
*/
function testBakeWithPlugin() { function testBakeWithPlugin() {
$this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments'; $this->Task->controllerPath = 'view_task_comments';
@ -252,7 +385,8 @@ class ViewTaskTest extends CakeTestCase {
* test bake actions baking multiple actions. * test bake actions baking multiple actions.
* *
* @return void * @return void
**/ * @access public
*/
function testBakeActions() { function testBakeActions() {
$this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments'; $this->Task->controllerPath = 'view_task_comments';
@ -277,7 +411,8 @@ class ViewTaskTest extends CakeTestCase {
* test baking a customAction (non crud) * test baking a customAction (non crud)
* *
* @return void * @return void
**/ * @access public
*/
function testCustomAction() { function testCustomAction() {
$this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerName = 'ViewTaskComments';
$this->Task->controllerPath = 'view_task_comments'; $this->Task->controllerPath = 'view_task_comments';
@ -295,7 +430,8 @@ class ViewTaskTest extends CakeTestCase {
* Test all() * Test all()
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteIntoAll() { function testExecuteIntoAll() {
$this->Task->args[0] = 'all'; $this->Task->args[0] = 'all';
@ -313,7 +449,8 @@ class ViewTaskTest extends CakeTestCase {
* test `cake bake view $controller view` * test `cake bake view $controller view`
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithActionParam() { function testExecuteWithActionParam() {
$this->Task->args[0] = 'ViewTaskComments'; $this->Task->args[0] = 'ViewTaskComments';
$this->Task->args[1] = 'view'; $this->Task->args[1] = 'view';
@ -328,7 +465,8 @@ class ViewTaskTest extends CakeTestCase {
* Ensure that views are only baked for actions that exist in the controller. * Ensure that views are only baked for actions that exist in the controller.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithController() { function testExecuteWithController() {
$this->Task->args[0] = 'ViewTaskComments'; $this->Task->args[0] = 'ViewTaskComments';
@ -344,7 +482,8 @@ class ViewTaskTest extends CakeTestCase {
* Which only bakes admin methods, not non-admin methods. * Which only bakes admin methods, not non-admin methods.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithControllerAndAdminFlag() { function testExecuteWithControllerAndAdminFlag() {
$_back = Configure::read('Routing'); $_back = Configure::read('Routing');
Configure::write('Routing.prefixes', array('admin')); Configure::write('Routing.prefixes', array('admin'));
@ -366,7 +505,8 @@ class ViewTaskTest extends CakeTestCase {
* test execute into interactive. * test execute into interactive.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteInteractive() { function testExecuteInteractive() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->args = array(); $this->Task->args = array();
@ -403,7 +543,8 @@ class ViewTaskTest extends CakeTestCase {
* test `cake bake view posts index list` * test `cake bake view posts index list`
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteWithAlternateTemplates() { function testExecuteWithAlternateTemplates() {
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';
$this->Task->args = array('ViewTaskComments', 'index', 'list'); $this->Task->args = array('ViewTaskComments', 'index', 'list');
@ -421,7 +562,8 @@ class ViewTaskTest extends CakeTestCase {
* test execute into interactive() with admin methods. * test execute into interactive() with admin methods.
* *
* @return void * @return void
**/ * @access public
*/
function testExecuteInteractiveWithAdmin() { function testExecuteInteractiveWithAdmin() {
Configure::write('Routing.prefixes', array('admin')); Configure::write('Routing.prefixes', array('admin'));
$this->Task->connection = 'test_suite'; $this->Task->connection = 'test_suite';