Adding access tags and additional param/return docs.

This commit is contained in:
Mark Story 2009-12-29 22:50:43 -05:00
parent fdd8cf0138
commit a9a8c0b0e4
2 changed files with 48 additions and 9 deletions

View file

@ -54,6 +54,7 @@ class FixtureTask extends Shell {
* The db connection being used for baking * The db connection being used for baking
* *
* @var string * @var string
* @access public
*/ */
var $connection = null; var $connection = null;
@ -61,6 +62,7 @@ class FixtureTask extends Shell {
* Schema instance * Schema instance
* *
* @var object * @var object
* @access protected
*/ */
var $_Schema = null; var $_Schema = null;
@ -140,6 +142,7 @@ class FixtureTask extends Shell {
* *
* @param string $modelName Name of model you are dealing with. * @param string $modelName Name of model you are dealing with.
* @return array Array of import options. * @return array Array of import options.
* @access public
*/ */
function importOptions($modelName) { function importOptions($modelName) {
$options = array(); $options = array();
@ -167,8 +170,8 @@ class FixtureTask extends Shell {
* @param string $model Name of model to bake. * @param string $model Name of model to bake.
* @param string $useTable Name of table to use. * @param string $useTable Name of table to use.
* @param array $importOptions Options for var $import * @param array $importOptions Options for var $import
* @return string Baked fixture * @return string Baked fixture content
* @access private * @access public
*/ */
function bake($model, $useTable = false, $importOptions = array()) { function bake($model, $useTable = false, $importOptions = array()) {
if (!class_exists('CakeSchema')) { if (!class_exists('CakeSchema')) {
@ -228,8 +231,8 @@ class FixtureTask extends Shell {
* *
* @param string $model name of the model being generated * @param string $model name of the model being generated
* @param string $fixture Contents of the fixture file. * @param string $fixture Contents of the fixture file.
* @return string Content saved into fixture file.
* @access public * @access public
* @return void
*/ */
function generateFixtureFile($model, $otherVars) { function generateFixtureFile($model, $otherVars) {
$defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null); $defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null);
@ -255,6 +258,7 @@ class FixtureTask extends Shell {
* *
* @param array $table Table schema array * @param array $table Table schema array
* @return string fields definitions * @return string fields definitions
* @access protected
*/ */
function _generateSchema($tableInfo) { function _generateSchema($tableInfo) {
$schema = $this->_Schema->generateTable('f', $tableInfo); $schema = $this->_Schema->generateTable('f', $tableInfo);
@ -266,6 +270,7 @@ class FixtureTask extends Shell {
* *
* @param array $table Table schema array * @param array $table Table schema array
* @return array Array of records to use in the fixture. * @return array Array of records to use in the fixture.
* @access protected
*/ */
function _generateRecords($tableInfo, $recordCount = 1) { function _generateRecords($tableInfo, $recordCount = 1) {
$records = array(); $records = array();
@ -337,6 +342,7 @@ class FixtureTask extends Shell {
* *
* @param array $records Array of records to be converted to string * @param array $records Array of records to be converted to string
* @return string A string value of the $records array. * @return string A string value of the $records array.
* @access protected
*/ */
function _makeRecordString($records) { function _makeRecordString($records) {
$out = "array(\n"; $out = "array(\n";
@ -360,6 +366,7 @@ class FixtureTask extends Shell {
* @param string $modelName name of the model to take records from. * @param string $modelName name of the model to take records from.
* @param string $useTable Name of table to use. * @param string $useTable Name of table to use.
* @return array Array of records. * @return array Array of records.
* @access protected
*/ */
function _getRecordsFromTable($modelName, $useTable = null) { function _getRecordsFromTable($modelName, $useTable = null) {
if ($this->interactive) { if ($this->interactive) {

View file

@ -46,6 +46,7 @@ class TestTask extends Shell {
* Tasks used. * Tasks used.
* *
* @var array * @var array
* @access public
*/ */
var $tasks = array('Template'); var $tasks = array('Template');
@ -53,6 +54,7 @@ class TestTask extends Shell {
* class types that methods can be generated for * class types that methods can be generated for
* *
* @var array * @var array
* @access public
*/ */
var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper'); var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper');
@ -60,6 +62,7 @@ class TestTask extends Shell {
* Internal list of fixtures that have been added so far. * Internal list of fixtures that have been added so far.
* *
* @var string * @var string
* @access protected
*/ */
var $_fixtures = array(); var $_fixtures = array();
@ -164,6 +167,7 @@ class TestTask extends Shell {
* Interact with the user and get their chosen type. Can exit the script. * Interact with the user and get their chosen type. Can exit the script.
* *
* @return string Users chosen type. * @return string Users chosen type.
* @access public
*/ */
function getObjectType() { function getObjectType() {
$this->hr(); $this->hr();
@ -188,6 +192,7 @@ class TestTask extends Shell {
* *
* @param string $objectType Type of object to list classes for i.e. Model, Controller. * @param string $objectType Type of object to list classes for i.e. Model, Controller.
* @return string Class name the user chose. * @return string Class name the user chose.
* @access public
*/ */
function getClassName($objectType) { function getClassName($objectType) {
$options = App::objects(strtolower($objectType)); $options = App::objects(strtolower($objectType));
@ -208,7 +213,10 @@ class TestTask extends Shell {
* 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
* *
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return boolean * @return boolean
* @access public
*/ */
function typeCanDetectFixtures($type) { function typeCanDetectFixtures($type) {
$type = strtolower($type); $type = strtolower($type);
@ -218,7 +226,10 @@ class TestTask extends Shell {
/** /**
* 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.
* *
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return boolean * @return boolean
* @access public
*/ */
function isLoadableClass($type, $class) { function isLoadableClass($type, $class) {
return App::import($type, $class); return App::import($type, $class);
@ -228,7 +239,10 @@ class TestTask extends Shell {
* 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
* *
* @return object * @param string $type The Type of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
* @return object And instance of the class that is going to be tested.
* @access public
*/ */
function &buildTestSubject($type, $class) { function &buildTestSubject($type, $class) {
ClassRegistry::flush(); ClassRegistry::flush();
@ -245,7 +259,10 @@ class TestTask extends Shell {
/** /**
* Gets the real class name from the cake short form. * Gets the real class name from the cake short form.
* *
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
* @return string Real classname * @return string Real classname
* @access public
*/ */
function getRealClassName($type, $class) { function getRealClassName($type, $class) {
if (strtolower($type) == 'model') { if (strtolower($type) == 'model') {
@ -260,6 +277,7 @@ class TestTask extends Shell {
* *
* @param string $className Name of class to look at. * @param string $className Name of class to look at.
* @return array Array of method names. * @return array Array of method names.
* @access public
*/ */
function getTestableMethods($className) { function getTestableMethods($className) {
$classMethods = get_class_methods($className); $classMethods = get_class_methods($className);
@ -278,8 +296,9 @@ class TestTask extends Shell {
* 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.
* *
* @param object The object you want to generate fixtures for. * @param object $subject The object you want to generate fixtures for.
* @return array Array of fixtures to be included in the test. * @return array Array of fixtures to be included in the test.
* @access public
*/ */
function generateFixtureList(&$subject) { function generateFixtureList(&$subject) {
$this->_fixtures = array(); $this->_fixtures = array();
@ -295,6 +314,7 @@ class TestTask extends Shell {
* 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.
* *
* @param Model $subject A Model class to scan for associations and pull fixtures off of.
* @return void * @return void
* @access protected * @access protected
*/ */
@ -319,6 +339,7 @@ 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.
* *
* @param Controller $subject A controller to pull model names off of.
* @return void * @return void
* @access protected * @access protected
*/ */
@ -337,6 +358,7 @@ class TestTask extends Shell {
* 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.
* *
* @param string $name Name of the Model class that a fixture might be required for.
* @return void * @return void
* @access protected * @access protected
*/ */
@ -354,7 +376,8 @@ class TestTask extends Shell {
/** /**
* Interact with the user to get additional fixtures they want to use. * Interact with the user to get additional fixtures they want to use.
* *
* @return void * @return array Array of fixtures the user wants to add.
* @access public
*/ */
function getUserFixtures() { function getUserFixtures() {
$proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n'); $proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n');
@ -372,7 +395,9 @@ class TestTask extends Shell {
* 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.
* *
* @param string $type The type of object tests are being generated for eg. controller.
* @return boolean * @return boolean
* @access public
*/ */
function hasMockClass($type) { function hasMockClass($type) {
$type = strtolower($type); $type = strtolower($type);
@ -382,7 +407,10 @@ class TestTask extends Shell {
/** /**
* Generate a constructor code snippet for the type and classname * Generate a constructor code snippet for the type and classname
* *
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return string Constructor snippet for the thing you are building. * @return string Constructor snippet for the thing you are building.
* @access public
*/ */
function generateConstructor($type, $fullClassName) { function generateConstructor($type, $fullClassName) {
$type = strtolower($type); $type = strtolower($type);
@ -397,10 +425,13 @@ class TestTask extends Shell {
} }
/** /**
* 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.
* *
* @return string filename the test should be created on * @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return string filename the test should be created on.
* @access public
*/ */
function testCaseFileName($type, $className) { function testCaseFileName($type, $className) {
$path = $this->path; $path = $this->path;
@ -418,6 +449,7 @@ class TestTask extends Shell {
* Show help file. * Show help file.
* *
* @return void * @return void
* @access public
*/ */
function help() { function help() {
$this->hr(); $this->hr();