mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Removing newlines in files.
Adding and update bake.test to bake group test. Fixing doc blocks.
This commit is contained in:
parent
7b06ba2b3d
commit
ad3e5f43e0
22 changed files with 68 additions and 285 deletions
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* Command-line code generation utility to automate programmer chores.
|
* Command-line code generation utility to automate programmer chores.
|
||||||
*
|
*
|
||||||
|
@ -21,9 +20,6 @@
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs
|
* @subpackage cake.cake.console.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -137,6 +133,7 @@ class BakeShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
|
$this->Model->interactive = true;
|
||||||
$name = $this->Model->getName($this->connection);
|
$name = $this->Model->getName($this->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,10 +185,6 @@ class BakeShell extends Shell {
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Bake All could not continue without a valid model', true));
|
$this->err(__('Bake All could not continue without a valid model', true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->args)) {
|
|
||||||
$this->all();
|
|
||||||
}
|
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The ControllerTask handles creating and updating controller files.
|
* The ControllerTask handles creating and updating controller files.
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
* Copyright 2005-2009, Cake Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +55,6 @@ class ControllerTask extends Shell {
|
||||||
*/
|
*/
|
||||||
function initialize() {
|
function initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*
|
*
|
||||||
|
@ -102,7 +97,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake All the controllers at once. Will only bake controllers for models that exist.
|
* Bake All the controllers at once. Will only bake controllers for models that exist.
|
||||||
*
|
*
|
||||||
|
@ -125,7 +119,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactive
|
* Interactive
|
||||||
*
|
*
|
||||||
|
@ -209,7 +202,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirm a to be baked controller with the user
|
* Confirm a to be baked controller with the user
|
||||||
*
|
*
|
||||||
|
@ -247,7 +239,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user and ask about which methods (admin or regular they want to bake)
|
* Interact with the user and ask about which methods (admin or regular they want to bake)
|
||||||
*
|
*
|
||||||
|
@ -264,7 +255,6 @@ class ControllerTask extends Shell {
|
||||||
);
|
);
|
||||||
return array($wannaBakeCrud, $wannaBakeAdminCrud);
|
return array($wannaBakeCrud, $wannaBakeAdminCrud);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake scaffold actions
|
* Bake scaffold actions
|
||||||
*
|
*
|
||||||
|
@ -296,8 +286,6 @@ class ControllerTask extends Shell {
|
||||||
$actions = $this->Template->generate('actions', 'controller_actions');
|
$actions = $this->Template->generate('actions', 'controller_actions');
|
||||||
return $actions;
|
return $actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles and writes a Controller file
|
* Assembles and writes a Controller file
|
||||||
*
|
*
|
||||||
|
@ -326,7 +314,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles and writes a unit test file
|
* Assembles and writes a unit test file
|
||||||
*
|
*
|
||||||
|
@ -339,7 +326,6 @@ class ControllerTask extends Shell {
|
||||||
$this->Test->connection = $this->connection;
|
$this->Test->connection = $this->connection;
|
||||||
return $this->Test->bake('Controller', $className);
|
return $this->Test->bake('Controller', $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user and get a list of additional helpers
|
* Interact with the user and get a list of additional helpers
|
||||||
*
|
*
|
||||||
|
@ -363,7 +349,6 @@ class ControllerTask extends Shell {
|
||||||
__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true)
|
__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common code for property choice handling.
|
* Common code for property choice handling.
|
||||||
*
|
*
|
||||||
|
@ -381,7 +366,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
return array_filter($property);
|
return array_filter($property);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs and gets the list of possible controllers from database
|
* Outputs and gets the list of possible controllers from database
|
||||||
*
|
*
|
||||||
|
@ -408,7 +392,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
return $this->__tables;
|
return $this->__tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces the user to specify the controller he wants to bake, and returns the selected controller name.
|
* Forces the user to specify the controller he wants to bake, and returns the selected controller name.
|
||||||
*
|
*
|
||||||
|
@ -441,7 +424,6 @@ class ControllerTask extends Shell {
|
||||||
}
|
}
|
||||||
return $controllerName;
|
return $controllerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays help contents
|
* Displays help contents
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The DbConfig Task handles creating and updating the database.php
|
* The DbConfig Task handles creating and updating the database.php
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -341,7 +337,6 @@ class DbConfigTask extends Shell {
|
||||||
$filename = $this->path . 'database.php';
|
$filename = $this->path . 'database.php';
|
||||||
return $this->createFile($filename, $out);
|
return $this->createFile($filename, $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a user specified Connection name
|
* Get a user specified Connection name
|
||||||
*
|
*
|
||||||
|
@ -361,6 +356,5 @@ class DbConfigTask extends Shell {
|
||||||
}
|
}
|
||||||
return $useDbConfig;
|
return $useDbConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Short description for file.
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs
|
* @subpackage cake.cake.console.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The FixtureTest handles creating and updating fixture files.
|
* The FixtureTask handles creating and updating fixture files.
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
* Copyright 2005-2009, Cake Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
@ -17,9 +16,6 @@
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +86,6 @@ class FixtureTask extends Shell {
|
||||||
$this->bake($model);
|
$this->bake($model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake All the Fixtures at once. Will only bake fixtures for models that exist.
|
* Bake All the Fixtures at once. Will only bake fixtures for models that exist.
|
||||||
*
|
*
|
||||||
|
@ -105,7 +100,6 @@ class FixtureTask extends Shell {
|
||||||
$this->bake($model);
|
$this->bake($model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactive baking function
|
* Interactive baking function
|
||||||
*
|
*
|
||||||
|
@ -144,7 +138,6 @@ class FixtureTask extends Shell {
|
||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles and writes a Fixture file
|
* Assembles and writes a Fixture file
|
||||||
*
|
*
|
||||||
|
@ -199,7 +192,6 @@ class FixtureTask extends Shell {
|
||||||
$out = $this->generateFixtureFile($model, compact('records', 'table', 'schema', 'import', 'fields'));
|
$out = $this->generateFixtureFile($model, compact('records', 'table', 'schema', 'import', 'fields'));
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the fixture file, and write to disk
|
* Generate the fixture file, and write to disk
|
||||||
*
|
*
|
||||||
|
@ -226,7 +218,6 @@ class FixtureTask extends Shell {
|
||||||
$this->createFile($path . $filename, $content);
|
$this->createFile($path . $filename, $content);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a string representation of a schema.
|
* Generates a string representation of a schema.
|
||||||
*
|
*
|
||||||
|
@ -257,7 +248,6 @@ class FixtureTask extends Shell {
|
||||||
$out .= "\n\t)";
|
$out .= "\n\t)";
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate String representation of Records
|
* Generate String representation of Records
|
||||||
*
|
*
|
||||||
|
@ -322,7 +312,6 @@ class FixtureTask extends Shell {
|
||||||
$out .= "\t)";
|
$out .= "\t)";
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays help contents
|
* Displays help contents
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The ModelTask handles creating and updating models files.
|
* The ModelTask handles creating and updating models files.
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
App::import('Model', 'ConnectionManager');
|
App::import('Model', 'ConnectionManager');
|
||||||
|
@ -39,7 +35,6 @@ class ModelTask extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $plugin = null;
|
var $plugin = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the db connection used.
|
* Name of the db connection used.
|
||||||
*
|
*
|
||||||
|
@ -47,7 +42,6 @@ class ModelTask extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $connection = null;
|
var $connection = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path to MODELS directory
|
* path to MODELS directory
|
||||||
*
|
*
|
||||||
|
@ -55,7 +49,6 @@ class ModelTask extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $path = MODELS;
|
var $path = MODELS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tasks
|
* tasks
|
||||||
*
|
*
|
||||||
|
@ -63,21 +56,18 @@ class ModelTask extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $tasks = array('DbConfig', 'Fixture', 'Test', 'Template');
|
var $tasks = array('DbConfig', 'Fixture', 'Test', 'Template');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds tables found on connection.
|
* Holds tables found on connection.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $__tables = array();
|
var $__tables = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds validation method map.
|
* Holds validation method map.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $__validations = array();
|
var $__validations = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startup method
|
* startup method
|
||||||
*
|
*
|
||||||
|
@ -87,7 +77,6 @@ class ModelTask extends Shell {
|
||||||
App::import('Core', 'Model');
|
App::import('Core', 'Model');
|
||||||
parent::startup();
|
parent::startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*
|
*
|
||||||
|
@ -116,7 +105,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake all models at once.
|
* Bake all models at once.
|
||||||
*
|
*
|
||||||
|
@ -135,7 +123,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a model object for a class name.
|
* Get a model object for a class name.
|
||||||
*
|
*
|
||||||
|
@ -146,7 +133,6 @@ class ModelTask extends Shell {
|
||||||
$object = new Model(array('name' => $className, 'ds' => $this->connection));
|
$object = new Model(array('name' => $className, 'ds' => $this->connection));
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a key value list of options and a prompt.
|
* Generate a key value list of options and a prompt.
|
||||||
*
|
*
|
||||||
|
@ -172,7 +158,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $choice - 1;
|
return $choice - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles interactive baking
|
* Handles interactive baking
|
||||||
*
|
*
|
||||||
|
@ -265,7 +250,6 @@ class ModelTask extends Shell {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print out all the associations of a particular type
|
* Print out all the associations of a particular type
|
||||||
*
|
*
|
||||||
|
@ -283,7 +267,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a primary Key in a list of fields.
|
* Finds a primary Key in a list of fields.
|
||||||
*
|
*
|
||||||
|
@ -437,7 +420,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $validate;
|
return $validate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles associations
|
* Handles associations
|
||||||
*
|
*
|
||||||
|
@ -484,7 +466,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find belongsTo relations and add them to the associations list.
|
* Find belongsTo relations and add them to the associations list.
|
||||||
*
|
*
|
||||||
|
@ -513,7 +494,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the hasOne and HasMany relations and add them to associations list
|
* Find the hasOne and HasMany relations and add them to associations list
|
||||||
*
|
*
|
||||||
|
@ -556,7 +536,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the hasAndBelongsToMany relations and add them to associations list
|
* Find the hasAndBelongsToMany relations and add them to associations list
|
||||||
*
|
*
|
||||||
|
@ -596,7 +575,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user and confirm associations.
|
* Interact with the user and confirm associations.
|
||||||
*
|
*
|
||||||
|
@ -624,7 +602,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user and generate additional non-conventional associations
|
* Interact with the user and generate additional non-conventional associations
|
||||||
*
|
*
|
||||||
|
@ -691,7 +668,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all possible keys to use on custom associations.
|
* Finds all possible keys to use on custom associations.
|
||||||
*
|
*
|
||||||
|
@ -748,7 +724,6 @@ class ModelTask extends Shell {
|
||||||
$this->createFile($filename, $out);
|
$this->createFile($filename, $out);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles and writes a unit test file
|
* Assembles and writes a unit test file
|
||||||
*
|
*
|
||||||
|
@ -760,7 +735,6 @@ class ModelTask extends Shell {
|
||||||
$this->Test->connection = $this->connection;
|
$this->Test->connection = $this->connection;
|
||||||
return $this->Test->bake('Model', $className);
|
return $this->Test->bake('Model', $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* outputs the a list of possible models or controllers from database
|
* outputs the a list of possible models or controllers from database
|
||||||
*
|
*
|
||||||
|
@ -781,7 +755,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $this->__tables;
|
return $this->__tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user to determine the table name of a particular model
|
* Interact with the user to determine the table name of a particular model
|
||||||
*
|
*
|
||||||
|
@ -808,7 +781,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $useTable;
|
return $useTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an Array of all the tables in the supplied connection
|
* Get an Array of all the tables in the supplied connection
|
||||||
* will halt the script if no tables are found.
|
* will halt the script if no tables are found.
|
||||||
|
@ -838,7 +810,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces the user to specify the model he wants to bake, and returns the selected model name.
|
* Forces the user to specify the model he wants to bake, and returns the selected model name.
|
||||||
*
|
*
|
||||||
|
@ -870,7 +841,6 @@ class ModelTask extends Shell {
|
||||||
}
|
}
|
||||||
return $currentModelName;
|
return $currentModelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays help contents
|
* Displays help contents
|
||||||
*
|
*
|
||||||
|
@ -893,7 +863,6 @@ class ModelTask extends Shell {
|
||||||
$this->out("");
|
$this->out("");
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with FixtureTask to automatically bake fixtures when baking models.
|
* Interact with FixtureTask to automatically bake fixtures when baking models.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The Plugin Task handles creating an empty plugin, ready to be used
|
* The Plugin Task handles creating an empty plugin, ready to be used
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -37,7 +33,6 @@ class PluginTask extends Shell {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
var $tasks = array('Model', 'Controller', 'View');
|
var $tasks = array('Model', 'Controller', 'View');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path to CONTROLLERS directory
|
* path to CONTROLLERS directory
|
||||||
*
|
*
|
||||||
|
@ -45,7 +40,6 @@ class PluginTask extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $path = null;
|
var $path = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize
|
* initialize
|
||||||
*
|
*
|
||||||
|
@ -54,7 +48,6 @@ class PluginTask extends Shell {
|
||||||
function initialize() {
|
function initialize() {
|
||||||
$this->path = APP . 'plugins' . DS;
|
$this->path = APP . 'plugins' . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*
|
*
|
||||||
|
@ -99,7 +92,6 @@ class PluginTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactive interface
|
* Interactive interface
|
||||||
*
|
*
|
||||||
|
@ -115,7 +107,6 @@ class PluginTask extends Shell {
|
||||||
$this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . $pluginPath));
|
$this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . $pluginPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake the plugin, create directories and files
|
* Bake the plugin, create directories and files
|
||||||
*
|
*
|
||||||
|
@ -200,7 +191,6 @@ class PluginTask extends Shell {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find and change $this->path to the user selection
|
* find and change $this->path to the user selection
|
||||||
*
|
*
|
||||||
|
@ -221,7 +211,6 @@ class PluginTask extends Shell {
|
||||||
}
|
}
|
||||||
$this->path = $pathOptions[$choice - 1];
|
$this->path = $pathOptions[$choice - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Help
|
* Help
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task class for creating new project apps and plugins
|
* Task class for creating new project apps and plugins
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* Template Task can generate templated output Used in other Tasks
|
* Template Task can generate templated output Used in other Tasks
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
@ -14,7 +13,7 @@
|
||||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://cakephp.org
|
* @link http://cakephp.org
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.
|
* @subpackage cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
@ -25,7 +24,6 @@ class TemplateTask extends Shell {
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $templateVars = array();
|
var $templateVars = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paths to look for templates on.
|
* Paths to look for templates on.
|
||||||
* Contains a list of $theme => $path
|
* Contains a list of $theme => $path
|
||||||
|
@ -33,7 +31,6 @@ class TemplateTask extends Shell {
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $templatePaths = array();
|
var $templatePaths = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize callback. Setup paths for the template task.
|
* Initialize callback. Setup paths for the template task.
|
||||||
*
|
*
|
||||||
|
@ -43,7 +40,6 @@ class TemplateTask extends Shell {
|
||||||
function initialize() {
|
function initialize() {
|
||||||
$this->templatePaths = $this->_findThemes();
|
$this->templatePaths = $this->_findThemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the paths to all the installed shell themes in the app.
|
* Find the paths to all the installed shell themes in the app.
|
||||||
*
|
*
|
||||||
|
@ -68,7 +64,6 @@ class TemplateTask extends Shell {
|
||||||
}
|
}
|
||||||
return $themes;
|
return $themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set variable values to the template scope
|
* Set variable values to the template scope
|
||||||
*
|
*
|
||||||
|
@ -97,7 +92,6 @@ class TemplateTask extends Shell {
|
||||||
$this->templateVars[$name] = $value;
|
$this->templateVars[$name] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the template
|
* Runs the template
|
||||||
*
|
*
|
||||||
|
@ -126,7 +120,6 @@ class TemplateTask extends Shell {
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the theme name for the current operation.
|
* Find the theme name for the current operation.
|
||||||
* If there is only one theme in $templatePaths it will be used.
|
* If there is only one theme in $templatePaths it will be used.
|
||||||
|
@ -161,7 +154,6 @@ class TemplateTask extends Shell {
|
||||||
$this->Dispatch->params['theme'] = $themeNames[$index - 1];
|
$this->Dispatch->params['theme'] = $themeNames[$index - 1];
|
||||||
return $indexedPaths[$index];
|
return $indexedPaths[$index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a template inside a directory inside a path.
|
* Find a template inside a directory inside a path.
|
||||||
* Will scan all other theme dirs if the template is not found in the first directory.
|
* Will scan all other theme dirs if the template is not found in the first directory.
|
||||||
|
@ -187,5 +179,5 @@ class TemplateTask extends Shell {
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
?>
|
|
@ -1,27 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The TestTask handles creating and updating test files.
|
* The TestTask handles creating and updating test files.
|
||||||
*
|
*
|
||||||
* Long description for file
|
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.3
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -52,28 +46,24 @@ class TestTask extends Shell {
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $tasks = array('Template');
|
var $tasks = array('Template');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class types that methods can be generated for
|
* class types that methods can be generated for
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper');
|
var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal list of fixtures that have been added so far.
|
* Internal list of fixtures that have been added so far.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
var $_fixtures = array();
|
var $_fixtures = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag for interactive mode
|
* Flag for interactive mode
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
**/
|
**/
|
||||||
var $interactive = false;
|
var $interactive = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
*
|
*
|
||||||
|
@ -95,7 +85,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles interactive baking
|
* Handles interactive baking
|
||||||
*
|
*
|
||||||
|
@ -121,7 +110,6 @@ class TestTask extends Shell {
|
||||||
$className = $this->getClassName($type);
|
$className = $this->getClassName($type);
|
||||||
return $this->bake($type, $className);
|
return $this->bake($type, $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completes final steps for generating data to create test case.
|
* Completes final steps for generating data to create test case.
|
||||||
*
|
*
|
||||||
|
@ -185,7 +173,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return $this->classTypes[$selection - 1];
|
return $this->classTypes[$selection - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user chosen Class name for the chosen type
|
* Get the user chosen Class name for the chosen type
|
||||||
*
|
*
|
||||||
|
@ -206,7 +193,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return $selection;
|
return $selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the chosen type can find its own fixtures.
|
* Checks whether the chosen type can find its own fixtures.
|
||||||
* Currently only model, and controller are supported
|
* Currently only model, and controller are supported
|
||||||
|
@ -217,7 +203,6 @@ class TestTask extends Shell {
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
return ($type == 'controller' || $type == 'model');
|
return ($type == 'controller' || $type == 'model');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a class with the given type is loaded or can be loaded.
|
* Check if a class with the given type is loaded or can be loaded.
|
||||||
*
|
*
|
||||||
|
@ -226,7 +211,6 @@ class TestTask extends Shell {
|
||||||
function isLoadableClass($type, $class) {
|
function isLoadableClass($type, $class) {
|
||||||
return App::import($type, $class);
|
return App::import($type, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an instance of the class to be tested.
|
* Construct an instance of the class to be tested.
|
||||||
* So that fixtures can be detected
|
* So that fixtures can be detected
|
||||||
|
@ -244,7 +228,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return $instance;
|
return $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the real class name from the cake short form.
|
* Gets the real class name from the cake short form.
|
||||||
*
|
*
|
||||||
|
@ -256,7 +239,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return $class . $type;
|
return $class . $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get methods declared in the class given.
|
* Get methods declared in the class given.
|
||||||
* No parent methods will be returned
|
* No parent methods will be returned
|
||||||
|
@ -276,7 +258,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the list of fixtures that will be required to run this test based on
|
* Generate the list of fixtures that will be required to run this test based on
|
||||||
* loaded models.
|
* loaded models.
|
||||||
|
@ -293,7 +274,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return array_values($this->_fixtures);
|
return array_values($this->_fixtures);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a model recursively and pull out all the
|
* Process a model recursively and pull out all the
|
||||||
* model names converting them to fixture names.
|
* model names converting them to fixture names.
|
||||||
|
@ -317,7 +297,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process all the models attached to a controller
|
* Process all the models attached to a controller
|
||||||
* and generate a fixture list.
|
* and generate a fixture list.
|
||||||
|
@ -335,7 +314,6 @@ class TestTask extends Shell {
|
||||||
$this->_processModel($subject->{$model});
|
$this->_processModel($subject->{$model});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add classname to the fixture list.
|
* Add classname to the fixture list.
|
||||||
* Sets the app. or plugin.plugin_name. prefix.
|
* Sets the app. or plugin.plugin_name. prefix.
|
||||||
|
@ -353,7 +331,6 @@ class TestTask extends Shell {
|
||||||
$fixture = $prefix . Inflector::underscore($name);
|
$fixture = $prefix . Inflector::underscore($name);
|
||||||
$this->_fixtures[$name] = $fixture;
|
$this->_fixtures[$name] = $fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interact with the user to get additional fixtures they want to use.
|
* Interact with the user to get additional fixtures they want to use.
|
||||||
*
|
*
|
||||||
|
@ -370,7 +347,6 @@ class TestTask extends Shell {
|
||||||
$this->_fixtures = array_merge($this->_fixtures, $fixtures);
|
$this->_fixtures = array_merge($this->_fixtures, $fixtures);
|
||||||
return $fixtures;
|
return $fixtures;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a mock class required for this type of test?
|
* Is a mock class required for this type of test?
|
||||||
* Controllers require a mock class.
|
* Controllers require a mock class.
|
||||||
|
@ -381,7 +357,6 @@ class TestTask extends Shell {
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
return $type == 'controller';
|
return $type == 'controller';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a constructor code snippet for the type and classname
|
* Generate a constructor code snippet for the type and classname
|
||||||
*
|
*
|
||||||
|
@ -397,7 +372,6 @@ class TestTask extends Shell {
|
||||||
}
|
}
|
||||||
return "new $fullClassName()\n";
|
return "new $fullClassName()\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* make the filename for the test case. resolve the suffixes for controllers
|
* make the filename for the test case. resolve the suffixes for controllers
|
||||||
* and get the plugin path if needed.
|
* and get the plugin path if needed.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* The View Tasks handles creating and updating view files.
|
* The View Tasks handles creating and updating view files.
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.console.libs.tasks
|
* @subpackage cake.cake.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Controller');
|
App::import('Core', 'Controller');
|
||||||
|
|
|
@ -49,9 +49,9 @@ Mock::generate('DbConfigTask', 'BakeShellMockDbConfigTask');
|
||||||
Mock::generate('ModelTask', 'BakeShellMockModelTask');
|
Mock::generate('ModelTask', 'BakeShellMockModelTask');
|
||||||
Mock::generate('ControllerTask', 'BakeShellMockControllerTask');
|
Mock::generate('ControllerTask', 'BakeShellMockControllerTask');
|
||||||
|
|
||||||
if (!class_exists('ArticlesController')) {
|
if (!class_exists('UsersController')) {
|
||||||
class ArticlesController extends Controller {
|
class UsersController extends Controller {
|
||||||
var $name = 'Articles';
|
var $name = 'Users';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class BakeShellTestCase extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $fixtures = array('core.article');
|
var $fixtures = array('core.user');
|
||||||
/**
|
/**
|
||||||
* start test
|
* start test
|
||||||
*
|
*
|
||||||
|
@ -70,9 +70,17 @@ class BakeShellTestCase extends CakeTestCase {
|
||||||
function startTest() {
|
function startTest() {
|
||||||
$this->Dispatch =& new BakeShellMockShellDispatcher();
|
$this->Dispatch =& new BakeShellMockShellDispatcher();
|
||||||
$this->Shell =& new MockBakeShell();
|
$this->Shell =& new MockBakeShell();
|
||||||
$this->Shell->Dispatch =& $this->Dispatcher;
|
$this->Shell->Dispatch =& $this->Dispatch;
|
||||||
$this->Shell->Dispatch->shellPaths = App::path('shells');
|
$this->Shell->Dispatch->shellPaths = App::path('shells');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* endTest method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function endTest() {
|
||||||
|
unset($this->Dispatch, $this->Shell);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* test bake all
|
* test bake all
|
||||||
*
|
*
|
||||||
|
@ -97,13 +105,13 @@ class BakeShellTestCase extends CakeTestCase {
|
||||||
$this->Shell->View->expectOnce('execute');
|
$this->Shell->View->expectOnce('execute');
|
||||||
|
|
||||||
$this->Shell->expectAt(0, 'out', array('Bake All'));
|
$this->Shell->expectAt(0, 'out', array('Bake All'));
|
||||||
$this->Shell->expectAt(1, 'out', array('Article Model was baked.'));
|
$this->Shell->expectAt(1, 'out', array('User Model was baked.'));
|
||||||
$this->Shell->expectAt(2, 'out', array('Article Controller was baked.'));
|
$this->Shell->expectAt(2, 'out', array('User Controller was baked.'));
|
||||||
$this->Shell->expectAt(3, 'out', array('Article Views were baked.'));
|
$this->Shell->expectAt(3, 'out', array('User Views were baked.'));
|
||||||
$this->Shell->expectAt(4, 'out', array('Bake All complete'));
|
$this->Shell->expectAt(4, 'out', array('Bake All complete'));
|
||||||
|
|
||||||
$this->Shell->params = array();
|
$this->Shell->params = array();
|
||||||
$this->Shell->args = array('Article', 'exitvalue');
|
$this->Shell->args = array('User');
|
||||||
$this->Shell->all();
|
$this->Shell->all();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* ControllerTask Test Case
|
* ControllerTask Test Case
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
@ -88,9 +87,8 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -106,9 +104,8 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->Task->Project =& new ControllerMockProjectTask($this->Task->Dispatch);
|
$this->Task->Project =& new ControllerMockProjectTask($this->Task->Dispatch);
|
||||||
$this->Task->Test =& new ControllerMockTestTask();
|
$this->Task->Test =& new ControllerMockTestTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -117,7 +114,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test ListAll
|
* test ListAll
|
||||||
*
|
*
|
||||||
|
@ -146,7 +142,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$expected = array('articles', 'articles_tags', 'comments', 'tags');
|
$expected = array('articles', 'articles_tags', 'comments', 'tags');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that getName interacts with the user and returns the controller name.
|
* Test that getName interacts with the user and returns the controller name.
|
||||||
*
|
*
|
||||||
|
@ -173,7 +168,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getName('test_suite');
|
$result = $this->Task->getName('test_suite');
|
||||||
$this->Task->expectOnce('err');
|
$this->Task->expectOnce('err');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test helper interactions
|
* test helper interactions
|
||||||
*
|
*
|
||||||
|
@ -196,7 +190,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$expected = array('Javascript', 'Ajax', 'CustomOne');
|
$expected = array('Javascript', 'Ajax', 'CustomOne');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test component interactions
|
* test component interactions
|
||||||
*
|
*
|
||||||
|
@ -219,7 +212,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$expected = array('RequestHandler', 'Security');
|
$expected = array('RequestHandler', 'Security');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Confirming controller user interaction
|
* test Confirming controller user interaction
|
||||||
*
|
*
|
||||||
|
@ -237,7 +229,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(4, 'out', array("Components:\n\tAcl, Auth"));
|
$this->Task->expectAt(4, 'out', array("Components:\n\tAcl, Auth"));
|
||||||
$this->Task->confirmController($controller, $scaffold, $helpers, $components);
|
$this->Task->confirmController($controller, $scaffold, $helpers, $components);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the bake method
|
* test the bake method
|
||||||
*
|
*
|
||||||
|
@ -260,7 +251,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertNoPattern('/helpers/', $result);
|
$this->assertNoPattern('/helpers/', $result);
|
||||||
$this->assertNoPattern('/components/', $result);
|
$this->assertNoPattern('/components/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake() with a -plugin param
|
* test bake() with a -plugin param
|
||||||
*
|
*
|
||||||
|
@ -282,7 +272,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$path, new PatternExpectation('/ArticlesController extends ControllerTestAppController/')));
|
$path, new PatternExpectation('/ArticlesController extends ControllerTestAppController/')));
|
||||||
$this->Task->bake('Articles', '--actions--', array(), array(), array());
|
$this->Task->bake('Articles', '--actions--', array(), array(), array());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that bakeActions is creating the correct controller Code. (Using sessions)
|
* test that bakeActions is creating the correct controller Code. (Using sessions)
|
||||||
*
|
*
|
||||||
|
@ -325,7 +314,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(strpos($result, 'function admin_edit($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function admin_edit($id = null)') !== false);
|
||||||
$this->assertTrue(strpos($result, 'function admin_delete($id = null)') !== false);
|
$this->assertTrue(strpos($result, 'function admin_delete($id = null)') !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test baking with Controller::flash() or no sessions.
|
* Test baking with Controller::flash() or no sessions.
|
||||||
*
|
*
|
||||||
|
@ -360,7 +348,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(strpos($result, 'if ($this->Article->del($id))') !== false);
|
$this->assertTrue(strpos($result, 'if ($this->Article->del($id))') !== false);
|
||||||
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted', true), array('action' => 'index'))") !== false);
|
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted', true), array('action' => 'index'))") !== false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking a test
|
* test baking a test
|
||||||
*
|
*
|
||||||
|
@ -376,7 +363,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->Task->plugin, $this->Task->Test->plugin);
|
$this->assertEqual($this->Task->plugin, $this->Task->Test->plugin);
|
||||||
$this->assertEqual($this->Task->connection, $this->Task->Test->connection);
|
$this->assertEqual($this->Task->connection, $this->Task->Test->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Interactive mode.
|
* test Interactive mode.
|
||||||
*
|
*
|
||||||
|
@ -400,7 +386,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$filename = '/my/path/articles_controller.php';
|
$filename = '/my/path/articles_controller.php';
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticlesController/')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute runs all when the first arg == all
|
* test that execute runs all when the first arg == all
|
||||||
*
|
*
|
||||||
|
@ -425,7 +410,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that `cake bake controller foo scaffold` works.
|
* test that `cake bake controller foo scaffold` works.
|
||||||
*
|
*
|
||||||
|
@ -448,7 +432,6 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that `cake bake controller foo scaffold admin` works
|
* test that `cake bake controller foo scaffold admin` works
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* DBConfigTask Test Case
|
* DBConfigTask Test Case
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
@ -74,9 +73,8 @@ class TEST_DATABASE_CONFIG {
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
*/
|
*/
|
||||||
class DbConfigTaskTest extends CakeTestCase {
|
class DbConfigTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -90,9 +88,8 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
$this->Task->params['working'] = rtrim(APP, '/');
|
$this->Task->params['working'] = rtrim(APP, '/');
|
||||||
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
|
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -101,7 +98,6 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the getConfig method.
|
* Test the getConfig method.
|
||||||
*
|
*
|
||||||
|
@ -112,7 +108,6 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getConfig();
|
$result = $this->Task->getConfig();
|
||||||
$this->assertEqual($result, 'otherOne');
|
$this->assertEqual($result, 'otherOne');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that initialize sets the path up.
|
* test that initialize sets the path up.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
/**
|
/**
|
||||||
* FixtureTask Test case
|
* FixtureTask Test case
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
@ -15,7 +13,7 @@
|
||||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://cakephp.org
|
* @link http://cakephp.org
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
@ -63,7 +61,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
**/
|
**/
|
||||||
var $fixtures = array('core.article', 'core.comment');
|
var $fixtures = array('core.article', 'core.comment');
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -78,7 +76,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->Template->initialize();
|
$this->Task->Template->initialize();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -132,7 +130,6 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute runs all() when args[0] = all
|
* test that execute runs all() when args[0] = all
|
||||||
*
|
*
|
||||||
|
@ -152,7 +149,6 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
|
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test interactive mode of execute
|
* test interactive mode of execute
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* TestTaskTest file
|
* TestTaskTest file
|
||||||
*
|
*
|
||||||
|
@ -8,20 +7,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2006-2008, Cake Software Foundation, Inc.
|
* Copyright 2006-2009, Cake Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
|
* @copyright Copyright 2006-2009, Cake Software Foundation, Inc.
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.3
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Shell');
|
App::import('Core', 'Shell');
|
||||||
|
@ -72,9 +68,8 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
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');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* starTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -88,9 +83,8 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->Task->Fixture =& new MockModelTaskFixtureTask();
|
$this->Task->Fixture =& new MockModelTaskFixtureTask();
|
||||||
$this->Task->Test =& new MockModelTaskFixtureTask();
|
$this->Task->Test =& new MockModelTaskFixtureTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -99,7 +93,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
|
@ -126,7 +119,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$expected = array('articles', 'articles_tags', 'category_threads', 'comments', 'tags');
|
$expected = array('articles', 'articles_tags', 'category_threads', 'comments', 'tags');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that getName interacts with the user and returns the model name.
|
* Test that getName interacts with the user and returns the model name.
|
||||||
*
|
*
|
||||||
|
@ -153,7 +145,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getName('test_suite');
|
$result = $this->Task->getName('test_suite');
|
||||||
$this->Task->expectOnce('err');
|
$this->Task->expectOnce('err');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test table name interactions
|
* Test table name interactions
|
||||||
*
|
*
|
||||||
|
@ -180,7 +171,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->initValidations();
|
$result = $this->Task->initValidations();
|
||||||
$this->assertTrue(in_array('notempty', $result));
|
$this->assertTrue(in_array('notempty', $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that individual field validation works, with interactive = false
|
* test that individual field validation works, with interactive = false
|
||||||
* tests the guessing features of validation
|
* tests the guessing features of validation
|
||||||
|
@ -209,7 +199,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->fieldValidation('test', array('type' => 'boolean', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('test', array('type' => 'boolean', 'length' => 10, 'null' => false));
|
||||||
$expected = array('numeric' => 'numeric');
|
$expected = array('numeric' => 'numeric');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that interactive field validation works and returns multiple validators.
|
* test that interactive field validation works and returns multiple validators.
|
||||||
*
|
*
|
||||||
|
@ -227,7 +216,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$expected = array('notempty' => 'notempty', 'maxlength' => 'maxlength');
|
$expected = array('notempty' => 'notempty', 'maxlength' => 'maxlength');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the validation Generation routine
|
* test the validation Generation routine
|
||||||
*
|
*
|
||||||
|
@ -288,7 +276,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that finding primary key works
|
* test that finding primary key works
|
||||||
*
|
*
|
||||||
|
@ -306,7 +293,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$expected = 'my_field';
|
$expected = 'my_field';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test finding Display field
|
* test finding Display field
|
||||||
*
|
*
|
||||||
|
@ -326,7 +312,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->findDisplayField($fields);
|
$result = $this->Task->findDisplayField($fields);
|
||||||
$this->assertEqual($result, 'tagname');
|
$this->assertEqual($result, 'tagname');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that belongsTo generation works.
|
* test that belongsTo generation works.
|
||||||
*
|
*
|
||||||
|
@ -365,7 +350,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that hasOne and/or hasMany relations are generated properly.
|
* test that hasOne and/or hasMany relations are generated properly.
|
||||||
*
|
*
|
||||||
|
@ -415,7 +399,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that habtm generation works
|
* test that habtm generation works
|
||||||
*
|
*
|
||||||
|
@ -439,7 +422,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test non interactive doAssociations
|
* test non interactive doAssociations
|
||||||
*
|
*
|
||||||
|
@ -482,7 +464,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->Task->plugin, $this->Task->Fixture->plugin);
|
$this->assertEqual($this->Task->plugin, $this->Task->Fixture->plugin);
|
||||||
$this->assertEqual($this->Task->connection, $this->Task->Fixture->connection);
|
$this->assertEqual($this->Task->connection, $this->Task->Fixture->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that the test object is correctly called.
|
* Ensure that the test object is correctly called.
|
||||||
*
|
*
|
||||||
|
@ -495,7 +476,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->Task->plugin, $this->Task->Test->plugin);
|
$this->assertEqual($this->Task->plugin, $this->Task->Test->plugin);
|
||||||
$this->assertEqual($this->Task->connection, $this->Task->Test->connection);
|
$this->assertEqual($this->Task->connection, $this->Task->Test->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test confirming of associations, and that when an association is hasMany
|
* test confirming of associations, and that when an association is hasMany
|
||||||
* a question for the hasOne is also not asked.
|
* a question for the hasOne is also not asked.
|
||||||
|
@ -536,7 +516,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(empty($result['hasMany']));
|
$this->assertTrue(empty($result['hasMany']));
|
||||||
$this->assertTrue(empty($result['hasOne']));
|
$this->assertTrue(empty($result['hasOne']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that inOptions generates questions and only accepts a valid answer
|
* test that inOptions generates questions and only accepts a valid answer
|
||||||
*
|
*
|
||||||
|
@ -556,7 +535,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->inOptions($options, 'Pick a number');
|
$result = $this->Task->inOptions($options, 'Pick a number');
|
||||||
$this->assertEqual($result, 1);
|
$this->assertEqual($result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking validation
|
* test baking validation
|
||||||
*
|
*
|
||||||
|
@ -584,7 +562,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$pattern = '/' . preg_quote("'notempty' => array('rule' => array('notempty')),", '/') . '/';
|
$pattern = '/' . preg_quote("'notempty' => array('rule' => array('notempty')),", '/') . '/';
|
||||||
$this->assertPattern($pattern, $result);
|
$this->assertPattern($pattern, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking relations
|
* test baking relations
|
||||||
*
|
*
|
||||||
|
@ -638,7 +615,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern('/SomethingElse/', $result);
|
$this->assertPattern('/SomethingElse/', $result);
|
||||||
$this->assertPattern('/Comment/', $result);
|
$this->assertPattern('/Comment/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake() with a -plugin param
|
* test bake() with a -plugin param
|
||||||
*
|
*
|
||||||
|
@ -658,7 +634,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$path, new PatternExpectation('/Article extends ControllerTestAppModel/')));
|
$path, new PatternExpectation('/Article extends ControllerTestAppModel/')));
|
||||||
$this->Task->bake('Article', array(), array());
|
$this->Task->bake('Article', array(), array());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute passes runs bake depending with named model.
|
* test that execute passes runs bake depending with named model.
|
||||||
*
|
*
|
||||||
|
@ -673,7 +648,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article extends AppModel/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article extends AppModel/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute runs all() when args[0] = all
|
* test that execute runs all() when args[0] = all
|
||||||
*
|
*
|
||||||
|
@ -705,7 +679,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the interactive side of bake.
|
* test the interactive side of bake.
|
||||||
*
|
*
|
||||||
|
@ -734,7 +707,6 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test using bake interactively with a table that does not exist.
|
* test using bake interactively with a table that does not exist.
|
||||||
*
|
*
|
||||||
|
|
|
@ -56,9 +56,8 @@ Mock::generate('ModelTask', 'PluginTestMockModelTask');
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
*/
|
*/
|
||||||
class PluginTaskTest extends CakeTestCase {
|
class PluginTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -70,7 +69,6 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$this->Task->Dispatch =& $this->Dispatcher;
|
$this->Task->Dispatch =& $this->Dispatcher;
|
||||||
$this->Task->path = TMP . 'tests' . DS;
|
$this->Task->path = TMP . 'tests' . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startCase methods
|
* startCase methods
|
||||||
*
|
*
|
||||||
|
@ -81,7 +79,6 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$this->_testPath = array_push($paths, TMP . 'tests' . DS);
|
$this->_testPath = array_push($paths, TMP . 'tests' . DS);
|
||||||
App::build(array('plugins' => $paths));
|
App::build(array('plugins' => $paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* endCase
|
* endCase
|
||||||
*
|
*
|
||||||
|
@ -90,9 +87,8 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
function endCase() {
|
function endCase() {
|
||||||
App::build(array('plugins' => $this->_paths));
|
App::build(array('plugins' => $this->_paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -100,7 +96,6 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
function endTest() {
|
function endTest() {
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake()
|
* test bake()
|
||||||
*
|
*
|
||||||
|
@ -189,7 +184,6 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
||||||
$Folder->delete();
|
$Folder->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Execute
|
* Test Execute
|
||||||
*
|
*
|
||||||
|
@ -213,7 +207,6 @@ class PluginTaskTest extends CakeTestCase {
|
||||||
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
$Folder =& new Folder($this->Task->path . 'bake_test_plugin');
|
||||||
$Folder->delete();
|
$Folder->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute chaining into MVC parts
|
* test execute chaining into MVC parts
|
||||||
*
|
*
|
||||||
|
|
|
@ -53,9 +53,8 @@ Mock::generatePartial(
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
*/
|
*/
|
||||||
class ProjectTaskTest extends CakeTestCase {
|
class ProjectTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -67,9 +66,8 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->Task->Dispatch =& $this->Dispatcher;
|
$this->Task->Dispatch =& $this->Dispatcher;
|
||||||
$this->Task->path = TMP . 'tests' . DS;
|
$this->Task->path = TMP . 'tests' . DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -80,7 +78,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$Folder =& new Folder($this->Task->path . 'bake_test_app');
|
$Folder =& new Folder($this->Task->path . 'bake_test_app');
|
||||||
$Folder->delete();
|
$Folder->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a test project that is used for testing project task.
|
* creates a test project that is used for testing project task.
|
||||||
*
|
*
|
||||||
|
@ -92,7 +89,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->Task->setReturnValueAt(1, 'in', 'n');
|
$this->Task->setReturnValueAt(1, 'in', 'n');
|
||||||
$this->Task->bake($this->Task->path . 'bake_test_app', $skel);
|
$this->Task->bake($this->Task->path . 'bake_test_app', $skel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake() method and directory creation.
|
* test bake() method and directory creation.
|
||||||
*
|
*
|
||||||
|
@ -113,7 +109,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'groups'), 'No groups dir %s');
|
||||||
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
$this->assertTrue(is_dir($path . DS . 'tests' . DS . 'fixtures'), 'No fixtures dir %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test generation of Security.salt
|
* test generation of Security.salt
|
||||||
*
|
*
|
||||||
|
@ -130,7 +125,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$contents = $file->read();
|
$contents = $file->read();
|
||||||
$this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s');
|
$this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getAdmin method, and that it returns Routing.admin or writes to config file.
|
* test getAdmin method, and that it returns Routing.admin or writes to config file.
|
||||||
*
|
*
|
||||||
|
@ -149,7 +143,6 @@ class ProjectTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getAdmin();
|
$result = $this->Task->getAdmin();
|
||||||
$this->assertEqual($result, 'super_duper_admin_');
|
$this->assertEqual($result, 'super_duper_admin_');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test execute method with one param to destination folder.
|
* Test execute method with one param to destination folder.
|
||||||
*
|
*
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://cakephp.org
|
* @link http://cakephp.org
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
@ -53,7 +53,7 @@ Mock::generatePartial(
|
||||||
*/
|
*/
|
||||||
class TemplateTaskTest extends CakeTestCase {
|
class TemplateTaskTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -61,12 +61,11 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
function startTest() {
|
function startTest() {
|
||||||
$this->Dispatcher =& new TestTemplateTaskMockShellDispatcher();
|
$this->Dispatcher =& new TestTemplateTaskMockShellDispatcher();
|
||||||
$this->Task =& new MockTemplateTask($this->Dispatcher);
|
$this->Task =& new MockTemplateTask($this->Dispatcher);
|
||||||
$this->Task->Dispatch = new $this->Dispatcher;
|
$this->Task->Dispatch =& $this->Dispatcher;
|
||||||
$this->Task->Dispatch->shellPaths = App::path('shells');
|
$this->Task->Dispatch->shellPaths = App::path('shells');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -75,7 +74,6 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that set sets variables
|
* test that set sets variables
|
||||||
*
|
*
|
||||||
|
@ -92,7 +90,6 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
$this->assertTrue(isset($this->Task->templateVars['four']));
|
$this->assertTrue(isset($this->Task->templateVars['four']));
|
||||||
$this->assertEqual($this->Task->templateVars['four'], 'five');
|
$this->assertEqual($this->Task->templateVars['four'], 'five');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test finding themes installed in
|
* test finding themes installed in
|
||||||
*
|
*
|
||||||
|
@ -104,7 +101,6 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
$this->Task->initialize();
|
$this->Task->initialize();
|
||||||
$this->assertEqual($this->Task->templatePaths, array('default' => $consoleLibs . 'templates' . DS . 'default' . DS));
|
$this->assertEqual($this->Task->templatePaths, array('default' => $consoleLibs . 'templates' . DS . 'default' . DS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getting the correct theme name. Ensure that with only one theme, or a theme param
|
* test getting the correct theme name. Ensure that with only one theme, or a theme param
|
||||||
* 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
|
||||||
|
@ -128,9 +124,8 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
$this->Task->setReturnValueAt(0, 'in', '1');
|
$this->Task->setReturnValueAt(0, 'in', '1');
|
||||||
$result = $this->Task->getThemePath();
|
$result = $this->Task->getThemePath();
|
||||||
$this->assertEqual($result, $defaultTheme);
|
$this->assertEqual($result, $defaultTheme);
|
||||||
$this->assertEqual($this->Dispatch->params['theme'], 'default');
|
$this->assertEqual($this->Dispatcher->params['theme'], 'default');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test generate
|
* test generate
|
||||||
*
|
*
|
||||||
|
@ -145,7 +140,6 @@ class TemplateTaskTest extends CakeTestCase {
|
||||||
$expected = "I got rendered\nfoo";
|
$expected = "I got rendered\nfoo";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test generate with a missing template in the chosen theme.
|
* test generate with a missing template in the chosen theme.
|
||||||
* ensure fallback to default works.
|
* ensure fallback to default works.
|
||||||
|
|
|
@ -8,20 +8,17 @@
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP : Rapid Development Framework (http://www.cakephp.org)
|
||||||
* Copyright 2006-2008, Cake Software Foundation, Inc.
|
* Copyright 2006-2009, Cake Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @filesource
|
||||||
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
|
* @copyright Copyright 2006-2009, Cake Software Foundation, Inc.
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Shell');
|
App::import('Core', 'Shell');
|
||||||
|
@ -126,7 +123,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -138,9 +135,8 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->Dispatch =& $this->Dispatcher;
|
$this->Task->Dispatch =& $this->Dispatcher;
|
||||||
$this->Task->Template =& new TemplateTask($this->Dispatcher);
|
$this->Task->Template =& new TemplateTask($this->Dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -148,7 +144,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
function endTest() {
|
function endTest() {
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that file path generation doesn't continuously append paths.
|
* Test that file path generation doesn't continuously append paths.
|
||||||
*
|
*
|
||||||
|
@ -172,7 +167,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(2, 'createFile', array($file, '*'));
|
$this->Task->expectAt(2, 'createFile', array($file, '*'));
|
||||||
$this->Task->bake('Controller', 'Comments');
|
$this->Task->bake('Controller', 'Comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that method introspection pulls all relevant non parent class
|
* Test that method introspection pulls all relevant non parent class
|
||||||
* methods into the test case.
|
* methods into the test case.
|
||||||
|
@ -184,7 +178,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = array('doSomething', 'doSomethingElse');
|
$expected = array('doSomething', 'doSomethingElse');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the generation of fixtures works correctly.
|
* test that the generation of fixtures works correctly.
|
||||||
*
|
*
|
||||||
|
@ -198,7 +191,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEqual(sort($result), sort($expected));
|
$this->assertEqual(sort($result), sort($expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the generation of fixtures works correctly.
|
* test that the generation of fixtures works correctly.
|
||||||
*
|
*
|
||||||
|
@ -212,7 +204,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEqual(sort($result), sort($expected));
|
$this->assertEqual(sort($result), sort($expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test user interaction to get object type
|
* test user interaction to get object type
|
||||||
*
|
*
|
||||||
|
@ -227,7 +218,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getObjectType();
|
$result = $this->Task->getObjectType();
|
||||||
$this->assertEqual($result, $this->Task->classTypes[1]);
|
$this->assertEqual($result, $this->Task->classTypes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
|
@ -251,7 +241,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$keys = ClassRegistry::keys();
|
$keys = ClassRegistry::keys();
|
||||||
$this->assertFalse(in_array('random', $keys));
|
$this->assertFalse(in_array('random', $keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that getClassName returns the user choice as a classname.
|
* test that getClassName returns the user choice as a classname.
|
||||||
*
|
*
|
||||||
|
@ -272,7 +261,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$options = Configure::listObjects('model');
|
$options = Configure::listObjects('model');
|
||||||
$this->assertEqual($result, $options[0]);
|
$this->assertEqual($result, $options[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the user interaction for defining additional fixtures.
|
* Test the user interaction for defining additional fixtures.
|
||||||
*
|
*
|
||||||
|
@ -285,7 +273,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
|
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that resolving classnames works
|
* test that resolving classnames works
|
||||||
*
|
*
|
||||||
|
@ -307,7 +294,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getRealClassname('Component', 'Auth');
|
$result = $this->Task->getRealClassname('Component', 'Auth');
|
||||||
$this->assertEqual($result, 'AuthComponent');
|
$this->assertEqual($result, 'AuthComponent');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking files.
|
* test baking files.
|
||||||
*
|
*
|
||||||
|
@ -336,7 +322,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
||||||
$this->assertPattern("/'app\.articles_tag'/", $result);
|
$this->assertPattern("/'app\.articles_tag'/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking controller test files, ensure that the stub class is generated.
|
* test baking controller test files, ensure that the stub class is generated.
|
||||||
*
|
*
|
||||||
|
@ -366,7 +351,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
||||||
$this->assertPattern("/'app\.articles_tag'/", $result);
|
$this->assertPattern("/'app\.articles_tag'/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Constructor generation ensure that constructClasses is called for controllers
|
* test Constructor generation ensure that constructClasses is called for controllers
|
||||||
*
|
*
|
||||||
|
@ -385,7 +369,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = "new FormHelper()\n";
|
$expected = "new FormHelper()\n";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that mock class generation works for the appropriate classes
|
* Test that mock class generation works for the appropriate classes
|
||||||
*
|
*
|
||||||
|
@ -395,7 +378,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->hasMockClass('controller');
|
$result = $this->Task->hasMockClass('controller');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake() with a -plugin param
|
* test bake() with a -plugin param
|
||||||
*
|
*
|
||||||
|
@ -408,7 +390,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($path, '*'));
|
$this->Task->expectAt(0, 'createFile', array($path, '*'));
|
||||||
$this->Task->bake('Helper', 'Form');
|
$this->Task->bake('Helper', 'Form');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test filename generation for each type + plugins
|
* Test filename generation for each type + plugins
|
||||||
*
|
*
|
||||||
|
@ -442,7 +423,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
|
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute with a type defined
|
* test execute with a type defined
|
||||||
*
|
*
|
||||||
|
@ -455,7 +435,6 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/')));
|
$this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute with type and class name defined
|
* test execute with type and class name defined
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* ViewTask Test file
|
* ViewTask Test file
|
||||||
*
|
*
|
||||||
|
@ -19,9 +18,6 @@
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @version $Revision$
|
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Shell');
|
App::import('Core', 'Shell');
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.tests.groups
|
* @subpackage cake.tests.groups
|
||||||
* @since CakePHP(tm) v 1.3å
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +44,7 @@ class BakeGroupTest extends GroupTest {
|
||||||
*/
|
*/
|
||||||
function BakeGroupTest() {
|
function BakeGroupTest() {
|
||||||
$path = CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'tasks' . DS;
|
$path = CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'tasks' . DS;
|
||||||
|
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'bake');
|
||||||
TestManager::addTestFile($this, $path . 'controller');
|
TestManager::addTestFile($this, $path . 'controller');
|
||||||
TestManager::addTestFile($this, $path . 'model');
|
TestManager::addTestFile($this, $path . 'model');
|
||||||
TestManager::addTestFile($this, $path . 'view');
|
TestManager::addTestFile($this, $path . 'view');
|
||||||
|
|
Loading…
Reference in a new issue