From a87d31cc7f570a1ac03abc2c04b04f71e4f6c955 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 2 Nov 2009 00:07:02 -0500 Subject: [PATCH 001/112] Fixing $cacheAction requiring the inclusion of the controller name for view cache files to be generated. This behavior makes the cache helper behave as documented. Test cases added. Fixes #232 --- cake/libs/view/helpers/cache.php | 16 +++- .../cases/libs/view/helpers/cache.test.php | 90 ++++++++++++++++--- 2 files changed, 92 insertions(+), 14 deletions(-) diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 8f43ecf9e..34a43ba1d 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -75,24 +75,32 @@ class CacheHelper extends AppHelper { $useCallbacks = false; if (is_array($this->cacheAction)) { $controller = Inflector::underscore($this->controllerName); + $controllerAlternate = Inflector::variable($this->controllerName); + $check = str_replace('/', '_', $this->here); - $replace = str_replace('/', '_', $this->base); + $basePath = str_replace('/', '_', $this->base); + $match = str_replace($this->base, '', $this->here); $match = str_replace('//', '/', $match); $match = str_replace('/' . $controller . '/', '', $match); + $match = str_replace('/' . $controllerAlternate . '/', '', $match); $match = str_replace('/' . $this->controllerName . '/', '', $match); - $check = str_replace($replace, '', $check); + + $check = str_replace($basePath, '', $check); $check = str_replace('_' . $controller . '_', '', $check); $check = str_replace('_' . $this->controllerName . '_', '', $check); + $check = str_replace('_' . $controllerAlternate . '_', '', $match); + $check = Inflector::slug($check); - $check = preg_replace('/^_+/', '', $check); + $check = trim($check, '_'); + $keys = str_replace('/', '_', array_keys($this->cacheAction)); $found = array_keys($this->cacheAction); $index = null; $count = 0; foreach ($keys as $key => $value) { - if (strpos($check, $value) === 0) { + if (strpos($check, rtrim($value, '_')) === 0) { $index = $found[$count]; break; } diff --git a/cake/tests/cases/libs/view/helpers/cache.test.php b/cake/tests/cases/libs/view/helpers/cache.test.php index fc450ecc9..66b913642 100644 --- a/cake/tests/cases/libs/view/helpers/cache.test.php +++ b/cake/tests/cases/libs/view/helpers/cache.test.php @@ -29,14 +29,7 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { } App::import('Core', array('Controller', 'Model', 'View')); App::import('Helper', 'Cache'); -/** - * TestCacheHelper class - * - * @package cake - * @subpackage cake.tests.cases.libs.view.helpers - */ -class TestCacheHelper extends CacheHelper { -} + /** * CacheTestController class * @@ -81,7 +74,8 @@ class CacheHelperTest extends CakeTestCase { */ function setUp() { $this->Controller = new CacheTestController(); - $this->Cache = new TestCacheHelper(); + $this->Cache = new CacheHelper(); + $this->_cacheSettings = Configure::read('Cache'); Configure::write('Cache.check', true); Configure::write('Cache.disable', false); } @@ -112,6 +106,7 @@ class CacheHelperTest extends CakeTestCase { */ function tearDown() { unset($this->Cache); + Configure::write('Cache', $this->_cacheSettings); } /** * test cache parsing with no cake:nocache tags in view file. @@ -201,7 +196,7 @@ class CacheHelperTest extends CakeTestCase { */ function testComplexNoCache () { $this->Controller->cache_parsing(); - $this->Controller->cacheAction = array('cacheTest' => 21600); + $this->Controller->cacheAction = array('cache_complex' => 21600); $this->Controller->here = '/cacheTest/cache_complex'; $this->Controller->action = 'cache_complex'; $this->Controller->layout = 'multi_cache'; @@ -247,6 +242,81 @@ class CacheHelperTest extends CakeTestCase { //$this->assertPattern('/6\. in element with no cache tags/', $contents); $this->assertPattern('/7\. layout after content and after element with no cache tags/', $contents); } +/** + * test cacheAction set to a boolean + * + * @return void + **/ + function testCacheActionArray() { + $this->Controller->cache_parsing(); + $this->Controller->cacheAction = array( + 'cache_parsing' => 21600 + ); + $this->Controller->here = '/cache_test/cache_parsing'; + $this->Controller->action = 'cache_parsing'; + + $View = new View($this->Controller); + $result = $View->render('index'); + + $this->assertNoPattern('/cake:nocache/', $result); + $this->assertNoPattern('/php echo/', $result); + + $filename = CACHE . 'views' . DS . 'cache_test_cache_parsing.php'; + $this->assertTrue(file_exists($filename)); + @unlink($filename); + + + $this->Controller->cache_parsing(); + $this->Controller->cacheAction = array( + 'cache_parsing/' => 21600 + ); + $this->Controller->here = '/cacheTest/cache_parsing'; + $this->Controller->action = 'cache_parsing'; + + $View = new View($this->Controller); + $result = $View->render('index'); + + $this->assertNoPattern('/cake:nocache/', $result); + $this->assertNoPattern('/php echo/', $result); + + $filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php'; + $this->assertTrue(file_exists($filename)); + @unlink($filename); + + + $this->Controller->cache_parsing(); + $this->Controller->cacheAction = array( + 'cache_parsing/33' => 21600 + ); + $this->Controller->here = '/cacheTest/cache_parsing/33'; + $this->Controller->action = 'cache_parsing'; + + $View = new View($this->Controller); + $result = $View->render('index'); + + $this->assertNoPattern('/cake:nocache/', $result); + $this->assertNoPattern('/php echo/', $result); + + $filename = CACHE . 'views' . DS . 'cachetest_cache_parsing_33.php'; + $this->assertTrue(file_exists($filename)); + @unlink($filename); + + $this->Controller->cache_parsing(); + $this->Controller->cacheAction = array( + 'cache_parsing/33' => 21600 + ); + $this->Controller->here = '/cacheTest/cache_parsing'; + $this->Controller->action = 'cache_parsing'; + + $View = new View($this->Controller); + $result = $View->render('index'); + + $this->assertNoPattern('/cake:nocache/', $result); + $this->assertNoPattern('/php echo/', $result); + + $filename = CACHE . 'views' . DS . 'cachetest_cache_parsing.php'; + $this->assertFalse(file_exists($filename)); + } /** * testCacheEmptySections method * From 9d2628f699dbae93c90b47579b78d8c7aba64dd8 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 2 Nov 2009 00:07:16 -0500 Subject: [PATCH 002/112] Removing tab --- cake/libs/view/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 1ed8c01cb..199359f9f 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -686,7 +686,7 @@ class View extends Object { $cache->helpers = $this->helpers; $cache->action = $this->action; $cache->controllerName = $this->name; - $cache->layout = $this->layout; + $cache->layout = $this->layout; $cache->cacheAction = $this->cacheAction; $cache->cache($___viewFn, $out, $cached); } From 6b043c6c57da5d2d3f0538170e8aa964b2789039 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 2 Nov 2009 21:37:20 -0500 Subject: [PATCH 003/112] Updating doc blocks for paginator helper. --- cake/libs/view/helpers/paginator.php | 146 +++++++++++++++++++-------- 1 file changed, 103 insertions(+), 43 deletions(-) diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 0e8505ecf..8362337ac 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -48,20 +48,20 @@ class PaginatorHelper extends AppHelper { * * The values that may be specified are: * - * - $options['format'] Format of the counter. Supported formats are 'range' and 'pages' - * and custom (default). In the default mode the supplied string is parsed and constants are replaced - * by their actual values. - * Constants: %page%, %pages%, %current%, %count%, %start%, %end% . - * - $options['separator'] The separator of the actual page and number of pages (default: ' of '). - * - $options['url'] Url of the action. See Router::url() - * - $options['url']['sort'] the key that the recordset is sorted. - * - $options['url']['direction'] Direction of the sorting (default: 'asc'). - * - $options['url']['page'] Page # to display. - * - $options['model'] The name of the model. - * - $options['escape'] Defines if the title field for the link should be escaped (default: true). - * - $options['update'] DOM id of the element updated with the results of the AJAX call. - * If this key isn't specified Paginator will use plain HTML links. - * - $options['indicator'] DOM id of the element that will be shown when doing AJAX requests. + * - `$options['format']` Format of the counter. Supported formats are 'range' and 'pages' + * and custom (default). In the default mode the supplied string is parsed and constants are replaced + * by their actual values. + * Constants: %page%, %pages%, %current%, %count%, %start%, %end% . + * - `$options['separator']` The separator of the actual page and number of pages (default: ' of '). + * - `$options['url']` Url of the action. See Router::url() + * - `$options['url']['sort']` the key that the recordset is sorted. + * - `$options['url']['direction']` Direction of the sorting (default: 'asc'). + * - `$options['url']['page']` Page # to display. + * - `$options['model']` The name of the model. + * - `$options['escape']` Defines if the title field for the link should be escaped (default: true). + * - `$options['update']` DOM id of the element updated with the results of the AJAX call. + * If this key isn't specified Paginator will use plain HTML links. + * - `$options['indicator']` DOM id of the element that will be shown when doing AJAX requests. * * @var array */ @@ -69,7 +69,7 @@ class PaginatorHelper extends AppHelper { /** * Gets the current paging parameters from the resultset for the given model * - * @param string $model Optional model name. Uses the default if none is specified. + * @param string $model Optional model name. Uses the default if none is specified. * @return array The array of paging parameters for the paginated resultset. */ function params($model = null) { @@ -84,7 +84,7 @@ class PaginatorHelper extends AppHelper { /** * Sets default options for all pagination links * - * @param mixed $options Default options for pagination links. If a string is supplied - it + * @param mixed $options Default options for pagination links. If a string is supplied - it * is used as the DOM id element to update. See #options for list of keys. */ function options($options = array()) { @@ -113,7 +113,7 @@ class PaginatorHelper extends AppHelper { /** * Gets the current page of the recordset for the given model * - * @param string $model Optional model name. Uses the default if none is specified. + * @param string $model Optional model name. Uses the default if none is specified. * @return string The current page number of the recordset. */ function current($model = null) { @@ -127,8 +127,8 @@ class PaginatorHelper extends AppHelper { /** * Gets the current key by which the recordset is sorted * - * @param string $model Optional model name. Uses the default if none is specified. - * @param mixed $options Options for pagination links. See #options for list of keys. + * @param string $model Optional model name. Uses the default if none is specified. + * @param mixed $options Options for pagination links. See #options for list of keys. * @return string The name of the key by which the recordset is being sorted, or * null if the results are not currently sorted. */ @@ -158,8 +158,8 @@ class PaginatorHelper extends AppHelper { /** * Gets the current direction the recordset is sorted * - * @param string $model Optional model name. Uses the default if none is specified. - * @param mixed $options Options for pagination links. See #options for list of keys. + * @param string $model Optional model name. Uses the default if none is specified. + * @param mixed $options Options for pagination links. See #options for list of keys. * @return string The direction by which the recordset is being sorted, or * null if the results are not currently sorted. */ @@ -185,6 +185,12 @@ class PaginatorHelper extends AppHelper { /** * Generates a "previous" link for a set of paged records * + * Options: + * + * - `tag` The tag wrapping tag you want to use, defaults to 'span' + * - `escape` Whether you want the contents html entity encoded, defaults to true + * - `model` The model to use, defaults to PaginatorHelper::defaultModel() + * * @param string $title Title for the link. Defaults to '<< Previous'. * @param mixed $options Options for pagination link. See #options for list of keys. * @param string $disabledTitle Title when the link is disabled. @@ -197,10 +203,16 @@ class PaginatorHelper extends AppHelper { /** * Generates a "next" link for a set of paged records * - * @param string $title Title for the link. Defaults to 'Next >>'. - * @param mixed $options Options for pagination link. See #options for list of keys. - * @param string $disabledTitle Title when the link is disabled. - * @param mixed $disabledOptions Options for the disabled pagination link. See #options for list of keys. + * Options: + * + * - `tag` The tag wrapping tag you want to use, defaults to 'span' + * - `escape` Whether you want the contents html entity encoded, defaults to true + * - `model` The model to use, defaults to PaginatorHelper::defaultModel() + * + * @param string $title Title for the link. Defaults to 'Next >>'. + * @param mixed $options Options for pagination link. See above for list of keys. + * @param string $disabledTitle Title when the link is disabled. + * @param mixed $disabledOptions Options for the disabled pagination link. See above for list of keys. * @return string A "next" link or or $disabledTitle text if the link is disabled. */ function next($title = 'Next >>', $options = array(), $disabledTitle = null, $disabledOptions = array()) { @@ -210,10 +222,15 @@ class PaginatorHelper extends AppHelper { * Generates a sorting link. Sets named parameters for the sort and direction. Handles * direction switching automatically. * + * Options: + * + * - `escape` Whether you want the contents html entity encoded, defaults to true + * - `model` The model to use, defaults to PaginatorHelper::defaultModel() + * * @param string $title Title for the link. * @param string $key The name of the key that the recordset should be sorted. If $key is null * $title will be used for the key, and a title will be generated by inflection. - * @param array $options Options for sorting link. See #options for list of keys. + * @param array $options Options for sorting link. See above for list of keys. * @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified * key the returned link will sort by 'desc'. */ @@ -244,9 +261,16 @@ class PaginatorHelper extends AppHelper { /** * Generates a plain or Ajax link with pagination parameters * - * @param string $title Title for the link. - * @param mixed $url Url for the action. See Router::url() - * @param array $options Options for the link. See #options for list of keys. + * Options + * + * - `update` The Id of the DOM element you wish to update. Creates Ajax enabled links + * with the AjaxHelper. + * - `escape` Whether you want the contents html entity encoded, defaults to true + * - `model` The model to use, defaults to PaginatorHelper::defaultModel() + * + * @param string $title Title for the link. + * @param mixed $url Url for the action. See Router::url() + * @param array $options Options for the link. See #options for list of keys. * @return string A link with pagination parameters. */ function link($title, $url = array(), $options = array()) { @@ -271,9 +295,9 @@ class PaginatorHelper extends AppHelper { /** * Merges passed URL options with current pagination state to generate a pagination URL. * - * @param array $options Pagination/URL options array - * @param boolean $asArray - * @param string $model Which model to paginate on + * @param array $options Pagination/URL options array + * @param boolean $asArray Return the url as an array, or a URI string + * @param string $model Which model to paginate on * @return mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript) */ function url($options = array(), $asArray = false, $model = null) { @@ -328,7 +352,7 @@ class PaginatorHelper extends AppHelper { /** * Returns true if the given result set is not at the first page * - * @param string $model Optional model name. Uses the default if none is specified. + * @param string $model Optional model name. Uses the default if none is specified. * @return boolean True if the result set is not at the first page. */ function hasPrev($model = null) { @@ -346,8 +370,8 @@ class PaginatorHelper extends AppHelper { /** * Returns true if the given result set has the page number given by $page * - * @param string $model Optional model name. Uses the default if none is specified. - * @param int $page The page number - if not set defaults to 1. + * @param string $model Optional model name. Uses the default if none is specified. + * @param int $page The page number - if not set defaults to 1. * @return boolean True if the given result set has the specified page number. */ function hasPage($model = null, $page = 1) { @@ -389,7 +413,16 @@ class PaginatorHelper extends AppHelper { /** * Returns a counter string for the paged result set * - * @param mixed $options Options for the counter string. See #options for list of keys. + * Options + * + * - `model` The model to use, defaults to PaginatorHelper::defaultModel(); + * - `format` The format string you want to use, defaults to 'pages' Which generates output like '1 of 5' + * set to 'range' to generate output like '1 - 3 of 13'. Can also be set to a custom string, containing + * the following placeholders `%page%`, `%pages%`, `%current%`, `%count%`, `%start%`, `%end%` and any + * custom content you would like. + * - `separator` The separator string to use, default to ' of ' + * + * @param mixed $options Options for the counter string. See #options for list of keys. * @return string Counter string. */ function counter($options = array()) { @@ -400,8 +433,8 @@ class PaginatorHelper extends AppHelper { $options = array_merge( array( 'model' => $this->defaultModel(), - 'format' => 'pages', - 'separator' => ' of ' + 'format' => 'pages' + 'separator' => __(' of ', true) ), $options); @@ -446,7 +479,20 @@ class PaginatorHelper extends AppHelper { * Returns a set of numbers for the paged result set * uses a modulus to decide how many numbers to show on each side of the current page (default: 8) * - * @param mixed $options Options for the numbers, (before, after, model, modulus, separator) + * Options + * + * - `before` Content to be inserted before the numbers + * - `after` Content to be inserted after the numbers + * - `model` Model to create numbers for, defaults to PaginatorHelper::defaultModel() + * - `modulus` how many numbers to include on either side of the current page, defaults to 8. + * - `separator` Separator content defaults to ' | ' + * - `tag` The tag to wrap links in, defaults to 'span' + * - `first` Whether you want first links generated, set to an integer to define the number of 'first' + * links to generate + * - `last` Whether you want last links generated, set to an integer to define the number of 'last' + * links to generate + * + * @param mixed $options Options for the numbers, (before, after, model, modulus, separator) * @return string numbers string. */ function numbers($options = array()) { @@ -555,8 +601,15 @@ class PaginatorHelper extends AppHelper { /** * Returns a first or set of numbers for the first pages * - * @param mixed $first if string use as label for the link, if numeric print page numbers - * @param mixed $options + * Options: + * + * - `tag` The tag wrapping tag you want to use, defaults to 'span' + * - `before` Content to insert before the link/tag + * - `model` The model to use defaults to PaginatorHelper::defaultModel() + * - `separator` Content between the generated links, defaults to ' | ' + * + * @param mixed $first if string use as label for the link, if numeric print page numbers + * @param mixed $options * @return string numbers string. */ function first($first = '<< first', $options = array()) { @@ -599,8 +652,15 @@ class PaginatorHelper extends AppHelper { /** * Returns a last or set of numbers for the last pages * - * @param mixed $last if string use as label for the link, if numeric print page numbers - * @param mixed $options + * Options: + * + * - `tag` The tag wrapping tag you want to use, defaults to 'span' + * - `before` Content to insert before the link/tag + * - `model` The model to use defaults to PaginatorHelper::defaultModel() + * - `separator` Content between the generated links, defaults to ' | ' + * + * @param mixed $last if string use as label for the link, if numeric print page numbers + * @param mixed $options Array of options * @return string numbers string. */ function last($last = 'last >>', $options = array()) { From 133299c653ecd0139b12e898a186f3c15dfdaf8b Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 3 Nov 2009 09:02:17 -0500 Subject: [PATCH 004/112] Removing duplicate constructor from ShellDispatcher. Fixes warnings under PHP5.3. Fixes #132 --- cake/console/cake.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cake/console/cake.php b/cake/console/cake.php index 2210beecf..cfd118302 100644 --- a/cake/console/cake.php +++ b/cake/console/cake.php @@ -118,14 +118,6 @@ class ShellDispatcher { * @param array $args the argv. */ function ShellDispatcher($args = array()) { - $this->__construct($args); - } -/** - * Constructor - * - * @param array $args the argv. - */ - function __construct($args = array()) { set_time_limit(0); $this->__initConstants(); $this->parseParams($args); From d63218c0a09c26bebc5c5104e63be2f144ee9101 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 3 Nov 2009 09:52:59 -0500 Subject: [PATCH 005/112] Fixing error in previous commit. --- cake/libs/view/helpers/paginator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index 8362337ac..9fa185ddc 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -433,7 +433,7 @@ class PaginatorHelper extends AppHelper { $options = array_merge( array( 'model' => $this->defaultModel(), - 'format' => 'pages' + 'format' => 'pages', 'separator' => __(' of ', true) ), $options); From 8c46cc49fbc234f1d760b5757aa322201e0a1161 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 3 Nov 2009 13:14:38 -0500 Subject: [PATCH 006/112] Fixing issue in Dispatcher::cached() where plugins ending in asset extensions would be incorrectly handled. Test added Fixes #237 --- cake/dispatcher.php | 14 +++++++++----- cake/tests/cases/dispatcher.test.php | 11 ++++++++++- .../plugins/plugin_js/vendors/js/plugin_js.js | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 cake/tests/test_app/plugins/plugin_js/vendors/js/plugin_js.js diff --git a/cake/dispatcher.php b/cake/dispatcher.php index ca147f305..b2b1d81d4 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -598,15 +598,19 @@ class Dispatcher extends Object { $this->_stop(); } $isAsset = false; - $assets = array('js' => 'text/javascript', 'css' => 'text/css', 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'png' => 'image/png'); + $assets = array( + 'js' => 'text/javascript', 'css' => 'text/css', + 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'png' => 'image/png' + ); $ext = array_pop(explode('.', $url)); foreach ($assets as $type => $contentType) { if ($type === $ext) { - if ($type === 'css' || $type === 'js') { - $pos = strpos($url, $type . '/'); + $parts = explode('/', $url); + if ($parts[0] === 'css' || $parts[0] === 'js' || $parts[0] === 'img') { + $pos = 0; } else { - $pos = strpos($url, 'img/'); + $pos = strlen($parts[0]); } $isAsset = true; break; @@ -624,7 +628,7 @@ class Dispatcher extends Object { $paths = array(); if ($pos > 0) { - $plugin = substr($url, 0, $pos - 1); + $plugin = substr($url, 0, $pos); $url = preg_replace('/^' . preg_quote($plugin, '/') . '\//i', '', $url); $pluginPaths = Configure::read('pluginPaths'); $count = count($pluginPaths); diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index 613c8949a..4ea07969b 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -1711,7 +1711,7 @@ class DispatcherTest extends CakeTestCase { Configure::write('debug', 0); ob_start(); - $Dispatcher->dispatch('/img/test.jpg'); + $Dispatcher->dispatch('img/test.jpg'); $result = ob_get_clean(); $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'img' . DS . 'test.jpg'); $this->assertEqual($file, $result); @@ -1756,6 +1756,15 @@ class DispatcherTest extends CakeTestCase { $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' .DS . 'vendors' . DS . 'img' . DS . 'cake.icon.gif'); $this->assertEqual($file, $result); + + Configure::write('debug', 2); + $Dispatcher->params = $Dispatcher->parseParams('plugin_js/js/plugin_js.js'); + ob_start(); + $Dispatcher->cached('plugin_js/js/plugin_js.js'); + $result = ob_get_clean(); + $expected = "alert('win sauce');"; + $this->assertEqual($result, $expected); + header('Content-type: text/html');//reset the header content-type without page can render as plain text. } /** diff --git a/cake/tests/test_app/plugins/plugin_js/vendors/js/plugin_js.js b/cake/tests/test_app/plugins/plugin_js/vendors/js/plugin_js.js new file mode 100644 index 000000000..ac52468f6 --- /dev/null +++ b/cake/tests/test_app/plugins/plugin_js/vendors/js/plugin_js.js @@ -0,0 +1 @@ +alert('win sauce'); \ No newline at end of file From e609875754103913927f4bab7f67323aa6529165 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 4 Nov 2009 12:36:17 -0500 Subject: [PATCH 007/112] Updating Model::invalidFields, so returning false from beforeValidate() will abort both the validation and saving() of the record. Tests added to check beforeSave, beforeValidate, and beforeDelete return values. Fixes #257 --- cake/libs/model/model.php | 4 +- .../cases/libs/model/model_delete.test.php | 15 ++++++ .../cases/libs/model/model_write.test.php | 34 ++++++++++++ cake/tests/cases/libs/model/models.php | 53 ++++++++++++++++++- 4 files changed, 103 insertions(+), 3 deletions(-) diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index abf93d39c..84b096fbe 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -2359,7 +2359,7 @@ class Model extends Overloadable { ) || $this->beforeValidate($options) === false ) { - return $this->validationErrors; + return false; } if (!isset($this->validate) || empty($this->validate)) { @@ -2793,7 +2793,7 @@ class Model extends Overloadable { function afterDelete() { } /** - * Called during save operations, before validation. Please note that custom + * Called during validation operations, before validation. Please note that custom * validation rules can be defined in $validate. * * @return boolean True if validate operation should continue, false to abort diff --git a/cake/tests/cases/libs/model/model_delete.test.php b/cake/tests/cases/libs/model/model_delete.test.php index 6d30d2bdf..2be205e92 100644 --- a/cake/tests/cases/libs/model/model_delete.test.php +++ b/cake/tests/cases/libs/model/model_delete.test.php @@ -565,7 +565,22 @@ class ModelDeleteTest extends BaseModelTest { )); $this->assertEqual($result['Monkey'], $expected); } +/** + * test that beforeDelete returning false can abort deletion. + * + * @return void + **/ + function testBeforeDeleteDeleteAbortion() { + $this->loadFixtures('Post'); + $Model =& new CallbackPostTestModel(); + $Model->beforeDeleteReturn = false; + $result = $Model->delete(1); + $this->assertFalse($result); + + $exists = $Model->findById(1); + $this->assertTrue(is_array($exists)); + } } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/model/model_write.test.php b/cake/tests/cases/libs/model/model_write.test.php index 3d023ce11..4d969cca9 100644 --- a/cake/tests/cases/libs/model/model_write.test.php +++ b/cake/tests/cases/libs/model/model_write.test.php @@ -601,6 +601,40 @@ class ModelWriteTest extends BaseModelTest { $result = $TestModel->validates(); $this->assertTrue($result); } +/** + * test that beforeValidate returning false can abort saves. + * + * @return void + **/ + function testBeforeValidateSaveAbortion() { + $Model =& new CallbackPostTestModel(); + $Model->beforeValidateReturn = false; + + $data = array( + 'title' => 'new article', + 'body' => 'this is some text.' + ); + $Model->create(); + $result = $Model->save($data); + $this->assertFalse($result); + } +/** + * test that beforeSave returning false can abort saves. + * + * @return void + **/ + function testBeforeSaveSaveAbortion() { + $Model =& new CallbackPostTestModel(); + $Model->beforeSaveReturn = false; + + $data = array( + 'title' => 'new article', + 'body' => 'this is some text.' + ); + $Model->create(); + $result = $Model->save($data); + $this->assertFalse($result); + } /** * testValidates method * diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index 64541c4fd..f601b82aa 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -1749,7 +1749,58 @@ class AssociationTest2 extends CakeTestModel { * @subpackage cake.tests.cases.libs.model */ class Callback extends CakeTestModel { - // + +} +/** + * CallbackPostTestModel class + * + * @package cake + * @subpackage cake.tests.cases.libs.model + */ +class CallbackPostTestModel extends CakeTestModel { + var $useTable = 'posts'; +/** + * variable to control return of beforeValidate + * + * @var string + */ + var $beforeValidateReturn = true; +/** + * variable to control return of beforeSave + * + * @var string + */ + var $beforeSaveReturn = true; +/** + * variable to control return of beforeDelete + * + * @var string + */ + var $beforeDeleteReturn = true; +/** + * beforeSave callback + * + * @return void + **/ + function beforeSave($options) { + return $this->beforeSaveReturn; + } +/** + * beforeValidate callback + * + * @return void + **/ + function beforeValidate($options) { + return $this->beforeValidateReturn; + } +/** + * beforeDelete callback + * + * @return void + **/ + function beforeDelete($cascade = true) { + return $this->beforeDeleteReturn; + } } /** * Uuid class From b4f6dd9c6e304164c8b0fc64d29d7de82617c23e Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 4 Nov 2009 22:57:43 -0500 Subject: [PATCH 008/112] Adding tests and support for binary columns in model task. Fixes #241 --- cake/console/libs/tasks/model.php | 1 + cake/tests/cases/console/libs/tasks/model.test.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 2d75be9ba..b962a13df 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -870,6 +870,7 @@ class ModelTask extends Shell { case 'integer': $insert = 1; break; + case 'binary': case 'string'; $insert = "Lorem ipsum dolor sit amet"; if (!empty($value['length'])) { diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index b273b69cc..a2e7f5c54 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -53,7 +53,7 @@ Mock::generatePartial( * @subpackage cake.tests.cases.console.libs.tasks */ class ModelTaskTest extends CakeTestCase { - var $fixtures = array('core.datatype'); + var $fixtures = array('core.datatype', 'core.binary_test'); /** * setUp method * @@ -84,7 +84,9 @@ class ModelTaskTest extends CakeTestCase { $this->Task->setReturnValue('createFile', true); $result = $this->Task->fixture('Datatype'); $this->assertPattern('/float_field\' => 1/', $result); - + + $result = $this->Task->fixture('BinaryTest'); + $this->assertPattern("/'data' => 'Lorem ipsum dolor sit amet'/", $result); } } ?> \ No newline at end of file From 0327f15395f561df4fd2c05af81094bb6d8cfa5a Mon Sep 17 00:00:00 2001 From: Ernst Mayerhofer Date: Thu, 5 Nov 2009 19:21:53 +0100 Subject: [PATCH 009/112] paginator works with limit 0 now too --- cake/tests/cases/libs/controller/controller.test.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 8c7b3204c..555296d1f 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -511,6 +511,13 @@ class ControllerTest extends CakeTestCase { $Controller->paginate('ControllerPost'); $this->assertIdentical($Controller->params['paging']['ControllerPost']['page'], 1, 'XSS exploit opened %s'); $this->assertIdentical($Controller->params['paging']['ControllerPost']['options']['page'], 1, 'XSS exploit opened %s'); + + $Controller->paginate = array('limit' => 0); + $Controller->paginate('ControllerPost'); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['page'], 1); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['pageCount'], 1); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['prevPage'], false); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['nextPage'], false); } /** * testPaginateExtraParams method From 4bbfcbff7e90fab42bef39e01003113dc715a3b0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 6 Nov 2009 00:44:21 -0500 Subject: [PATCH 010/112] Fixing limit:0 and controller::paginate. Removes possibilty to generate sql errors by inputting invalid limit options. Tests updated. Refs #264 --- cake/libs/controller/controller.php | 5 +++-- .../cases/libs/controller/controller.test.php | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index b1d3c4d72..273d51e23 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -1044,8 +1044,9 @@ class Controller extends Object { $type = $defaults[0]; unset($defaults[0]); } - - extract($options = array_merge(array('page' => 1, 'limit' => 20), $defaults, $options)); + $options = array_merge(array('page' => 1, 'limit' => 20), $defaults, $options); + $options['limit'] = (empty($options['limit']) || !is_numeric($options['limit'])) ? 1 : $options['limit']; + extract($options); if (is_array($scope) && !empty($scope)) { $conditions = array_merge($conditions, $scope); diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 555296d1f..4b978a03e 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -511,13 +511,22 @@ class ControllerTest extends CakeTestCase { $Controller->paginate('ControllerPost'); $this->assertIdentical($Controller->params['paging']['ControllerPost']['page'], 1, 'XSS exploit opened %s'); $this->assertIdentical($Controller->params['paging']['ControllerPost']['options']['page'], 1, 'XSS exploit opened %s'); - + + $Controller->passedArgs = array(); $Controller->paginate = array('limit' => 0); $Controller->paginate('ControllerPost'); $this->assertIdentical($Controller->params['paging']['ControllerPost']['page'], 1); - $this->assertIdentical($Controller->params['paging']['ControllerPost']['pageCount'], 1); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['pageCount'], 3); $this->assertIdentical($Controller->params['paging']['ControllerPost']['prevPage'], false); - $this->assertIdentical($Controller->params['paging']['ControllerPost']['nextPage'], false); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['nextPage'], true); + + $Controller->passedArgs = array(); + $Controller->paginate = array('limit' => 'garbage!'); + $Controller->paginate('ControllerPost'); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['page'], 1); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['pageCount'], 3); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['prevPage'], false); + $this->assertIdentical($Controller->params['paging']['ControllerPost']['nextPage'], true); } /** * testPaginateExtraParams method From 4deaf27cc02ed29766f6d6d5aca3b1f4220741b0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 6 Nov 2009 09:31:57 -0500 Subject: [PATCH 011/112] Removing deprecated code in Html::css() Minor refactoring in HtmlHelper methods. Fixes #268 --- cake/libs/view/helpers/html.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index e02ea1e1a..533dd9721 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -356,7 +356,7 @@ class HtmlHelper extends AppHelper { * * #### Options * - * - `inline` If set to false, the generated tag appears in the head tag of the layout. + * - `inline` If set to false, the generated tag appears in the head tag of the layout. Defaults to true * * @param mixed $path The name of a CSS style sheet or an array containing names of * CSS stylesheets. If `$path` is prefixed with '/', the path will be relative to the webroot @@ -367,13 +367,13 @@ class HtmlHelper extends AppHelper { * @access public */ function css($path, $rel = null, $options = array()) { - $inline = isset($options['inline']) ? $options['inline'] : true; + $options += array('inline' => true); if (is_array($path)) { $out = ''; foreach ($path as $i) { - $out .= "\n\t" . $this->css($i, $rel, $options, $inline); + $out .= "\n\t" . $this->css($i, $rel, $options); } - if ($inline) { + if ($options['inline']) { return $out . "\n"; } return; @@ -402,7 +402,7 @@ class HtmlHelper extends AppHelper { } if ($rel == 'import') { - $out = sprintf($this->tags['style'], $this->_parseAttributes($options, null, '', ' '), '@import url(' . $url . ');'); + $out = sprintf($this->tags['style'], $this->_parseAttributes($options, array('inline'), '', ' '), '@import url(' . $url . ');'); } else { if ($rel == null) { $rel = 'stylesheet'; @@ -411,7 +411,7 @@ class HtmlHelper extends AppHelper { } $out = $this->output($out); - if ($inline) { + if ($options['inline']) { return $out; } else { $view =& ClassRegistry::getObject('view'); @@ -472,12 +472,10 @@ class HtmlHelper extends AppHelper { $url = str_replace(JS_URL, 'cjs/', $url); } } - $inline = $options['inline']; - unset($options['inline'], $options['once']); - $attributes = $this->_parseAttributes($options, ' ', ' '); + $attributes = $this->_parseAttributes($options, array('inline', 'once'), ' '); $out = $this->output(sprintf($this->tags['javascriptlink'], $url, $attributes)); - if ($inline) { + if ($options['inline']) { return $out; } else { $view =& ClassRegistry::getObject('view'); @@ -497,8 +495,7 @@ class HtmlHelper extends AppHelper { * @return mixed string or null depending on the value of `$options['inline']` **/ function scriptBlock($script, $options = array()) { - $defaultOptions = array('safe' => true, 'inline' => true); - $options = array_merge($defaultOptions, $options); + $options += array('safe' => true, 'inline' => true); if ($options['safe']) { $script = "\n" . '//' . "\n"; } @@ -527,8 +524,7 @@ class HtmlHelper extends AppHelper { * @return void **/ function scriptStart($options = array()) { - $defaultOptions = array('safe' => true, 'inline' => true); - $options = array_merge($defaultOptions, $options); + $options += array('safe' => true, 'inline' => true); $this->_scriptBlockOptions = $options; ob_start(); return null; From 30dc0cfe569ea3f10d325c4e59d5642143c88424 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 7 Nov 2009 10:40:48 -0500 Subject: [PATCH 012/112] Removing unused $view property from CacheHelper. Fixes #272 --- cake/libs/view/helpers/cache.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 34a43ba1d..f27663b4f 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -48,13 +48,6 @@ class CacheHelper extends AppHelper { * @access private */ var $__match = array(); -/** - * holds the View object passed in final call to CacheHelper::cache() - * - * @var View - * @access public - */ - var $view; /** * cache action time * From dd0c4a64c5ec65940a6a60fea771d65ea77289e8 Mon Sep 17 00:00:00 2001 From: ceeram Date: Wed, 4 Nov 2009 12:31:39 +0100 Subject: [PATCH 013/112] Test to prove ticket #253 --- .../cases/libs/model/behaviors/containable.test.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index ca16f3188..b1d995ccb 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -3380,6 +3380,17 @@ class ContainableBehaviorTest extends CakeTestCase { )); $this->assertEqual($expected, $this->Article->User->hasOne); + $this->Article->User->bindModel($userHasOne, false); + $expected = $this->Article->User->hasOne; + $this->Article->find('all', array( + 'contain' => array( + 'User' => array( + 'Comment' => array('fields' => array('created')) + ) + ) + )); + $this->assertEqual($expected, $this->Article->User->hasOne); + $this->Article->User->bindModel($userHasOne, false); $expected = $this->Article->User->hasOne; $this->Article->find('all', array( From 6db91b0f49b71dcc1200dfb9fb95841bfb1525a1 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 7 Nov 2009 17:43:18 -0500 Subject: [PATCH 014/112] Fixing issues in ContainableBehavior that could leave models unbound when 'fields' was used as part of containment conditions. Fixes #253 --- cake/libs/model/behaviors/containable.php | 2 +- cake/tests/cases/libs/model/behaviors/containable.test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/libs/model/behaviors/containable.php b/cake/libs/model/behaviors/containable.php index ed5dd6d5d..9bec011a2 100644 --- a/cake/libs/model/behaviors/containable.php +++ b/cake/libs/model/behaviors/containable.php @@ -155,7 +155,7 @@ class ContainableBehavior extends ModelBehavior { if (!$reset && empty($instance->__backOriginalAssociation)) { $instance->__backOriginalAssociation = $backupBindings; } else if ($reset) { - $instance->__backAssociation[$type] = $instance->{$type}; + $instance->__backAssociation[$type] = $backupBindings[$type]; } $instance->{$type}[$assoc] = array_merge($instance->{$type}[$assoc], $model['keep'][$assoc]); } diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index b1d995ccb..d5ae197c8 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -3390,7 +3390,7 @@ class ContainableBehaviorTest extends CakeTestCase { ) )); $this->assertEqual($expected, $this->Article->User->hasOne); - + $this->Article->User->bindModel($userHasOne, false); $expected = $this->Article->User->hasOne; $this->Article->find('all', array( From 82a2b1a01957ccbfd3a6abe31133f49b9005bced Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 7 Nov 2009 17:53:14 -0500 Subject: [PATCH 015/112] Changing import of Dispatcher to direct require. Modifying order of operations in Configure::__loadBootstrap() moving inclusion of app/config/bootstrap.php after the creation of core cache configs. This allows App::import() to be used in the bootstrap file with cached paths. --- cake/bootstrap.php | 2 +- cake/libs/configure.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cake/bootstrap.php b/cake/bootstrap.php index 0a28e5558..f9aa7b438 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -48,5 +48,5 @@ error_reporting(E_ALL & ~E_DEPRECATED); $url = null; - App::import('Core', array('Dispatcher')); + require CAKE . 'dispatcher.php'; ?> \ No newline at end of file diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 05cb2875e..985890cfe 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -652,10 +652,6 @@ class Configure extends Object { trigger_error(sprintf(__("Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR); } - if (!include(CONFIGS . 'bootstrap.php')) { - trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR); - } - if (Configure::read('Cache.disable') !== true) { $cache = Cache::config('default'); @@ -692,6 +688,11 @@ class Configure extends Object { } Cache::config('default'); } + + if (!include(CONFIGS . 'bootstrap.php')) { + trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR); + } + Configure::buildPaths(compact( 'modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths', 'localePaths', 'shellPaths' From 95cafc713824bb4f981299fcb7c9520094b05b8c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 8 Nov 2009 13:46:45 -0500 Subject: [PATCH 016/112] Adding missing help text. --- cake/console/libs/bake.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cake/console/libs/bake.php b/cake/console/libs/bake.php index 7f1f0ad67..33f0c4055 100644 --- a/cake/console/libs/bake.php +++ b/cake/console/libs/bake.php @@ -231,6 +231,8 @@ class BakeShell extends Shell { $this->out("\n\tbake model\n\t\tbakes a model. run 'bake model help' for more info"); $this->out("\n\tbake view\n\t\tbakes views. run 'bake view help' for more info"); $this->out("\n\tbake controller\n\t\tbakes a controller. run 'bake controller help' for more info"); + $this->out("\n\tbake fixture\n\t\tbakes fixtures. run 'bake fixture help' for more info."); + $this->out("\n\tbake test\n\t\tbakes unit tests. run 'bake test help' for more info."); $this->out(); } From 6b79c8d375f80770497061a92ed582401d00314e Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 8 Nov 2009 14:07:25 -0500 Subject: [PATCH 017/112] Adding checks for parent classname when converting error method names. Fixes #273 --- cake/libs/error.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/error.php b/cake/libs/error.php index 26ef72a52..7861ec269 100644 --- a/cake/libs/error.php +++ b/cake/libs/error.php @@ -108,10 +108,13 @@ class ErrorHandler extends Object { if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) { $method = 'error'; } - if ($method !== 'error') { if (Configure::read('debug') == 0) { - $parentMethods = get_class_methods(get_parent_class($this)); + $parentClass = get_parent_class($this); + if (strtolower($parentClass) != 'errorhandler') { + $method = 'error404'; + } + $parentMethods = get_class_methods($parentClass); if (in_array($method, $parentMethods)) { $method = 'error404'; } From a7a6dc8c43fddb2f78226f136203b851a80f6328 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 8 Nov 2009 14:12:18 -0500 Subject: [PATCH 018/112] Fixing issue where SecurityComponent::_validatePost could generate notices if elements were removed from _Token array. Tests Added Fixed #228 --- cake/libs/controller/components/security.php | 2 +- .../controller/components/security.test.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 96d140256..64e0af936 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -545,7 +545,7 @@ class SecurityComponent extends Object { } $data = $controller->data; - if (!isset($data['_Token']) || !isset($data['_Token']['fields'])) { + if (!isset($data['_Token']) || !isset($data['_Token']['fields']) || !isset($data['_Token']['key'])) { return false; } $token = $data['_Token']['key']; diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php index 0aa80c393..d3a3fff5a 100644 --- a/cake/tests/cases/libs/controller/components/security.test.php +++ b/cake/tests/cases/libs/controller/components/security.test.php @@ -527,6 +527,31 @@ DIGEST; ); $this->assertTrue($this->Controller->Security->validatePost($this->Controller)); } +/** + * test that validatePost fails if any of its required fields are missing. + * + * @return void + **/ + function testValidatePostFormHacking() { + $this->Controller->Security->startup($this->Controller); + $key = $this->Controller->params['_Token']['key']; + $fields = 'a5475372b40f6e3ccbf9f8af191f20e1642fd877%3An%3A1%3A%7Bv%3A0%3B'; + $fields .= 'f%3A11%3A%22Zbqry.inyvq%22%3B%7D'; + + $this->Controller->data = array( + 'Model' => array('username' => 'nate', 'password' => 'foo', 'valid' => '0'), + '_Token' => compact('key') + ); + $result = $this->Controller->Security->validatePost($this->Controller); + $this->assertFalse($result, 'validatePost passed when fields were missing. %s'); + + $this->Controller->data = array( + 'Model' => array('username' => 'nate', 'password' => 'foo', 'valid' => '0'), + '_Token' => compact('fields') + ); + $result = $this->Controller->Security->validatePost($this->Controller); + $this->assertFalse($result, 'validatePost passed when key was missing. %s'); + } /** * Tests validation of checkbox arrays * From c4b493c934d9b24281a2cf07a4b82b719266882a Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 8 Nov 2009 22:22:08 -0500 Subject: [PATCH 019/112] Manually merging changes from ModelTask in 1.2 to FixtureTask Adding test cases for FixtureTask. --- cake/console/libs/tasks/fixture.php | 4 +++- .../cases/console/libs/tasks/fixture.test.php | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cake/console/libs/tasks/fixture.php b/cake/console/libs/tasks/fixture.php index 631ee2b04..98c1ecea8 100644 --- a/cake/console/libs/tasks/fixture.php +++ b/cake/console/libs/tasks/fixture.php @@ -277,9 +277,11 @@ class FixtureTask extends Shell { } switch ($fieldInfo['type']) { case 'integer': + case 'float': $insert = $i + 1; break; - case 'string'; + case 'string': + case 'binary': $isPrimaryUuid = ( isset($fieldInfo['key']) && strtolower($fieldInfo['key']) == 'primary' && isset($fieldInfo['length']) && $fieldInfo['length'] == 36 diff --git a/cake/tests/cases/console/libs/tasks/fixture.test.php b/cake/tests/cases/console/libs/tasks/fixture.test.php index 3839010e4..926758d19 100644 --- a/cake/tests/cases/console/libs/tasks/fixture.test.php +++ b/cake/tests/cases/console/libs/tasks/fixture.test.php @@ -61,7 +61,7 @@ class FixtureTaskTest extends CakeTestCase { * * @var array **/ - var $fixtures = array('core.article', 'core.comment'); + var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test'); /** * startTest method @@ -259,6 +259,22 @@ class FixtureTaskTest extends CakeTestCase { $this->assertNoPattern('/var \$records/', $result); } +/** + * test record generation with float and binary types + * + * @return void + **/ + function testRecordGenerationForBinaryAndFloat() { + $this->Task->connection = 'test_suite'; + $this->Task->path = '/my/path/'; + + $result = $this->Task->bake('Article', 'datatypes'); + $this->assertPattern("/'float_field' => 1/", $result); + + $result = $this->Task->bake('Article', 'binary_tests'); + $this->assertPattern("/'data' => 'Lorem ipsum dolor sit amet'/", $result); + } + /** * Test that file generation includes headers and correct path for plugins. * From fa1b7f617fbfee20b6f4c599a07ff852bcb3bdf5 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 9 Nov 2009 14:07:19 -0500 Subject: [PATCH 020/112] Fixing issues caused by merge with 1.2. --- cake/libs/configure.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 67e00df56..3bdc14e8f 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -403,6 +403,11 @@ class Configure extends Object { } Cache::config('default'); } + + if (!include(CONFIGS . 'bootstrap.php')) { + trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR); + } + if (App::path('controllers') == array()) { App::build(array( 'models' => $modelPaths, 'views' => $viewPaths, 'controllers' => $controllerPaths, @@ -411,15 +416,6 @@ class Configure extends Object { 'shells' => $shellPaths, 'libs' => $libPaths )); } - - if (!include(CONFIGS . 'bootstrap.php')) { - trigger_error(sprintf(__("Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", true), CONFIGS), E_USER_ERROR); - } - - Configure::buildPaths(compact( - 'modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', - 'behaviorPaths', 'pluginPaths', 'vendorPaths', 'localePaths', 'shellPaths' - )); } } } From 26e19caad5bef4be6f2313d842f77395a16fbac2 Mon Sep 17 00:00:00 2001 From: predominant Date: Tue, 10 Nov 2009 10:30:13 +1100 Subject: [PATCH 021/112] Removing unnecessary getInstance() calls. --- cake/libs/security.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/cake/libs/security.php b/cake/libs/security.php index a595f5143..b90f8c0b1 100644 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -61,7 +61,6 @@ class Security extends Object { * @static */ function inactiveMins() { - $_this =& Security::getInstance(); switch (Configure::read('Security.level')) { case 'high': return 10; @@ -179,7 +178,6 @@ class Security extends Object { return ''; } - $_this =& Security::getInstance(); if (!defined('CIPHER_SEED')) { //This is temporary will change later define('CIPHER_SEED', '76859309657453542496749683645'); From d251a1d5ca4acadabaad5bba9ced84d47d980f31 Mon Sep 17 00:00:00 2001 From: ceeram Date: Mon, 9 Nov 2009 18:30:09 +0100 Subject: [PATCH 022/112] Adding config() call to ensure that DATABASE_CONFIG has been loaded before attempting to use it. refs #277 Signed-off-by: Mark Story --- cake/console/libs/tasks/db_config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/cake/console/libs/tasks/db_config.php b/cake/console/libs/tasks/db_config.php index f138de1b0..6635fe8c0 100644 --- a/cake/console/libs/tasks/db_config.php +++ b/cake/console/libs/tasks/db_config.php @@ -258,6 +258,7 @@ class DbConfigTask extends Shell { $oldConfigs = array(); if (file_exists($filename)) { + config('database'); $db = new $this->databaseClassName; $temp = get_class_vars(get_class($db)); From c810b3cde4097a5077c01f983959c68d10fac3d3 Mon Sep 17 00:00:00 2001 From: ceeram Date: Mon, 9 Nov 2009 21:01:30 +0100 Subject: [PATCH 023/112] Making ProjectTask bake constants with DS instead of hardcoded / or \. Makes developing/deploying to mixed systems easier. refs #278 Signed-off-by: Mark Story --- cake/console/libs/tasks/project.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 0d50e2013..ba966514c 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -224,7 +224,7 @@ class ProjectTask extends Shell { $File =& new File($path . 'webroot' . DS . 'index.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { - $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents); + $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents); if (!$File->write($result)) { return false; } @@ -235,7 +235,7 @@ class ProjectTask extends Shell { $File =& new File($path . 'webroot' . DS . 'test.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { - $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents); + $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents); if (!$File->write($result)) { return false; } From adaa2b689c35869052c6b218011516d77a7d2f0d Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 9 Nov 2009 20:10:24 -0500 Subject: [PATCH 024/112] Adding test case for previous commit. Fixing function for non-windows paths. --- cake/console/libs/tasks/project.php | 3 ++- .../cases/console/libs/tasks/project.test.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index ba966514c..388276e60 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -224,7 +224,8 @@ class ProjectTask extends Shell { $File =& new File($path . 'webroot' . DS . 'index.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { - $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents); + $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'"; + $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents); if (!$File->write($result)) { return false; } diff --git a/cake/tests/cases/console/libs/tasks/project.test.php b/cake/tests/cases/console/libs/tasks/project.test.php index 27813f7d0..d86dd447d 100644 --- a/cake/tests/cases/console/libs/tasks/project.test.php +++ b/cake/tests/cases/console/libs/tasks/project.test.php @@ -130,6 +130,22 @@ class ProjectTaskTest extends CakeTestCase { $this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s'); } +/** + * Test that index.php is generated correctly. + * + * @return void + **/ + function testIndexPhpGeneration() { + $this->_setupTestProject(); + + $path = $this->Task->path . 'bake_test_app' . DS; + $this->Task->corePath($path); + + $file =& new File($path . 'webroot' . DS . 'index.php'); + $contents = $file->read(); + $this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents); + } + /** * test getPrefix method, and that it returns Routing.prefix or writes to config file. * From f0628d100b04fee67f6e0dc392c08145003ed423 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 9 Nov 2009 21:00:19 -0500 Subject: [PATCH 025/112] Fixing issues with getting values from habtm data after form posting and validation has failed. Tests added. Refs #279 --- cake/libs/view/helper.php | 4 +++- cake/tests/cases/libs/view/helper.test.php | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 4528176ad..c1c57f58d 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -646,7 +646,9 @@ class Helper extends Overloadable { } $habtmKey = $this->field(); - if (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) { + if (empty($result) && isset($this->data[$habtmKey][$habtmKey])) { + $result = $this->data[$habtmKey][$habtmKey]; + } elseif (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) { if (ClassRegistry::isKeySet($habtmKey)) { $model =& ClassRegistry::getObject($habtmKey); $result = $this->__selectedArray($this->data[$habtmKey], $model->primaryKey); diff --git a/cake/tests/cases/libs/view/helper.test.php b/cake/tests/cases/libs/view/helper.test.php index 16d105792..59b46bf8a 100644 --- a/cake/tests/cases/libs/view/helper.test.php +++ b/cake/tests/cases/libs/view/helper.test.php @@ -367,6 +367,26 @@ class HelperTest extends CakeTestCase { $this->Helper->setEntity('Post.2.created.year'); $result = $this->Helper->value('Post.2.created.year'); $this->assertEqual($result, '2008'); + + $this->Helper->data = array('HelperTestTag' => array('HelperTestTag' => '')); + $this->Helper->setEntity('HelperTestTag.HelperTestTag'); + $result = $this->Helper->value('HelperTestTag.HelperTestTag'); + $this->assertEqual($result, ''); + + $this->Helper->data = array('HelperTestTag' => array('HelperTestTag' => array(2, 3, 4))); + $this->Helper->setEntity('HelperTestTag.HelperTestTag'); + $result = $this->Helper->value('HelperTestTag.HelperTestTag'); + $this->assertEqual($result, array(2, 3, 4)); + + $this->Helper->data = array( + 'HelperTestTag' => array( + array('id' => 3), + array('id' => 5) + ) + ); + $this->Helper->setEntity('HelperTestTag.HelperTestTag'); + $result = $this->Helper->value('HelperTestTag.HelperTestTag'); + $this->assertEqual($result, array(3 => 3, 5 => 5)); } /** From 2af5318e7a829a976caf852ca71fa9e7a0bafd0b Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 9 Nov 2009 23:54:59 -0500 Subject: [PATCH 026/112] Moving import in ModelTask to fix issue running bake model all. --- app/tmp/cache/views/empty | 0 cake/console/libs/tasks/model.php | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100755 app/tmp/cache/views/empty diff --git a/app/tmp/cache/views/empty b/app/tmp/cache/views/empty deleted file mode 100755 index e69de29bb..000000000 diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 46eb54f6e..8d616a71a 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -80,6 +80,8 @@ class ModelTask extends Shell { * @access public */ function execute() { + App::import('Model', 'Model', false); + if (empty($this->args)) { $this->__interactive(); } @@ -165,8 +167,6 @@ class ModelTask extends Shell { * @access private */ function __interactive() { - App::import('Model', 'Model', false); - $this->hr(); $this->out(sprintf("Bake Model\nPath: %s", $this->path)); $this->hr(); From b39b38aac99909b1cc8a9b2b0486c6563f5c8e60 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 10 Nov 2009 09:17:54 -0500 Subject: [PATCH 027/112] Adding missing variable. Adding Test case for previous commit. --- cake/console/libs/tasks/project.php | 3 ++- cake/tests/cases/console/libs/tasks/project.test.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 388276e60..de2b91e68 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -236,7 +236,8 @@ class ProjectTask extends Shell { $File =& new File($path . 'webroot' . DS . 'test.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { - $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents); + $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'"; + $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents); if (!$File->write($result)) { return false; } diff --git a/cake/tests/cases/console/libs/tasks/project.test.php b/cake/tests/cases/console/libs/tasks/project.test.php index d86dd447d..7190f35da 100644 --- a/cake/tests/cases/console/libs/tasks/project.test.php +++ b/cake/tests/cases/console/libs/tasks/project.test.php @@ -144,6 +144,10 @@ class ProjectTaskTest extends CakeTestCase { $file =& new File($path . 'webroot' . DS . 'index.php'); $contents = $file->read(); $this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents); + + $file =& new File($path . 'webroot' . DS . 'test.php'); + $contents = $file->read(); + $this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', \'ROOT/', $contents); } /** From 0d37beca754d0e31baaed775e4d83310147d8bc1 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 10 Nov 2009 09:23:43 -0500 Subject: [PATCH 028/112] Removing duplicate variable assignment. --- cake/console/libs/tasks/project.php | 1 - 1 file changed, 1 deletion(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index de2b91e68..6194fab31 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -236,7 +236,6 @@ class ProjectTask extends Shell { $File =& new File($path . 'webroot' . DS . 'test.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { - $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'"; $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', " . $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "');", $contents); if (!$File->write($result)) { return false; From db526ddfb7baf86919090e6b2379828a09d32906 Mon Sep 17 00:00:00 2001 From: ceeram Date: Tue, 10 Nov 2009 09:15:10 +0100 Subject: [PATCH 029/112] Fixing docblock in bootstrap.php, adding missing quote. refs #280 Signed-off-by: Mark Story --- app/config/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/bootstrap.php b/app/config/bootstrap.php index 861972966..40f33296c 100644 --- a/app/config/bootstrap.php +++ b/app/config/bootstrap.php @@ -29,7 +29,7 @@ * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), - * 'controllers' => array(/full/path/to/controllers/', '/next/full/path/to/controllers/'), + * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), From 63ee8f0fcdf1903851a6a90c11b15383aa042079 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 10 Nov 2009 21:20:39 -0500 Subject: [PATCH 030/112] Starting pass through validation handling. Implemented phone, and postal pass throughs. Adding tests. --- cake/libs/validation.php | 38 +++++++++++++++++++++-- cake/tests/cases/libs/validation.test.php | 34 ++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 643cf3d1c..8f5c59694 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -672,12 +672,16 @@ class Validation extends Object { if (is_null($_this->regex)) { switch ($_this->country) { case 'us': + case 'all': + case 'can': // includes all NANPA members. see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories - default: $_this->regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/'; break; } } + if (empty($_this->regex)) { + return $_this->_pass('phone', $check, $country); + } return $_this->_check(); } @@ -698,6 +702,9 @@ class Validation extends Object { if (is_array($check)) { $_this->_extract($check); } + if (empty($country)) { + $_this->country = 'us'; + } if (is_null($_this->regex)) { switch ($_this->country) { @@ -715,11 +722,13 @@ class Validation extends Object { $_this->regex = '/^[1-9]{1}[0-9]{3}$/i'; break; case 'us': - default: $_this->regex = '/\\A\\b[0-9]{5}(?:-[0-9]{4})?\\b\\z/i'; break; } } + if (empty($_this->regex)) { + return $_this->_pass('postal', $check, $country); + } return $_this->_check(); } @@ -834,6 +843,31 @@ class Validation extends Object { return call_user_func_array(array(&$object, $method), array($check, $args)); } +/** + * Attempts to pass unhandled Validation locales to a class starting with $classPrefix + * and ending with Validation. For example $classPrefix = 'nl', the class would be + * `NlValidation`. + * + * @param string $method The method to call on the other class. + * @param mixed $check The value to check or an array of parameters for the method to be called. + * @param string $classPrefix The prefix for the class to do the validation. + * @return mixed Return of Passed method, false on failure + * @access protected + **/ + function _pass($method, $check, $classPrefix) { + $className = ucwords($classPrefix) . 'Validation'; + if (!class_exists($className)) { + trigger_error(sprintf(__('Could not find %s class, unable to complete validation.', true), $className), E_USER_WARNING); + return false; + } + if (!method_exists($className, $method)) { + trigger_error(sprintf(__('Method %s does not exist on %s unable to complete validation.', true), $method, $className), E_USER_WARNING); + return false; + } + $check = (array)$check; + return call_user_func_array(array($className, $method), $check); + } + /** * Runs a regular expression match. * diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 768c78991..aafef8988 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -41,6 +41,25 @@ class CustomValidator { } } +/** + * TestNlValidation class + * + * Used to test pass through of Validation + * + * @package cake.tests.cases.libs + */ +class TestNlValidation { +/** + * postal function, for testing postal pass through. + * + * @param string $check + * @return void + */ + function postal($check) { + return true; + } +} + /** * Test Case for Validation Class * @@ -1998,6 +2017,21 @@ class ValidationTest extends CakeTestCase { $this->assertTrue(Validation::postal('13089-3333')); } +/** + * test the pass through calling of an alternate locale with postal() + * + * @return void + **/ + function testPassThroughMethod() { + $this->assertTrue(Validation::postal('text', null, 'testNl')); + + $this->expectError('Could not find AUTOFAILValidation class, unable to complete validation.'); + Validation::postal('text', null, 'AUTOFAIL'); + + $this->expectError('Method phone does not exist on TestNlValidation unable to complete validation.'); + Validation::phone('text', null, 'testNl'); + } + /** * testSsn method * From 47e6f332d7264ddfe3345a5c853e6a59edfc056d Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 10 Nov 2009 23:35:45 -0500 Subject: [PATCH 031/112] Reformatting doc blocks. --- cake/libs/validation.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 8f5c59694..c4d97b6ef 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -213,8 +213,8 @@ class Validation extends Object { * * @param mixed $check credit card number to validate * @param mixed $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit cards - * if an array is used only the values of the array are checked. - * Example: array('amex', 'bankcard', 'maestro') + * if an array is used only the values of the array are checked. + * Example: array('amex', 'bankcard', 'maestro') * @param boolean $deep set to true this will check the Luhn algorithm of the credit card. * @param string $regex A custom regex can also be passed, this will be used instead of the defined regex values * @return boolean Success @@ -608,12 +608,14 @@ class Validation extends Object { /** * Validate a multiple select. * + * Valid Options + * + * - in => provide a list of choices that selections must be made from + * - max => maximun number of non-zero choices that can be made + * - min => minimum number of non-zero choices that can be made + * * @param mixed $check Value to check * @param mixed $options Options for the check. - * Valid options - * in => provide a list of choices that selections must be made from - * max => maximun number of non-zero choices that can be made - * min => minimum number of non-zero choices that can be made * @return boolean Success * @access public */ @@ -792,13 +794,14 @@ class Validation extends Object { * Checks that a value is a valid URL according to http://www.w3.org/Addressing/URL/url-spec.txt * * The regex checks for the following component parts: - * a valid, optional, scheme - * a valid ip address OR - * a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt - * with an optional port number - * an optional valid path - * an optional query string (get parameters) - * an optional fragment (anchor tag) + * + * - a valid, optional, scheme + * - a valid ip address OR + * a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt + * with an optional port number + * - an optional valid path + * - an optional query string (get parameters) + * - an optional fragment (anchor tag) * * @param string $check Value to check * @param boolean $strict Require URL to be prefixed by a valid scheme (one of http(s)/ftp(s)/file/news/gopher) From 61d56cd2754470f1fe6fb834d8600f19c5f092fd Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 11 Nov 2009 09:56:35 -0500 Subject: [PATCH 032/112] Changing order of text in project task. Making ProjectTask::getPrefix silent when interactive = false. Making ProjectTask silent from View task if all or a controller name is provided. --- cake/console/libs/tasks/project.php | 33 ++++++++++++++++++----------- cake/console/libs/tasks/view.php | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 6194fab31..9ed44c6a6 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -281,30 +281,39 @@ class ProjectTask extends Shell { $admin = ''; $prefixes = Configure::read('Routing.prefixes'); if (!empty($prefixes)) { + if ($this->interactive) { + $this->out(); + $this->out(__('You have more than one routing prefix configured', true)); + } if (count($prefixes) == 1) { return $prefixes[0] . '_'; } $options = array(); foreach ($prefixes as $i => $prefix) { $options[] = $i + 1; - $this->out($i + 1 . '. ' . $prefix); + if ($this->interactive) { + $this->out($i + 1 . '. ' . $prefix); + } } $selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1); return $prefixes[$selection - 1] . '_'; } - - $this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'); - $this->out(__('What would you like the prefix route to be?', true)); - $this->out(__('Example: www.example.com/admin/controller', true)); - while ($admin == '') { - $admin = $this->in(__("What would you like the prefix route to be?", true), null, 'admin'); - } - if ($this->cakeAdmin($admin) !== true) { - $this->out(__('Unable to write to /app/config/core.php.', true)); + if ($this->interactive) { + $this->hr(); $this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'); - $this->_stop(); + $this->out(__('What would you like the prefix route to be?', true)); + $this->out(__('Example: www.example.com/admin/controller', true)); + while ($admin == '') { + $admin = $this->in(__("Enter a routing prefix:", true), null, 'admin'); + } + if ($this->cakeAdmin($admin) !== true) { + $this->out(__('Unable to write to /app/config/core.php.', true)); + $this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'); + $this->_stop(); + } + return $admin . '_'; } - return $admin . '_'; + return ''; } /** diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 1bad40f5a..e330775b2 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -112,6 +112,7 @@ class ViewTask extends Shell { $this->controllerName = Inflector::camelize($this->args[0]); $this->controllerPath = Inflector::underscore($this->controllerName); + $this->Project->interactive = false; if (strtolower($this->args[0]) == 'all') { return $this->all(); } From 8cab87fd8e8f8a7b18877063671d4058b6ed7b24 Mon Sep 17 00:00:00 2001 From: "renan.saddam" Date: Wed, 11 Nov 2009 20:14:24 -0200 Subject: [PATCH 033/112] Fixing fixtures path when using a fixture inside a plugin. --- cake/tests/lib/cake_test_case.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index b290778ce..55f9dd4c0 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -765,11 +765,10 @@ class CakeTestCase extends UnitTestCase { $pluginName = $parts[1]; $fixture = $parts[2]; $fixturePaths = array( - APP . 'plugins' . DS . $pluginName . DS . 'tests' . DS . 'fixtures', + App::pluginPath($pluginName) . 'tests' . DS . 'fixtures', TESTS . 'fixtures', VENDORS . 'tests' . DS . 'fixtures' ); - $fixturesPaths[0] = App::pluginPath($pluginName) . DS . 'tests' . DS . 'fixtures'; } else { $fixturePaths = array( TESTS . 'fixtures', From 2ea6047c80b556614d131facb98c59f26e0cae35 Mon Sep 17 00:00:00 2001 From: slunicko Date: Thu, 12 Nov 2009 05:03:57 +0100 Subject: [PATCH 034/112] Fixing deprecated Routing.admin usage in config/core.php --- app/config/core.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/config/core.php b/app/config/core.php index 1f5751f23..dde3ee4b2 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -72,15 +72,15 @@ /** * Uncomment the define below to use CakePHP admin routes. * - * The value of the define determines the name of the route - * and its associated controller actions: + * The value of the define determines the names of the routes + * and their associated controller actions: * * 'admin' -> admin_index() and /admin/controller/index * 'superuser' -> superuser_index() and /superuser/controller/index * * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ - //Configure::write('Routing.admin', 'admin'); + //Configure::write('Routing.prefixes', array('admin')); /** * Uncomment the define below to use CakePHP prefix routes. From 38f578199de3ff6b6debbe8c17d73762354fd6d0 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 12 Nov 2009 09:32:45 -0500 Subject: [PATCH 035/112] Changing new Model() for ClassRegistry::init(). Fixes issues when baking admin and non-admin methods for a controller that uses bound translations + TranslateBehavior. Fixes #245 --- cake/console/libs/tasks/controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index efc363106..c49735ed8 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -252,7 +252,7 @@ class ControllerTask extends Shell { exit; } $actions = null; - $modelObj =& new $currentModelName(); + $modelObj =& ClassRegistry::init($currentModelName); $controllerPath = $this->_controllerPath($controllerName); $pluralName = $this->_pluralName($currentModelName); $singularName = Inflector::variable($currentModelName); From 1c8a2f232bbe66cce3d0915b7f91d5b1ad16b100 Mon Sep 17 00:00:00 2001 From: nate Date: Thu, 10 Sep 2009 09:28:55 -0400 Subject: [PATCH 036/112] Changes Model::find() to allow modification of DataSource connection during callbacks. --- cake/libs/model/model.php | 4 +++- cake/tests/cases/libs/model/model_read.test.php | 17 +++++++++++++++++ cake/tests/cases/libs/model/models.php | 12 ++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index 84b096fbe..4f1934def 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1948,7 +1948,6 @@ class Model extends Overloadable { list($type, $query) = array($conditions, $fields); } - $db =& ConnectionManager::getDataSource($this->useDbConfig); $this->findQueryType = $type; $this->id = $this->getID(); @@ -1995,6 +1994,9 @@ class Model extends Overloadable { } } + if (!$db =& ConnectionManager::getDataSource($this->useDbConfig)) { + return false; + } $results = $db->read($this, $query); $this->resetAssociations(); $this->findQueryType = null; diff --git a/cake/tests/cases/libs/model/model_read.test.php b/cake/tests/cases/libs/model/model_read.test.php index eec0cfe70..74def2ae4 100644 --- a/cake/tests/cases/libs/model/model_read.test.php +++ b/cake/tests/cases/libs/model/model_read.test.php @@ -4899,6 +4899,23 @@ class ModelReadTest extends BaseModelTest { $expected = array('mariano', 'nate', 'larry', 'garrett'); $this->assertEqual($result, $expected); } + + /** + * Tests that the database configuration assigned to the model can be changed using + * (before|after)Find callbacks + * + * @return void + */ + function testCallbackSourceChange() { + $this->loadFixtures('Post'); + $TestModel = new Post(); + $this->assertEqual(3, count($TestModel->find('all'))); + + $this->expectError(new PatternExpectation('/Non-existent data source foo/i')); + $this->expectError(new PatternExpectation('/Only variable references/i')); + $this->assertFalse($TestModel->find('all', array('connection' => 'foo'))); + } + /** * testMultipleBelongsToWithSameClass method * diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index f601b82aa..086eda794 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -763,6 +763,18 @@ class Post extends CakeTestModel { * @access public */ var $belongsTo = array('Author'); + + function beforeFind($queryData) { + if (isset($queryData['connection'])) { + $this->useDbConfig = $queryData['connection']; + } + return true; + } + + function afterFind($results) { + $this->useDbConfig = 'test_suite'; + return $results; + } } /** * Author class From 2c5fa171e0aced91a2e47378507ad46ef981f790 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 00:43:40 -0500 Subject: [PATCH 037/112] Updating CakeSchema to pass a Model object into DboSource::fullTableName(); Fixes schema's not correctly reading tablePrefixes. Fixes #290 --- cake/libs/model/cake_schema.php | 2 +- cake/tests/cases/libs/model/cake_schema.test.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 28008cbd2..989a529f0 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -245,7 +245,7 @@ class CakeSchema extends Object { if (is_object($Object) && $Object->useTable !== false) { $Object->setDataSource($connection); - $table = $db->fullTableName($Object->useTable, false); + $table = $db->fullTableName($Object, false); if (in_array($table, $currentTables)) { $key = array_search($table, $currentTables); diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 7b00d7b39..0a2dac13a 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -457,8 +457,17 @@ class CakeSchemaTest extends CakeTestCase { ConnectionManager::create('schema_prefix', $config); $read = $this->Schema->read(array('connection' => 'schema_prefix', 'models' => false)); $this->assertTrue(empty($read['tables'])); - } + $SchemaPost =& ClassRegistry::init('SchemaPost'); + $SchemaPost->table = 'sts'; + $SchemaPost->tablePrefix = 'po'; + $read = $this->Schema->read(array( + 'connection' => 'test_suite', + 'name' => 'TestApp', + 'models' => array('SchemaPost') + )); + $this->assertFalse(isset($read['tables']['missing']['posts']), 'Posts table was not read from tablePrefix %s'); + } /** * test reading schema from plugins. * From 13f9b79dc92fc81fa1dfc83c0e694c0a4c03bf25 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 09:15:31 -0500 Subject: [PATCH 038/112] Removing console/libs/templates. Has been moved in 1.3 and a merge with 1.2 added it again. --- cake/console/libs/templates/skel/views/layouts/xml/default.ctp | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 cake/console/libs/templates/skel/views/layouts/xml/default.ctp diff --git a/cake/console/libs/templates/skel/views/layouts/xml/default.ctp b/cake/console/libs/templates/skel/views/layouts/xml/default.ctp deleted file mode 100644 index 566ca2158..000000000 --- a/cake/console/libs/templates/skel/views/layouts/xml/default.ctp +++ /dev/null @@ -1,2 +0,0 @@ -header(); ?> - \ No newline at end of file From ea482442ffa046117b9e6d49cad2c99ce7d643b6 Mon Sep 17 00:00:00 2001 From: ceeram Date: Fri, 13 Nov 2009 14:23:33 +0100 Subject: [PATCH 039/112] test to prove ticket #291 Signed-off-by: Mark Story --- cake/tests/cases/libs/inflector.test.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cake/tests/cases/libs/inflector.test.php b/cake/tests/cases/libs/inflector.test.php index 2c293bb53..3823dbc72 100644 --- a/cake/tests/cases/libs/inflector.test.php +++ b/cake/tests/cases/libs/inflector.test.php @@ -109,6 +109,7 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::singularize('faxes'), 'fax'); $this->assertEqual(Inflector::singularize('waxes'), 'wax'); $this->assertEqual(Inflector::singularize('waves'), 'wave'); + $this->assertEqual(Inflector::singularize('bureaus'), 'bureau'); $this->assertEqual(Inflector::singularize(''), ''); } /** @@ -153,6 +154,7 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::pluralize('glove'), 'gloves'); $this->assertEqual(Inflector::pluralize('crisis'), 'crises'); $this->assertEqual(Inflector::pluralize('wave'), 'waves'); + $this->assertEqual(Inflector::pluralize('bureau'), 'bureaus'); $this->assertEqual(Inflector::pluralize(''), ''); } /** @@ -228,6 +230,7 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::classify('artists_genres'), 'ArtistsGenre'); $this->assertEqual(Inflector::classify('file_systems'), 'FileSystem'); $this->assertEqual(Inflector::classify('news'), 'News'); + $this->assertEqual(Inflector::classify('bureaus'), 'Bureau'); } /** * testTableNaming method @@ -239,6 +242,7 @@ class InflectorTest extends CakeTestCase { $this->assertEqual(Inflector::tableize('ArtistsGenre'), 'artists_genres'); $this->assertEqual(Inflector::tableize('FileSystem'), 'file_systems'); $this->assertEqual(Inflector::tableize('News'), 'news'); + $this->assertEqual(Inflector::tableize('Bureau'), 'bureaus'); } /** * testHumanization method From a67a97722a40283f0f3a430fdf0ac12ac095b4c3 Mon Sep 17 00:00:00 2001 From: ceeram Date: Fri, 13 Nov 2009 14:36:33 +0100 Subject: [PATCH 040/112] refs #291 Signed-off-by: Mark Story --- cake/libs/inflector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 71f07b4e3..863072dfd 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -305,6 +305,7 @@ class Inflector extends Object { '/(m)en$/i' => '\1an', '/(c)hildren$/i' => '\1\2hild', '/(n)ews$/i' => '\1\2ews', + '/eaus$/' => 'eau', '/^(.*us)$/' => '\\1', '/s$/i' => ''); From d302ed1bfa86fe24a1c441c50a790ee4c364fd49 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 09:44:51 -0500 Subject: [PATCH 041/112] Fixing comment block formatting. --- cake/tests/cases/libs/model/model_read.test.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cake/tests/cases/libs/model/model_read.test.php b/cake/tests/cases/libs/model/model_read.test.php index 74def2ae4..2a183d159 100644 --- a/cake/tests/cases/libs/model/model_read.test.php +++ b/cake/tests/cases/libs/model/model_read.test.php @@ -4899,13 +4899,12 @@ class ModelReadTest extends BaseModelTest { $expected = array('mariano', 'nate', 'larry', 'garrett'); $this->assertEqual($result, $expected); } - - /** - * Tests that the database configuration assigned to the model can be changed using - * (before|after)Find callbacks - * - * @return void - */ +/** + * Tests that the database configuration assigned to the model can be changed using + * (before|after)Find callbacks + * + * @return void + */ function testCallbackSourceChange() { $this->loadFixtures('Post'); $TestModel = new Post(); @@ -4915,7 +4914,6 @@ class ModelReadTest extends BaseModelTest { $this->expectError(new PatternExpectation('/Only variable references/i')); $this->assertFalse($TestModel->find('all', array('connection' => 'foo'))); } - /** * testMultipleBelongsToWithSameClass method * From 8d407ac9152e587347457461487bf7e0a7ee0012 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 09:45:25 -0500 Subject: [PATCH 042/112] Adding test to form helper to increase code coverage. --- cake/tests/cases/libs/view/helpers/form.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index a0241322f..c1d90823a 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -4633,6 +4633,21 @@ class FormHelperTest extends CakeTestCase { '/fieldset' ); $this->assertTags($result, $expected); + + $this->Form->data = array(); + $this->Form->params['controller'] = 'contacts'; + $this->Form->params['models'] = array('Contact'); + $result = $this->Form->create(array('url' => array('action' => 'index', 'param'))); + $expected = array( + 'form' => array( + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param' + ), + 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), + '/fieldset' + ); + $this->assertTags($result, $expected); + } /** * Test base form url when url param is passed with multiple parameters (&) From bfde6b81fefd882f7bec8c365dbb4bbf8cb320fb Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 09:45:25 -0500 Subject: [PATCH 043/112] Adding test to form helper to increase code coverage. --- cake/tests/cases/libs/view/helpers/form.test.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 471573250..81a8b032a 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -5049,6 +5049,21 @@ class FormHelperTest extends CakeTestCase { '/fieldset' ); $this->assertTags($result, $expected); + + $this->Form->data = array(); + $this->Form->params['controller'] = 'contacts'; + $this->Form->params['models'] = array('Contact'); + $result = $this->Form->create(array('url' => array('action' => 'index', 'param'))); + $expected = array( + 'form' => array( + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param' + ), + 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), + '/fieldset' + ); + $this->assertTags($result, $expected); + } /** From d93c94f70249236790adca70b94338e95b2fc4c5 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 09:53:31 -0500 Subject: [PATCH 044/112] Fixing failing test, picked in from 1.2. --- cake/libs/view/helpers/form.php | 3 ++- cake/tests/cases/libs/view/helpers/form.test.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 002f86622..8fb6888cf 100755 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -172,7 +172,8 @@ class FormHelper extends AppHelper { if (is_array($model) && empty($options)) { $options = $model; $model = null; - } elseif (empty($model) && $model !== false && !empty($this->params['models'])) { + } + if (empty($model) && $model !== false && !empty($this->params['models'])) { $model = $this->params['models'][0]; $this->defaultModel = $this->params['models'][0]; } elseif (empty($model) && empty($this->params['models'])) { diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 81a8b032a..2f46d62b5 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -5056,14 +5056,14 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create(array('url' => array('action' => 'index', 'param'))); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param' + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param', + 'accept-charset' => 'utf-8' ), 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), '/fieldset' ); $this->assertTags($result, $expected); - } /** From 360ea2a46a6ee55a1e5cae9a4da567dd69afb862 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 10:24:36 -0500 Subject: [PATCH 045/112] Adding extract task to Console Group test. --- cake/tests/groups/console.group.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cake/tests/groups/console.group.php b/cake/tests/groups/console.group.php index 209ddaca0..4f632fbaf 100644 --- a/cake/tests/groups/console.group.php +++ b/cake/tests/groups/console.group.php @@ -53,16 +53,16 @@ class ConsoleGroupTest extends TestSuite { TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'shell'); $path = CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'tasks' . DS; - + TestManager::addTestFile($this, $path . 'controller'); - TestManager::addTestFile($this, $path . 'model'); - TestManager::addTestFile($this, $path . 'view'); - TestManager::addTestFile($this, $path . 'fixture'); - TestManager::addTestFile($this, $path . 'test'); TestManager::addTestFile($this, $path . 'db_config'); + TestManager::addTestFile($this, $path . 'extract'); + TestManager::addTestFile($this, $path . 'fixture'); + TestManager::addTestFile($this, $path . 'model'); TestManager::addTestFile($this, $path . 'plugin'); TestManager::addTestFile($this, $path . 'project'); - + TestManager::addTestFile($this, $path . 'test'); + TestManager::addTestFile($this, $path . 'view'); } } ?> \ No newline at end of file From ffbd6f5dc81534366b64f09e2c03afb9c6c2de52 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 10:26:57 -0500 Subject: [PATCH 046/112] Removing duplicated section. --- app/config/core.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/config/core.php b/app/config/core.php index dde3ee4b2..3deed81c8 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -70,21 +70,11 @@ //Configure::write('App.baseUrl', env('SCRIPT_NAME')); /** - * Uncomment the define below to use CakePHP admin routes. + * Uncomment the define below to use CakePHP prefix routes. * * The value of the define determines the names of the routes * and their associated controller actions: * - * 'admin' -> admin_index() and /admin/controller/index - * 'superuser' -> superuser_index() and /superuser/controller/index - * - * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] - */ - //Configure::write('Routing.prefixes', array('admin')); - -/** - * Uncomment the define below to use CakePHP prefix routes. - * * Set to an array of prefixes you want to use in your application. Use for * admin or other prefixed routes. * @@ -93,6 +83,8 @@ * Enables: * `admin_index()` and `/admin/controller/index` * `manager_index()` and `/manager/controller/index` + * + * [Note Routing.admin is deprecated in 1.3. Use Routing.prefixes instead] */ //Configure::write('Routing.prefixes', array('admin')); From 9376826aa4232a103494166de1a60a84671c2064 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 13 Nov 2009 14:42:40 -0500 Subject: [PATCH 047/112] Fixing HttpSocket::buildUri when host key is empty. Tests added Fixes #271 --- cake/libs/http_socket.php | 4 ++-- cake/tests/cases/libs/http_socket.test.php | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cake/libs/http_socket.php b/cake/libs/http_socket.php index 793618ece..97d2e080b 100644 --- a/cake/libs/http_socket.php +++ b/cake/libs/http_socket.php @@ -564,7 +564,8 @@ class HttpSocket extends CakeSocket { $stripIfEmpty = array( 'query' => '?%query', 'fragment' => '#%fragment', - 'user' => '%user:%pass@' + 'user' => '%user:%pass@', + 'host' => '%host:%port/' ); foreach ($stripIfEmpty as $key => $strip) { @@ -577,7 +578,6 @@ class HttpSocket extends CakeSocket { if (array_key_exists($uri['scheme'], $defaultPorts) && $defaultPorts[$uri['scheme']] == $uri['port']) { $uriTemplate = str_replace(':%port', null, $uriTemplate); } - foreach ($uri as $property => $value) { $uriTemplate = str_replace('%'.$property, $value, $uriTemplate); } diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php index 2dbc193d9..581e1c697 100644 --- a/cake/tests/cases/libs/http_socket.test.php +++ b/cake/tests/cases/libs/http_socket.test.php @@ -925,6 +925,9 @@ class HttpSocketTest extends CakeTestCase { $r = $this->Socket->buildUri(array('host' => 'www.cakephp.org', 'port' => 23)); $this->assertIdentical($r, 'http://www.cakephp.org:23/'); + $r = $this->Socket->buildUri(array('path' => 'www.google.com/search', 'query' => 'q=cakephp')); + $this->assertIdentical($r, 'http://www.google.com/search?q=cakephp'); + $r = $this->Socket->buildUri(array('host' => 'www.cakephp.org', 'scheme' => 'https', 'port' => 79)); $this->assertIdentical($r, 'https://www.cakephp.org:79/'); From 5092262d4d390bddf524f41145b1fcd0815866a9 Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 14 Nov 2009 23:18:31 +1100 Subject: [PATCH 048/112] Reformatting and adding missing documentation blocks. --- cake/tests/cases/console/cake.test.php | 38 ++-- cake/tests/cases/console/libs/acl.test.php | 47 +++-- cake/tests/cases/console/libs/api.test.php | 2 +- cake/tests/cases/console/libs/bake.test.php | 15 +- cake/tests/cases/console/libs/schema.test.php | 47 +++-- cake/tests/cases/console/libs/shell.test.php | 8 +- .../console/libs/tasks/controller.test.php | 51 +++-- .../console/libs/tasks/db_config.test.php | 9 +- .../cases/console/libs/tasks/fixture.test.php | 36 ++-- .../cases/console/libs/tasks/model.test.php | 80 ++++--- .../cases/console/libs/tasks/plugin.test.php | 18 +- .../cases/console/libs/tasks/project.test.php | 24 ++- .../console/libs/tasks/template.test.php | 15 +- .../cases/console/libs/tasks/test.test.php | 198 +++++++++++++++--- .../cases/console/libs/tasks/view.test.php | 186 ++++++++++++++-- 15 files changed, 591 insertions(+), 183 deletions(-) diff --git a/cake/tests/cases/console/cake.test.php b/cake/tests/cases/console/cake.test.php index ffec66489..317afe851 100644 --- a/cake/tests/cases/console/cake.test.php +++ b/cake/tests/cases/console/cake.test.php @@ -83,8 +83,8 @@ class TestShellDispatcher extends ShellDispatcher { /** * _initEnvironment method * - * @access protected * @return void + * @access protected */ function _initEnvironment() { } @@ -92,8 +92,8 @@ class TestShellDispatcher extends ShellDispatcher { /** * stderr method * - * @access public * @return void + * @access public */ function stderr($string) { $this->stderr .= rtrim($string, ' '); @@ -102,8 +102,8 @@ class TestShellDispatcher extends ShellDispatcher { /** * stdout method * - * @access public * @return void + * @access public */ function stdout($string, $newline = true) { if ($newline) { @@ -116,8 +116,8 @@ class TestShellDispatcher extends ShellDispatcher { /** * clear method * - * @access public * @return void + * @access public */ function clear() { @@ -126,8 +126,8 @@ class TestShellDispatcher extends ShellDispatcher { /** * _stop method * - * @access protected * @return void + * @access protected */ function _stop($status = 0) { $this->stopped = 'Stopped with status: ' . $status; @@ -138,8 +138,8 @@ class TestShellDispatcher extends ShellDispatcher { * getShell * * @param mixed $plugin - * @access public * @return mixed + * @access public */ function getShell($plugin = null) { return $this->_getShell($plugin); @@ -149,8 +149,8 @@ class TestShellDispatcher extends ShellDispatcher { * _getShell * * @param mixed $plugin - * @access protected * @return mixed + * @access protected */ function _getShell($plugin = null) { if (isset($this->TestShell)) { @@ -171,8 +171,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * setUp method * - * @access public * @return void + * @access public */ function setUp() { App::build(array( @@ -189,8 +189,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * tearDown method * - * @access public * @return void + * @access public */ function tearDown() { App::build(); @@ -199,8 +199,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * testParseParams method * - * @access public * @return void + * @access public */ function testParseParams() { $Dispatcher =& new TestShellDispatcher(); @@ -458,8 +458,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * testBuildPaths method * - * @access public * @return void + * @access public */ function testBuildPaths() { $Dispatcher =& new TestShellDispatcher(); @@ -481,8 +481,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify loading of (plugin-) shells * - * @access public * @return void + * @access public */ function testGetShell() { $this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded'); @@ -510,8 +510,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify correct dispatch of Shell subclasses with a main method * - * @access public * @return void + * @access public */ function testDispatchShellWithMain() { Mock::generate('Shell', 'MockWithMainShell', array('main', '_secret')); @@ -601,8 +601,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify correct dispatch of Shell subclasses without a main method * - * @access public * @return void + * @access public */ function testDispatchShellWithoutMain() { Mock::generate('Shell', 'MockWithoutMainShell', array('initDb', '_secret')); @@ -673,8 +673,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify correct dispatch of custom classes with a main method * - * @access public * @return void + * @access public */ function testDispatchNotAShellWithMain() { Mock::generate('Object', 'MockWithMainNotAShell', @@ -753,8 +753,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify correct dispatch of custom classes without a main method * - * @access public * @return void + * @access public */ function testDispatchNotAShellWithoutMain() { Mock::generate('Object', 'MockWithoutMainNotAShell', @@ -824,8 +824,8 @@ class ShellDispatcherTest extends CakeTestCase { * Verify that a task is called instead of the shell if the first arg equals * the name of the task * - * @access public * @return void + * @access public */ function testDispatchTask() { Mock::generate('Shell', 'MockWeekShell', array('main')); @@ -872,8 +872,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * Verify shifting of arguments * - * @access public * @return void + * @access public */ function testShiftArgs() { $Dispatcher =& new TestShellDispatcher(); @@ -902,8 +902,8 @@ class ShellDispatcherTest extends CakeTestCase { /** * testHelpCommand method * - * @access public * @return void + * @access public */ function testHelpCommand() { $Dispatcher =& new TestShellDispatcher(); diff --git a/cake/tests/cases/console/libs/acl.test.php b/cake/tests/cases/console/libs/acl.test.php index d94e4a5bc..deb23daeb 100644 --- a/cake/tests/cases/console/libs/acl.test.php +++ b/cake/tests/cases/console/libs/acl.test.php @@ -52,13 +52,21 @@ Mock::generate('AclComponent', 'MockAclShellAclComponent'); * @subpackage cake.tests.cases.console.libs.tasks */ class AclShellTest extends CakeTestCase { + +/** + * Fixtures + * + * @var array + * @access public + */ var $fixtures = array('core.aco', 'core.aro', 'core.aros_aco'); /** * configure Configure for testcase * * @return void - **/ + * @access public + */ function startCase() { $this->_aclDb = Configure::read('Acl.database'); $this->_aclClass = Configure::read('Acl.classname'); @@ -71,7 +79,8 @@ class AclShellTest extends CakeTestCase { * restore Environment settings * * @return void - **/ + * @access public + */ function endCase() { Configure::write('Acl.database', $this->_aclDb); Configure::write('Acl.classname', $this->_aclClass); @@ -107,7 +116,8 @@ class AclShellTest extends CakeTestCase { * test that model.foreign_key output works when looking at acl rows * * @return void - **/ + * @access public + */ function testViewWithModelForeignKeyOutput() { $this->Task->command = 'view'; $this->Task->startup(); @@ -132,7 +142,8 @@ class AclShellTest extends CakeTestCase { * test view with an argument * * @return void - **/ + * @access public + */ function testViewWithArgument() { $this->Task->args = array('aro', 'admins'); $this->Task->expectAt(0, 'out', array('Aro tree:')); @@ -146,7 +157,8 @@ class AclShellTest extends CakeTestCase { * test the method that splits model.foreign key. and that it returns an array. * * @return void - **/ + * @access public + */ function testParsingModelAndForeignKey() { $result = $this->Task->parseIdentifier('Model.foreignKey'); $expected = array('model' => 'Model', 'foreign_key' => 'foreignKey'); @@ -162,7 +174,8 @@ class AclShellTest extends CakeTestCase { * test creating aro/aco nodes * * @return void - **/ + * @access public + */ function testCreate() { $this->Task->args = array('aro', 'root', 'User.1'); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*')); @@ -202,7 +215,8 @@ class AclShellTest extends CakeTestCase { * test the delete method with different node types. * * @return void - **/ + * @access public + */ function testDelete() { $this->Task->args = array('aro', 'AuthUser.1'); $this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true)); @@ -217,7 +231,8 @@ class AclShellTest extends CakeTestCase { * test setParent method. * * @return void - **/ + * @access public + */ function testSetParent() { $this->Task->args = array('aro', 'AuthUser.2', 'root'); $this->Task->setParent(); @@ -231,7 +246,8 @@ class AclShellTest extends CakeTestCase { * test grant * * @return void - **/ + * @access public + */ function testGrant() { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true)); @@ -246,7 +262,8 @@ class AclShellTest extends CakeTestCase { * test deny * * @return void - **/ + * @access public + */ function testDeny() { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission denied/'), true)); @@ -261,7 +278,8 @@ class AclShellTest extends CakeTestCase { * test checking allowed and denied perms * * @return void - **/ + * @access public + */ function testCheck() { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', '*'); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/not allowed/'), true)); @@ -284,7 +302,8 @@ class AclShellTest extends CakeTestCase { * test inherit and that it 0's the permission fields. * * @return void - **/ + * @access public + */ function testInherit() { $this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create'); $this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true)); @@ -303,7 +322,8 @@ class AclShellTest extends CakeTestCase { * test getting the path for an aro/aco * * @return void - **/ + * @access public + */ function testGetPath() { $this->Task->args = array('aro', 'AuthUser.2'); $this->Task->expectAt(1, 'out', array('[1] ROOT')); @@ -311,6 +331,5 @@ class AclShellTest extends CakeTestCase { $this->Task->expectAt(3, 'out', array(' [4] Elrond')); $this->Task->getPath(); } - } ?> \ No newline at end of file diff --git a/cake/tests/cases/console/libs/api.test.php b/cake/tests/cases/console/libs/api.test.php index f14f51a33..efb216581 100644 --- a/cake/tests/cases/console/libs/api.test.php +++ b/cake/tests/cases/console/libs/api.test.php @@ -76,8 +76,8 @@ class ApiShellTest extends CakeTestCase { /** * Test that method names are detected properly including those with no arguments. * - * @access public * @return void + * @access public */ function testMethodNameDetection () { $this->Shell->setReturnValueAt(0, 'in', 'q'); diff --git a/cake/tests/cases/console/libs/bake.test.php b/cake/tests/cases/console/libs/bake.test.php index cdd42cf39..831456adf 100644 --- a/cake/tests/cases/console/libs/bake.test.php +++ b/cake/tests/cases/console/libs/bake.test.php @@ -61,14 +61,16 @@ class BakeShellTestCase extends CakeTestCase { * fixtures * * @var array - **/ + * @access public + */ var $fixtures = array('core.user'); /** * start test * * @return void - **/ + * @access public + */ function startTest() { $this->Dispatch =& new BakeShellMockShellDispatcher(); $this->Shell =& new MockBakeShell(); @@ -80,7 +82,8 @@ class BakeShellTestCase extends CakeTestCase { * endTest method * * @return void - **/ + * @access public + */ function endTest() { unset($this->Dispatch, $this->Shell); } @@ -89,7 +92,8 @@ class BakeShellTestCase extends CakeTestCase { * test bake all * * @return void - **/ + * @access public + */ function testAllWithModelName() { $this->Shell->Model =& new BakeShellMockModelTask(); $this->Shell->Controller =& new BakeShellMockControllerTask(); @@ -118,4 +122,5 @@ class BakeShellTestCase extends CakeTestCase { $this->Shell->args = array('User'); $this->Shell->all(); } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/cake/tests/cases/console/libs/schema.test.php b/cake/tests/cases/console/libs/schema.test.php index 8f7ffd7fa..898b21208 100644 --- a/cake/tests/cases/console/libs/schema.test.php +++ b/cake/tests/cases/console/libs/schema.test.php @@ -115,7 +115,14 @@ class SchemaShellTestSchema extends CakeSchema { */ class SchemaShellTest extends CakeTestCase { +/** + * Fixtures + * + * @var array + * @access public + */ var $fixtures = array('core.article', 'core.user', 'core.post', 'core.auth_user'); + /** * startTest method * @@ -142,7 +149,8 @@ class SchemaShellTest extends CakeTestCase { * test startup method * * @return void - **/ + * @access public + */ function testStartup() { $this->Shell->startup(); $this->assertTrue(isset($this->Shell->Schema)); @@ -177,7 +185,8 @@ class SchemaShellTest extends CakeTestCase { * Test View - and that it dumps the schema file to stdout * * @return void - **/ + * @access public + */ function testView() { $this->Shell->startup(); $this->Shell->Schema->path = APP . 'config' . DS . 'schema'; @@ -191,7 +200,8 @@ class SchemaShellTest extends CakeTestCase { * test that view() can find plugin schema files. * * @return void - **/ + * @access public + */ function testViewWithPlugins() { App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) @@ -214,7 +224,8 @@ class SchemaShellTest extends CakeTestCase { * test dump() with sql file generation * * @return void - **/ + * @access public + */ function testDumpWithFileWriting() { $this->Shell->params = array( 'name' => 'i18n', @@ -242,7 +253,8 @@ class SchemaShellTest extends CakeTestCase { * test that dump() can find and work with plugin schema files. * * @return void - **/ + * @access public + */ function testDumpFileWritingWithPlugins() { App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) @@ -271,6 +283,7 @@ class SchemaShellTest extends CakeTestCase { * test generate with snapshot generation * * @return void + * @access public */ function testGenerateSnaphot() { $this->Shell->path = TMP; @@ -290,7 +303,8 @@ class SchemaShellTest extends CakeTestCase { * test generate without a snapshot. * * @return void - **/ + * @access public + */ function testGenerateNoOverwrite() { touch(TMP . 'schema.php'); $this->Shell->params['file'] = 'schema.php'; @@ -309,7 +323,8 @@ class SchemaShellTest extends CakeTestCase { * test generate with overwriting of the schema files. * * @return void - **/ + * @access public + */ function testGenerateOverwrite() { touch(TMP . 'schema.php'); $this->Shell->params['file'] = 'schema.php'; @@ -334,7 +349,8 @@ class SchemaShellTest extends CakeTestCase { * in a plugin. * * @return void - **/ + * @access public + */ function testGenerateWithPlugins() { App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) @@ -363,7 +379,8 @@ class SchemaShellTest extends CakeTestCase { * Test schema run create with no table args. * * @return void - **/ + * @access public + */ function testCreateNoArgs() { $this->Shell->params = array( 'connection' => 'test_suite', @@ -386,7 +403,8 @@ class SchemaShellTest extends CakeTestCase { * Test schema run create with no table args. * * @return void - **/ + * @access public + */ function testCreateWithTableArgs() { $this->Shell->params = array( 'connection' => 'test_suite', @@ -411,7 +429,8 @@ class SchemaShellTest extends CakeTestCase { * test run update with a table arg. * * @return void - **/ + * @access public + */ function testUpdateWithTable() { $this->Shell->params = array( 'connection' => 'test_suite', @@ -434,7 +453,8 @@ class SchemaShellTest extends CakeTestCase { * test that the plugin param creates the correct path in the schema object. * * @return void - **/ + * @access public + */ function testPluginParam() { App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) @@ -454,7 +474,8 @@ class SchemaShellTest extends CakeTestCase { * test that using Plugin.name with write. * * @return void - **/ + * @access public + */ function testPluginDotSyntaxWithCreate() { App::build(array( 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) diff --git a/cake/tests/cases/console/libs/shell.test.php b/cake/tests/cases/console/libs/shell.test.php index f47bceac3..707a04779 100644 --- a/cake/tests/cases/console/libs/shell.test.php +++ b/cake/tests/cases/console/libs/shell.test.php @@ -46,7 +46,7 @@ Mock::generatePartial('ShellDispatcher', 'TestShellMockShellDispatcher', array( */ class TestShell extends Shell { -/* +/** * name property * * @var name @@ -257,8 +257,8 @@ class ShellTest extends CakeTestCase { /** * testNl * - * @access public * @return void + * @access public */ function testNl() { $this->assertEqual($this->Shell->nl(), "\n"); @@ -271,8 +271,8 @@ class ShellTest extends CakeTestCase { /** * testHr * - * @access public * @return void + * @access public */ function testHr() { $bar = '---------------------------------------------------------------'; @@ -296,8 +296,8 @@ class ShellTest extends CakeTestCase { /** * testError * - * @access public * @return void + * @access public */ function testError() { $this->Shell->Dispatch->expectAt(0, 'stderr', array("Error: Foo Not Found\n")); diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 5b29fc7cc..0a40bb229 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -88,7 +88,8 @@ class ControllerTaskTest extends CakeTestCase { * fixtures * * @var array - **/ + * @access public + */ var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); /** @@ -124,7 +125,8 @@ class ControllerTaskTest extends CakeTestCase { * test ListAll * * @return void - **/ + * @access public + */ function testListAll() { $this->Task->connection = 'test_suite'; $this->Task->interactive = true; @@ -153,7 +155,8 @@ class ControllerTaskTest extends CakeTestCase { * Test that getName interacts with the user and returns the controller name. * * @return void - **/ + * @access public + */ function testGetName() { $this->Task->setReturnValue('in', 1); @@ -180,7 +183,8 @@ class ControllerTaskTest extends CakeTestCase { * test helper interactions * * @return void - **/ + * @access public + */ function testDoHelpers() { $this->Task->setReturnValue('in', 'n'); $result = $this->Task->doHelpers(); @@ -203,7 +207,8 @@ class ControllerTaskTest extends CakeTestCase { * test component interactions * * @return void - **/ + * @access public + */ function testDoComponents() { $this->Task->setReturnValue('in', 'n'); $result = $this->Task->doComponents(); @@ -226,7 +231,8 @@ class ControllerTaskTest extends CakeTestCase { * test Confirming controller user interaction * * @return void - **/ + * @access public + */ function testConfirmController() { $controller = 'Posts'; $scaffold = false; @@ -244,7 +250,8 @@ class ControllerTaskTest extends CakeTestCase { * test the bake method * * @return void - **/ + * @access public + */ function testBake() { $helpers = array('Ajax', 'Time'); $components = array('Acl', 'Auth'); @@ -267,7 +274,8 @@ class ControllerTaskTest extends CakeTestCase { * test bake() with a -plugin param * * @return void - **/ + * @access public + */ function testBakeWithPlugin() { $this->Task->plugin = 'ControllerTest'; $helpers = array('Ajax', 'Time'); @@ -289,7 +297,8 @@ class ControllerTaskTest extends CakeTestCase { * test that bakeActions is creating the correct controller Code. (Using sessions) * * @return void - **/ + * @access public + */ function testBakeActionsUsingSessions() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s'); @@ -332,7 +341,8 @@ class ControllerTaskTest extends CakeTestCase { * Test baking with Controller::flash() or no sessions. * * @return void - **/ + * @access public + */ function testBakeActionsWithNoSessions() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s'); @@ -367,7 +377,8 @@ class ControllerTaskTest extends CakeTestCase { * test baking a test * * @return void - **/ + * @access public + */ function testBakeTest() { $this->Task->plugin = 'ControllerTest'; $this->Task->connection = 'test_suite'; @@ -383,7 +394,8 @@ class ControllerTaskTest extends CakeTestCase { * test Interactive mode. * * @return void - **/ + * @access public + */ function testInteractive() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path'; @@ -407,7 +419,8 @@ class ControllerTaskTest extends CakeTestCase { * test that execute runs all when the first arg == all * * @return void - **/ + * @access public + */ function testExecuteIntoAll() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s'); @@ -432,7 +445,8 @@ class ControllerTaskTest extends CakeTestCase { * test that `cake bake controller foos` works. * * @return void - **/ + * @access public + */ function testExecuteWithController() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); @@ -455,7 +469,8 @@ class ControllerTaskTest extends CakeTestCase { * test that `cake bake controller foo scaffold` works. * * @return void - **/ + * @access public + */ function testExecuteWithPublicParam() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); @@ -478,7 +493,8 @@ class ControllerTaskTest extends CakeTestCase { * test that `cake bake controller foos both` works. * * @return void - **/ + * @access public + */ function testExecuteWithControllerAndBoth() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); @@ -502,7 +518,8 @@ class ControllerTaskTest extends CakeTestCase { * test that `cake bake controller foos admin` works. * * @return void - **/ + * @access public + */ function testExecuteWithControllerAndAdmin() { $skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'), 'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s'); diff --git a/cake/tests/cases/console/libs/tasks/db_config.test.php b/cake/tests/cases/console/libs/tasks/db_config.test.php index a637c8403..e28554955 100644 --- a/cake/tests/cases/console/libs/tasks/db_config.test.php +++ b/cake/tests/cases/console/libs/tasks/db_config.test.php @@ -104,7 +104,8 @@ class DbConfigTaskTest extends CakeTestCase { * Test the getConfig method. * * @return void - **/ + * @access public + */ function testGetConfig() { $this->Task->setReturnValueAt(0, 'in', 'otherOne'); $result = $this->Task->getConfig(); @@ -115,7 +116,8 @@ class DbConfigTaskTest extends CakeTestCase { * test that initialize sets the path up. * * @return void - **/ + * @access public + */ function testInitialize() { $this->assertTrue(empty($this->Task->path)); $this->Task->initialize(); @@ -128,7 +130,8 @@ class DbConfigTaskTest extends CakeTestCase { * test execute and by extension __interactive * * @return void - **/ + * @access public + */ function testExecuteIntoInteractive() { $this->Task->initialize(); diff --git a/cake/tests/cases/console/libs/tasks/fixture.test.php b/cake/tests/cases/console/libs/tasks/fixture.test.php index 926758d19..65678cbd4 100644 --- a/cake/tests/cases/console/libs/tasks/fixture.test.php +++ b/cake/tests/cases/console/libs/tasks/fixture.test.php @@ -60,7 +60,8 @@ class FixtureTaskTest extends CakeTestCase { * fixtures * * @var array - **/ + * @access public + */ var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test'); /** @@ -94,7 +95,8 @@ class FixtureTaskTest extends CakeTestCase { * test that initialize sets the path * * @return void - **/ + * @access public + */ function testConstruct() { $this->Dispatch->params['working'] = DS . 'my' . DS . 'path'; $Task =& new FixtureTask($this->Dispatch); @@ -107,7 +109,8 @@ class FixtureTaskTest extends CakeTestCase { * test import option array generation * * @return void - **/ + * @access public + */ function testImportOptions() { $this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'y'); @@ -136,7 +139,8 @@ class FixtureTaskTest extends CakeTestCase { * test generating a fixture with database conditions. * * @return void - **/ + * @access public + */ function testImportRecordsFromDatabaseWithConditions() { $this->Task->setReturnValueAt(0, 'in', 'WHERE 1=1 LIMIT 10'); $this->Task->connection = 'test_suite'; @@ -155,7 +159,8 @@ class FixtureTaskTest extends CakeTestCase { * test that execute passes runs bake depending with named model. * * @return void - **/ + * @access public + */ function testExecuteWithNamedModel() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -169,7 +174,8 @@ class FixtureTaskTest extends CakeTestCase { * test that execute runs all() when args[0] = all * * @return void - **/ + * @access public + */ function testExecuteIntoAll() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -189,7 +195,8 @@ class FixtureTaskTest extends CakeTestCase { * test using all() with -count and -records * * @return void - **/ + * @access public + */ function testAllWithCountAndRecordsFlags() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -210,7 +217,8 @@ class FixtureTaskTest extends CakeTestCase { * test interactive mode of execute * * @return void - **/ + * @access public + */ function testExecuteInteractive() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -228,7 +236,8 @@ class FixtureTaskTest extends CakeTestCase { * Test that bake works * * @return void - **/ + * @access public + */ function testBake() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -263,7 +272,8 @@ class FixtureTaskTest extends CakeTestCase { * test record generation with float and binary types * * @return void - **/ + * @access public + */ function testRecordGenerationForBinaryAndFloat() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -279,7 +289,8 @@ class FixtureTaskTest extends CakeTestCase { * Test that file generation includes headers and correct path for plugins. * * @return void - **/ + * @access public + */ function testGenerateFixtureFile() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -296,7 +307,8 @@ class FixtureTaskTest extends CakeTestCase { * test generating files into plugins. * * @return void - **/ + * @access public + */ function testGeneratePluginFixtureFile() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index 059678ce5..484cbe06c 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -65,7 +65,8 @@ class ModelTaskTest extends CakeTestCase { * fixtures * * @var array - **/ + * @access public + */ var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag', 'core.category_thread'); /** @@ -99,7 +100,8 @@ class ModelTaskTest extends CakeTestCase { * Test that listAll scans the database connection and lists all the tables in it.s * * @return void - **/ + * @access public + */ function testListAll() { $this->Task->expectAt(1, 'out', array('1. Article')); $this->Task->expectAt(2, 'out', array('2. ArticlesTag')); @@ -126,7 +128,8 @@ class ModelTaskTest extends CakeTestCase { * Test that getName interacts with the user and returns the model name. * * @return void - **/ + * @access public + */ function testGetName() { $this->Task->setReturnValue('in', 1); @@ -153,7 +156,8 @@ class ModelTaskTest extends CakeTestCase { * Test table name interactions * * @return void - **/ + * @access public + */ function testGetTableName() { $this->Task->setReturnValueAt(0, 'in', 'y'); $result = $this->Task->getTable('Article', 'test_suite'); @@ -171,7 +175,8 @@ class ModelTaskTest extends CakeTestCase { * test that initializing the validations works. * * @return void - **/ + * @access public + */ function testInitValidations() { $result = $this->Task->initValidations(); $this->assertTrue(in_array('notempty', $result)); @@ -182,7 +187,8 @@ class ModelTaskTest extends CakeTestCase { * tests the guessing features of validation * * @return void - **/ + * @access public + */ function testFieldValidationGuessing() { $this->Task->interactive = false; $this->Task->initValidations(); @@ -210,7 +216,8 @@ class ModelTaskTest extends CakeTestCase { * test that interactive field validation works and returns multiple validators. * * @return void - **/ + * @access public + */ function testInteractiveFieldValidation() { $this->Task->initValidations(); $this->Task->interactive = true; @@ -228,7 +235,8 @@ class ModelTaskTest extends CakeTestCase { * test the validation Generation routine * * @return void - **/ + * @access public + */ function testNonInteractiveDoValidation() { $Model =& new MockModelTaskModel(); $Model->primaryKey = 'id'; @@ -289,7 +297,8 @@ class ModelTaskTest extends CakeTestCase { * test that finding primary key works * * @return void - **/ + * @access public + */ function testFindPrimaryKey() { $fields = array( 'one' => array(), @@ -307,7 +316,8 @@ class ModelTaskTest extends CakeTestCase { * test finding Display field * * @return void - **/ + * @access public + */ function testFindDisplayField() { $fields = array('id' => array(), 'tagname' => array(), 'body' => array(), 'created' => array(), 'modified' => array()); @@ -327,7 +337,8 @@ class ModelTaskTest extends CakeTestCase { * test that belongsTo generation works. * * @return void - **/ + * @access public + */ function testBelongsToGeneration() { $model = new Model(array('ds' => 'test_suite', 'name' => 'Comment')); $result = $this->Task->findBelongsTo($model, array()); @@ -347,7 +358,6 @@ class ModelTaskTest extends CakeTestCase { ); $this->assertEqual($result, $expected); - $model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread')); $result = $this->Task->findBelongsTo($model, array()); $expected = array( @@ -366,7 +376,8 @@ class ModelTaskTest extends CakeTestCase { * test that hasOne and/or hasMany relations are generated properly. * * @return void - **/ + * @access public + */ function testHasManyHasOneGeneration() { $model = new Model(array('ds' => 'test_suite', 'name' => 'Article')); $this->Task->connection = 'test_suite'; @@ -390,7 +401,6 @@ class ModelTaskTest extends CakeTestCase { ); $this->assertEqual($result, $expected); - $model = new Model(array('ds' => 'test_suite', 'name' => 'CategoryThread')); $result = $this->Task->findHasOneAndMany($model, array()); $expected = array( @@ -413,10 +423,11 @@ class ModelTaskTest extends CakeTestCase { } /** - * test that habtm generation works + * Test that HABTM generation works * * @return void - **/ + * @access public + */ function testHasAndBelongsToManyGeneration() { $model = new Model(array('ds' => 'test_suite', 'name' => 'Article')); $this->Task->connection = 'test_suite'; @@ -440,7 +451,8 @@ class ModelTaskTest extends CakeTestCase { * test non interactive doAssociations * * @return void - **/ + * @access public + */ function testDoAssociationsNonInteractive() { $this->Task->connection = 'test_suite'; $this->Task->interactive = false; @@ -464,14 +476,14 @@ class ModelTaskTest extends CakeTestCase { ), ), ); - } /** * Ensure that the fixutre object is correctly called. * * @return void - **/ + * @access public + */ function testBakeFixture() { $this->Task->Fixture->expectAt(0, 'bake', array('Article', 'articles')); $this->Task->bakeFixture('Article', 'articles'); @@ -484,7 +496,8 @@ class ModelTaskTest extends CakeTestCase { * Ensure that the test object is correctly called. * * @return void - **/ + * @access public + */ function testBakeTest() { $this->Task->Test->expectAt(0, 'bake', array('Model', 'Article')); $this->Task->bakeTest('Article'); @@ -498,7 +511,8 @@ class ModelTaskTest extends CakeTestCase { * a question for the hasOne is also not asked. * * @return void - **/ + * @access public + */ function testConfirmAssociations() { $associations = array( 'hasOne' => array( @@ -538,7 +552,8 @@ class ModelTaskTest extends CakeTestCase { * test that inOptions generates questions and only accepts a valid answer * * @return void - **/ + * @access public + */ function testInOptions() { $options = array('one', 'two', 'three'); $this->Task->expectAt(0, 'out', array('1. one')); @@ -558,7 +573,8 @@ class ModelTaskTest extends CakeTestCase { * test baking validation * * @return void - **/ + * @access public + */ function testBakeValidation() { $validate = array( 'name' => array( @@ -586,7 +602,8 @@ class ModelTaskTest extends CakeTestCase { * test baking relations * * @return void - **/ + * @access public + */ function testBakeRelations() { $associations = array( 'belongsTo' => array( @@ -640,7 +657,8 @@ class ModelTaskTest extends CakeTestCase { * test bake() with a -plugin param * * @return void - **/ + * @access public + */ function testBakeWithPlugin() { $this->Task->plugin = 'ControllerTest'; @@ -660,7 +678,8 @@ class ModelTaskTest extends CakeTestCase { * test that execute passes runs bake depending with named model. * * @return void - **/ + * @access public + */ function testExecuteWithNamedModel() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -675,7 +694,8 @@ class ModelTaskTest extends CakeTestCase { * test that execute runs all() when args[0] = all * * @return void - **/ + * @access public + */ function testExecuteIntoAll() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -707,7 +727,8 @@ class ModelTaskTest extends CakeTestCase { * test the interactive side of bake. * * @return void - **/ + * @access public + */ function testExecuteIntoInteractive() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; @@ -736,7 +757,8 @@ class ModelTaskTest extends CakeTestCase { * test using bake interactively with a table that does not exist. * * @return void - **/ + * @access public + */ function testExecuteWithNonExistantTableName() { $this->Task->connection = 'test_suite'; $this->Task->path = '/my/path/'; diff --git a/cake/tests/cases/console/libs/tasks/plugin.test.php b/cake/tests/cases/console/libs/tasks/plugin.test.php index 396aff542..078d1c902 100644 --- a/cake/tests/cases/console/libs/tasks/plugin.test.php +++ b/cake/tests/cases/console/libs/tasks/plugin.test.php @@ -72,7 +72,8 @@ class PluginTaskTest extends CakeTestCase { * startCase methods * * @return void - **/ + * @access public + */ function startCase() { $this->_paths = $paths = App::path('plugins'); $this->_testPath = array_push($paths, TMP . 'tests' . DS); @@ -83,7 +84,8 @@ class PluginTaskTest extends CakeTestCase { * endCase * * @return void - **/ + * @access public + */ function endCase() { App::build(array('plugins' => $this->_paths)); } @@ -102,7 +104,8 @@ class PluginTaskTest extends CakeTestCase { * test bake() * * @return void - **/ + * @access public + */ function testBakeFoldersAndFiles() { $this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(1, 'in', 'y'); @@ -196,7 +199,8 @@ class PluginTaskTest extends CakeTestCase { * test execute with no args, flowing into interactive, * * @return void - **/ + * @access public + */ function testExecuteWithNoArgs() { $this->Task->setReturnValueAt(0, 'in', 'TestPlugin'); $this->Task->setReturnValueAt(1, 'in', '3'); @@ -221,7 +225,8 @@ class PluginTaskTest extends CakeTestCase { * Test Execute * * @return void - **/ + * @access public + */ function testExecuteWithOneArg() { $this->Task->setReturnValueAt(0, 'in', $this->_testPath); $this->Task->setReturnValueAt(1, 'in', 'y'); @@ -245,7 +250,8 @@ class PluginTaskTest extends CakeTestCase { * test execute chaining into MVC parts * * @return void - **/ + * @access public + */ function testExecuteWithTwoArgs() { $this->Task->Model =& new PluginTestMockModelTask(); $this->Task->setReturnValueAt(0, 'in', $this->_testPath); diff --git a/cake/tests/cases/console/libs/tasks/project.test.php b/cake/tests/cases/console/libs/tasks/project.test.php index 7190f35da..08f33778b 100644 --- a/cake/tests/cases/console/libs/tasks/project.test.php +++ b/cake/tests/cases/console/libs/tasks/project.test.php @@ -84,7 +84,8 @@ class ProjectTaskTest extends CakeTestCase { * creates a test project that is used for testing project task. * * @return void - **/ + * @access protected + */ function _setupTestProject() { $skel = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS . 'skel'; $this->Task->setReturnValueAt(0, 'in', 'y'); @@ -96,7 +97,8 @@ class ProjectTaskTest extends CakeTestCase { * test bake() method and directory creation. * * @return void - **/ + * @access public + */ function testBake() { $this->_setupTestProject(); @@ -117,7 +119,8 @@ class ProjectTaskTest extends CakeTestCase { * test generation of Security.salt * * @return void - **/ + * @access public + */ function testSecuritySaltGeneration() { $this->_setupTestProject(); @@ -134,7 +137,8 @@ class ProjectTaskTest extends CakeTestCase { * Test that index.php is generated correctly. * * @return void - **/ + * @access public + */ function testIndexPhpGeneration() { $this->_setupTestProject(); @@ -154,7 +158,8 @@ class ProjectTaskTest extends CakeTestCase { * test getPrefix method, and that it returns Routing.prefix or writes to config file. * * @return void - **/ + * @access public + */ function testGetPrefix() { Configure::write('Routing.prefixes', array('admin')); $result = $this->Task->getPrefix(); @@ -176,7 +181,8 @@ class ProjectTaskTest extends CakeTestCase { * test cakeAdmin() writing core.php * * @return void - **/ + * @access public + */ function testCakeAdmin() { $file =& new File(CONFIGS . 'core.php'); $contents = $file->read();; @@ -196,7 +202,8 @@ class ProjectTaskTest extends CakeTestCase { * test getting the prefix with more than one prefix setup * * @return void - **/ + * @access public + */ function testGetPrefixWithMultiplePrefixes() { Configure::write('Routing.prefixes', array('admin', 'ninja', 'shinobi')); $this->_setupTestProject(); @@ -211,7 +218,8 @@ class ProjectTaskTest extends CakeTestCase { * Test execute method with one param to destination folder. * * @return void - **/ + * @access public + */ function testExecute() { $this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . DS . 'console' . DS. 'templates' . DS . 'skel'; $this->Task->params['working'] = TMP . 'tests' . DS; diff --git a/cake/tests/cases/console/libs/tasks/template.test.php b/cake/tests/cases/console/libs/tasks/template.test.php index ca98599bc..243d2aba0 100644 --- a/cake/tests/cases/console/libs/tasks/template.test.php +++ b/cake/tests/cases/console/libs/tasks/template.test.php @@ -81,7 +81,8 @@ class TemplateTaskTest extends CakeTestCase { * test that set sets variables * * @return void - **/ + * @access public + */ function testSet() { $this->Task->set('one', 'two'); $this->assertTrue(isset($this->Task->templateVars['one'])); @@ -98,7 +99,8 @@ class TemplateTaskTest extends CakeTestCase { * test finding themes installed in * * @return void - **/ + * @access public + */ function testFindingInstalledThemesForBake() { $consoleLibs = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS; $this->Task->Dispatch->shellPaths = array($consoleLibs); @@ -111,7 +113,8 @@ class TemplateTaskTest extends CakeTestCase { * that the user is not bugged. If there are more, find and return the correct theme name * * @return void - **/ + * @access public + */ function testGetThemePath() { $defaultTheme = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . 'templates' . DS . 'default' .DS; $this->Task->templatePaths = array('default' => $defaultTheme); @@ -136,7 +139,8 @@ class TemplateTaskTest extends CakeTestCase { * test generate * * @return void - **/ + * @access public + */ function testGenerate() { App::build(array( 'shells' => array( @@ -155,7 +159,8 @@ class TemplateTaskTest extends CakeTestCase { * ensure fallback to default works. * * @return void - **/ + * @access public + */ function testGenerateWithTemplateFallbacks() { App::build(array( 'shells' => array( diff --git a/cake/tests/cases/console/libs/tasks/test.test.php b/cake/tests/cases/console/libs/tasks/test.test.php index 203a51cf6..d6c9dae97 100644 --- a/cake/tests/cases/console/libs/tasks/test.test.php +++ b/cake/tests/cases/console/libs/tasks/test.test.php @@ -49,17 +49,48 @@ Mock::generatePartial( ); /** - * Test subject models for fixture generation - **/ + * Test Article model + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class TestTaskArticle extends Model { + +/** + * Model name + * + * @var string + * @access public + */ var $name = 'TestTaskArticle'; + +/** + * Table name to use + * + * @var string + * @access public + */ var $useTable = 'articles'; + +/** + * HasMany Associations + * + * @var array + * @access public + */ var $hasMany = array( 'Comment' => array( 'className' => 'TestTask.TestTaskComment', 'foreignKey' => 'article_id', ) ); + +/** + * Has and Belongs To Many Associations + * + * @var array + * @access public + */ var $hasAndBelongsToMany = array( 'Tag' => array( 'className' => 'TestTaskTag', @@ -68,19 +99,65 @@ class TestTaskArticle extends Model { 'associationForeignKey' => 'tag_id' ) ); + +/** + * Example public method + * + * @return void + * @access public + */ function doSomething() { - } + +/** + * Example Secondary public method + * + * @return void + * @access public + */ function doSomethingElse() { - } - function _innerMethod() { +/** + * Example protected method + * + * @return void + * @access protected + */ + function _innerMethod() { } } + +/** + * Tag Testing Model + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class TestTaskTag extends Model { + +/** + * Model name + * + * @var string + * @access public + */ var $name = 'TestTaskTag'; + +/** + * Table name + * + * @var string + * @access public + */ var $useTable = 'tags'; + +/** + * Has and Belongs To Many Associations + * + * @var array + * @access public + */ var $hasAndBelongsToMany = array( 'Article' => array( 'className' => 'TestTaskArticle', @@ -92,14 +169,44 @@ class TestTaskTag extends Model { } /** - * Simulated Plugin - **/ + * Simulated plugin + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class TestTaskAppModel extends Model { - } + +/** + * Testing AppMode (TaskComment) + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class TestTaskComment extends TestTaskAppModel { + +/** + * Model name + * + * @var string + * @access public + */ var $name = 'TestTaskComment'; + +/** + * Table name + * + * @var string + * @access public + */ var $useTable = 'comments'; + +/** + * Belongs To Associations + * + * @var array + * @access public + */ var $belongsTo = array( 'Article' => array( 'className' => 'TestTaskArticle', @@ -108,8 +215,28 @@ class TestTaskComment extends TestTaskAppModel { ); } +/** + * Test Task Comments Controller + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class TestTaskCommentsController extends Controller { + +/** + * Controller Name + * + * @var string + * @access public + */ var $name = 'TestTaskComments'; + +/** + * Models to use + * + * @var array + * @access public + */ var $uses = array('TestTaskComment', 'TestTaskTag'); } @@ -121,6 +248,12 @@ class TestTaskCommentsController extends Controller { */ class TestTaskTest extends CakeTestCase { +/** + * Fixtures + * + * @var string + * @access public + */ var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); /** @@ -150,8 +283,8 @@ class TestTaskTest extends CakeTestCase { /** * Test that file path generation doesn't continuously append paths. * - * @access public * @return void + * @access public */ function testFilePathGeneration() { $file = TESTS . 'cases' . DS . 'models' . DS . 'my_class.test.php'; @@ -176,7 +309,7 @@ class TestTaskTest extends CakeTestCase { * methods into the test case. * * @return void - **/ + */ function testMethodIntrospection() { $result = $this->Task->getTestableMethods('TestTaskArticle'); $expected = array('dosomething', 'dosomethingelse'); @@ -187,7 +320,8 @@ class TestTaskTest extends CakeTestCase { * test that the generation of fixtures works correctly. * * @return void - **/ + * @access public + */ function testFixtureArrayGenerationFromModel() { $subject = ClassRegistry::init('TestTaskArticle'); $result = $this->Task->generateFixtureList($subject); @@ -201,7 +335,8 @@ class TestTaskTest extends CakeTestCase { * test that the generation of fixtures works correctly. * * @return void - **/ + * @access public + */ function testFixtureArrayGenerationFromController() { $subject = new TestTaskCommentsController(); $result = $this->Task->generateFixtureList($subject); @@ -215,7 +350,8 @@ class TestTaskTest extends CakeTestCase { * test user interaction to get object type * * @return void - **/ + * @access public + */ function testGetObjectType() { $this->Task->expectOnce('_stop'); $this->Task->setReturnValueAt(0, 'in', 'q'); @@ -230,7 +366,8 @@ class TestTaskTest extends CakeTestCase { * creating test subjects should clear the registry so the registry is always fresh * * @return void - **/ + * @access public + */ function testRegistryClearWhenBuildingTestObjects() { ClassRegistry::flush(); $model = ClassRegistry::init('TestTaskComment'); @@ -254,7 +391,8 @@ class TestTaskTest extends CakeTestCase { * test that getClassName returns the user choice as a classname. * * @return void - **/ + * @access public + */ function testGetClassName() { $objects = App::objects('model'); $skip = $this->skipIf(empty($objects), 'No models in app, this test will fail. %s'); @@ -275,7 +413,8 @@ class TestTaskTest extends CakeTestCase { * Test the user interaction for defining additional fixtures. * * @return void - **/ + * @access public + */ function testGetUserFixtures() { $this->Task->setReturnValueAt(0, 'in', 'y'); $this->Task->setReturnValueAt(1, 'in', 'app.pizza, app.topping, app.side_dish'); @@ -288,7 +427,8 @@ class TestTaskTest extends CakeTestCase { * test that resolving classnames works * * @return void - **/ + * @access public + */ function testGetRealClassname() { $result = $this->Task->getRealClassname('Model', 'Post'); $this->assertEqual($result, 'Post'); @@ -311,7 +451,8 @@ class TestTaskTest extends CakeTestCase { * as PHP4 classnames are all lower case, breaking the plugin path inflection. * * @return void - **/ + * @access public + */ function testBakeModelTest() { $this->Task->setReturnValue('createFile', true); $this->Task->setReturnValue('isLoadableClass', true); @@ -344,7 +485,8 @@ class TestTaskTest extends CakeTestCase { * causing issues with inflection of path name from classname. * * @return void - **/ + * @access public + */ function testBakeControllerTest() { $this->Task->setReturnValue('createFile', true); $this->Task->setReturnValue('isLoadableClass', true); @@ -377,7 +519,8 @@ class TestTaskTest extends CakeTestCase { * test Constructor generation ensure that constructClasses is called for controllers * * @return void - **/ + * @access public + */ function testGenerateContsructor() { $result = $this->Task->generateConstructor('controller', 'PostsController'); $expected = "new TestPostsController();\n\t\t\$this->Posts->constructClasses();\n"; @@ -396,7 +539,8 @@ class TestTaskTest extends CakeTestCase { * Test that mock class generation works for the appropriate classes * * @return void - **/ + * @access public + */ function testMockClassGeneration() { $result = $this->Task->hasMockClass('controller'); $this->assertTrue($result); @@ -406,7 +550,8 @@ class TestTaskTest extends CakeTestCase { * test bake() with a -plugin param * * @return void - **/ + * @access public + */ function testBakeWithPlugin() { $this->Task->plugin = 'TestTest'; @@ -419,7 +564,8 @@ class TestTaskTest extends CakeTestCase { * Test filename generation for each type + plugins * * @return void - **/ + * @access public + */ function testTestCaseFileName() { $this->Task->path = '/my/path/tests/'; @@ -453,7 +599,8 @@ class TestTaskTest extends CakeTestCase { * test execute with a type defined * * @return void - **/ + * @access public + */ function testExecuteWithOneArg() { $this->Task->args[0] = 'Model'; $this->Task->setReturnValueAt(0, 'in', 'TestTaskTag'); @@ -466,7 +613,8 @@ class TestTaskTest extends CakeTestCase { * test execute with type and class name defined * * @return void - **/ + * @access public + */ function testExecuteWithTwoArgs() { $this->Task->args = array('Model', 'TestTaskTag'); $this->Task->setReturnValueAt(0, 'in', 'TestTaskTag'); diff --git a/cake/tests/cases/console/libs/tasks/view.test.php b/cake/tests/cases/console/libs/tasks/view.test.php index ebf6156f9..be7e9321c 100644 --- a/cake/tests/cases/console/libs/tasks/view.test.php +++ b/cake/tests/cases/console/libs/tasks/view.test.php @@ -49,10 +49,36 @@ Mock::generatePartial( Mock::generate('ControllerTask', 'ViewTaskMockControllerTask'); Mock::generate('ProjectTask', 'ViewTaskMockProjectTask'); +/** + * Test View Task Comment Model + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class ViewTaskComment extends Model { + +/** + * Model name + * + * @var string + * @access public + */ var $name = 'ViewTaskComment'; + +/** + * Table name + * + * @var string + * @access public + */ var $useTable = 'comments'; +/** + * Belongs To Associations + * + * @var array + * @access public + */ var $belongsTo = array( 'Article' => array( 'className' => 'ViewTaskArticle', @@ -61,46 +87,143 @@ class ViewTaskComment extends Model { ); } +/** + * Test View Task Article Model + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class ViewTaskArticle extends Model { + +/** + * Model name + * + * @var string + * @access public + */ var $name = 'ViewTaskArticle'; + +/** + * Table name + * + * @var string + * @access public + */ var $useTable = 'articles'; } +/** + * Test View Task Comments Controller + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class ViewTaskCommentsController extends Controller { + +/** + * Controller name + * + * @var string + * @access public + */ var $name = 'ViewTaskComments'; +/** + * Testing public controller action + * + * @return void + * @access public + */ function index() { - } - function add() { +/** + * Testing public controller action + * + * @return void + * @access public + */ + function add() { } } +/** + * Test View Task Articles Controller + * + * @package cake + * @subpackage cake.tests.cases.console.libs.tasks + */ class ViewTaskArticlesController extends Controller { + +/** + * Controller name + * + * @var string + * @access public + */ var $name = 'ViewTaskArticles'; +/** + * Test public controller action + * + * @return void + * @access public + */ function index() { - } + +/** + * Test public controller action + * + * @return void + * @access public + */ function add() { - } +/** + * Test admin prefixed controller action + * + * @return void + * @access public + */ function admin_index() { - } + +/** + * Test admin prefixed controller action + * + * @return void + * @access public + */ function admin_add() { - } + +/** + * Test admin prefixed controller action + * + * @return void + * @access public + */ function admin_view() { - } + +/** + * Test admin prefixed controller action + * + * @return void + * @access public + */ function admin_edit() { - } - function admin_delete() { +/** + * Test admin prefixed controller action + * + * @return void + * @access public + */ + function admin_delete() { } } @@ -112,6 +235,12 @@ class ViewTaskArticlesController extends Controller { */ class ViewTaskTest extends CakeTestCase { +/** + * Fixtures + * + * @var array + * @access public + */ var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag'); /** @@ -148,7 +277,8 @@ class ViewTaskTest extends CakeTestCase { * Test getContent and parsing of Templates. * * @return void - **/ + * @access public + */ function testGetContent() { $vars = array( 'modelClass' => 'TestViewModel', @@ -178,7 +308,8 @@ class ViewTaskTest extends CakeTestCase { * test getContent() using an admin_prefixed action. * * @return void - **/ + * @access public + */ function testGetContentWithAdminAction() { $_back = Configure::read('Routing'); Configure::write('Routing.prefixes', array('admin')); @@ -212,7 +343,8 @@ class ViewTaskTest extends CakeTestCase { * test Bake method * * @return void - **/ + * @access public + */ function testBake() { $this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerPath = 'view_task_comments'; @@ -237,7 +369,8 @@ class ViewTaskTest extends CakeTestCase { * test bake() with a -plugin param * * @return void - **/ + * @access public + */ function testBakeWithPlugin() { $this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerPath = 'view_task_comments'; @@ -252,7 +385,8 @@ class ViewTaskTest extends CakeTestCase { * test bake actions baking multiple actions. * * @return void - **/ + * @access public + */ function testBakeActions() { $this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerPath = 'view_task_comments'; @@ -277,7 +411,8 @@ class ViewTaskTest extends CakeTestCase { * test baking a customAction (non crud) * * @return void - **/ + * @access public + */ function testCustomAction() { $this->Task->controllerName = 'ViewTaskComments'; $this->Task->controllerPath = 'view_task_comments'; @@ -295,7 +430,8 @@ class ViewTaskTest extends CakeTestCase { * Test all() * * @return void - **/ + * @access public + */ function testExecuteIntoAll() { $this->Task->args[0] = 'all'; @@ -313,7 +449,8 @@ class ViewTaskTest extends CakeTestCase { * test `cake bake view $controller view` * * @return void - **/ + * @access public + */ function testExecuteWithActionParam() { $this->Task->args[0] = 'ViewTaskComments'; $this->Task->args[1] = 'view'; @@ -328,7 +465,8 @@ class ViewTaskTest extends CakeTestCase { * Ensure that views are only baked for actions that exist in the controller. * * @return void - **/ + * @access public + */ function testExecuteWithController() { $this->Task->args[0] = 'ViewTaskComments'; @@ -344,7 +482,8 @@ class ViewTaskTest extends CakeTestCase { * Which only bakes admin methods, not non-admin methods. * * @return void - **/ + * @access public + */ function testExecuteWithControllerAndAdminFlag() { $_back = Configure::read('Routing'); Configure::write('Routing.prefixes', array('admin')); @@ -366,7 +505,8 @@ class ViewTaskTest extends CakeTestCase { * test execute into interactive. * * @return void - **/ + * @access public + */ function testExecuteInteractive() { $this->Task->connection = 'test_suite'; $this->Task->args = array(); @@ -403,7 +543,8 @@ class ViewTaskTest extends CakeTestCase { * test `cake bake view posts index list` * * @return void - **/ + * @access public + */ function testExecuteWithAlternateTemplates() { $this->Task->connection = 'test_suite'; $this->Task->args = array('ViewTaskComments', 'index', 'list'); @@ -421,7 +562,8 @@ class ViewTaskTest extends CakeTestCase { * test execute into interactive() with admin methods. * * @return void - **/ + * @access public + */ function testExecuteInteractiveWithAdmin() { Configure::write('Routing.prefixes', array('admin')); $this->Task->connection = 'test_suite'; From 0977b3fe1531e2a86cf632cc8616b25f252bba2d Mon Sep 17 00:00:00 2001 From: predominant Date: Sat, 14 Nov 2009 23:19:25 +1100 Subject: [PATCH 049/112] Standardising docblock endings throughout. --- cake/console/libs/acl.php | 6 +- cake/console/libs/schema.php | 6 +- cake/console/libs/shell.php | 2 +- cake/console/libs/tasks/controller.php | 12 +- cake/console/libs/tasks/db_config.php | 4 +- cake/console/libs/tasks/fixture.php | 18 +-- cake/console/libs/tasks/model.php | 38 +++--- cake/console/libs/tasks/plugin.php | 2 +- cake/console/libs/tasks/project.php | 2 +- cake/console/libs/tasks/template.php | 14 +- cake/console/libs/tasks/test.php | 40 +++--- cake/console/libs/tasks/view.php | 8 +- cake/libs/cake_log.php | 18 +-- cake/libs/cake_session.php | 2 +- cake/libs/configure.php | 2 +- cake/libs/controller/component.php | 2 +- cake/libs/controller/components/cookie.php | 2 +- cake/libs/inflector.php | 10 +- cake/libs/log/file_log.php | 6 +- cake/libs/magic_db.php | 4 +- cake/libs/model/cake_schema.php | 6 +- cake/libs/model/datasources/datasource.php | 2 +- cake/libs/model/datasources/dbo/dbo_adodb.php | 2 +- cake/libs/model/datasources/dbo/dbo_db2.php | 2 +- .../model/datasources/dbo/dbo_firebird.php | 4 +- cake/libs/model/datasources/dbo/dbo_mssql.php | 2 +- cake/libs/model/datasources/dbo/dbo_mysql.php | 4 +- .../libs/model/datasources/dbo/dbo_mysqli.php | 2 +- cake/libs/model/datasources/dbo/dbo_odbc.php | 2 +- .../model/datasources/dbo/dbo_postgres.php | 2 +- .../libs/model/datasources/dbo/dbo_sqlite.php | 2 +- .../libs/model/datasources/dbo/dbo_sybase.php | 2 +- cake/libs/model/datasources/dbo_source.php | 6 +- cake/libs/router.php | 4 +- cake/libs/view/helper.php | 2 +- cake/libs/view/helpers/html.php | 12 +- cake/libs/view/helpers/javascript.php | 2 +- cake/libs/view/helpers/jquery_engine.php | 30 ++--- cake/libs/view/helpers/js.php | 100 +++++++------- cake/libs/view/helpers/mootools_engine.php | 26 ++-- cake/libs/view/helpers/number.php | 6 +- cake/libs/view/helpers/paginator.php | 4 +- cake/libs/view/helpers/prototype_engine.php | 28 ++-- cake/libs/view/helpers/rss.php | 2 +- cake/libs/view/view.php | 2 +- cake/tests/cases/basics.test.php | 53 ++++---- cake/tests/cases/dispatcher.test.php | 123 +++++++++--------- cake/tests/cases/libs/cake_log.test.php | 12 +- cake/tests/cases/libs/cake_test_case.test.php | 4 +- .../cases/libs/cake_test_fixture.test.php | 2 +- .../cases/libs/code_coverage_manager.test.php | 4 +- cake/tests/cases/libs/configure.test.php | 4 +- .../cases/libs/controller/component.test.php | 2 +- .../libs/controller/components/auth.test.php | 12 +- .../components/request_handler.test.php | 10 +- .../controller/components/security.test.php | 4 +- .../cases/libs/controller/controller.test.php | 8 +- .../controller/controller_merge_vars.test.php | 69 +++++----- .../cases/libs/controller/scaffold.test.php | 22 ++-- cake/tests/cases/libs/error.test.php | 4 +- cake/tests/cases/libs/folder.test.php | 2 +- cake/tests/cases/libs/log/file_log.test.php | 2 +- cake/tests/cases/libs/magic_db.test.php | 2 +- .../cases/libs/model/cake_schema.test.php | 8 +- .../model/datasources/dbo/dbo_adodb.test.php | 2 +- .../model/datasources/dbo/dbo_mysql.test.php | 10 +- .../model/datasources/dbo/dbo_mysqli.test.php | 2 +- .../datasources/dbo/dbo_postgres.test.php | 4 +- .../model/datasources/dbo/dbo_sqlite.test.php | 6 +- .../model/datasources/dbo_source.test.php | 10 +- .../cases/libs/model/model_behavior.test.php | 4 +- .../cases/libs/model/model_delete.test.php | 2 +- .../libs/model/model_integration.test.php | 8 +- .../cases/libs/model/model_read.test.php | 4 +- .../libs/model/model_validation.test.php | 2 +- .../cases/libs/model/model_write.test.php | 10 +- cake/tests/cases/libs/model/models.php | 10 +- cake/tests/cases/libs/object.test.php | 10 +- cake/tests/cases/libs/router.test.php | 10 +- cake/tests/cases/libs/string.test.php | 2 +- cake/tests/cases/libs/validation.test.php | 2 +- cake/tests/cases/libs/view/helper.test.php | 6 +- .../cases/libs/view/helpers/cache.test.php | 6 +- .../cases/libs/view/helpers/form.test.php | 24 ++-- .../cases/libs/view/helpers/html.test.php | 12 +- .../libs/view/helpers/javascript.test.php | 4 +- .../libs/view/helpers/jquery_engine.test.php | 26 ++-- .../tests/cases/libs/view/helpers/js.test.php | 48 +++---- .../view/helpers/mootools_engine.test.php | 26 ++-- .../libs/view/helpers/paginator.test.php | 4 +- .../view/helpers/prototype_engine.test.php | 26 ++-- .../cases/libs/view/helpers/session.test.php | 2 +- cake/tests/cases/libs/view/view.test.php | 8 +- cake/tests/cases/libs/xml.test.php | 6 +- cake/tests/lib/cake_reporter.php | 6 +- cake/tests/lib/cake_test_fixture.php | 2 +- cake/tests/lib/cake_text_reporter.php | 6 +- 97 files changed, 559 insertions(+), 552 deletions(-) diff --git a/cake/console/libs/acl.php b/cake/console/libs/acl.php index 13796f8cc..6bd6bc0bf 100644 --- a/cake/console/libs/acl.php +++ b/cake/console/libs/acl.php @@ -236,7 +236,7 @@ class AclShell extends Shell { * @param integer $indent indent level. * @return void * @access protected - **/ + */ function _outputNode($class, $node, $indent) { $indent = str_repeat(' ', $indent); $data = $node[$class]; @@ -521,7 +521,7 @@ class AclShell extends Shell { * * @param string $identifier Identifier to parse * @return mixed a string for aliases, and an array for model.foreignKey - **/ + */ function parseIdentifier($identifier) { if (preg_match('/^([\w]+)\.(.*)$/', $identifier, $matches)) { return array( @@ -539,7 +539,7 @@ class AclShell extends Shell { * @param string $class Class type you want (Aro/Aco) * @param mixed $identifier A mixed identifier for finding the node. * @return int Integer of NodeId. Will trigger an error if nothing is found. - **/ + */ function _getNodeId($class, $identifier) { $node = $this->Acl->{$class}->node($identifier); if (empty($node)) { diff --git a/cake/console/libs/schema.php b/cake/console/libs/schema.php index 78fdf0ecb..b6c69708a 100644 --- a/cake/console/libs/schema.php +++ b/cake/console/libs/schema.php @@ -242,7 +242,7 @@ class SchemaShell extends Shell { * Run database create commands. Alias for run create. * * @return void - **/ + */ function create() { list($Schema, $table) = $this->_loadSchema(); $this->__create($Schema, $table); @@ -252,7 +252,7 @@ class SchemaShell extends Shell { * Run database create commands. Alias for run create. * * @return void - **/ + */ function update() { list($Schema, $table) = $this->_loadSchema(); $this->__update($Schema, $table); @@ -262,7 +262,7 @@ class SchemaShell extends Shell { * Prepares the Schema objects for database operations. * * @return void - **/ + */ function _loadSchema() { $name = $plugin = null; if (isset($this->params['name'])) { diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index 6452a8a9b..0a481db60 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -642,7 +642,7 @@ class Shell extends Object { * * @param string $pluginName Name of the plugin you want ie. DebugKit * @return string $path path to the correct plugin. - **/ + */ function _pluginPath($pluginName) { return App::pluginPath($pluginName); } diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index cc88dcd42..9c6fd14e5 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -113,7 +113,7 @@ class ControllerTask extends Shell { * * @access public * @return void - **/ + */ function all() { $this->interactive = false; $this->listAll($this->connection, false); @@ -219,7 +219,7 @@ class ControllerTask extends Shell { * Confirm a to be baked controller with the user * * @return void - **/ + */ function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) { $this->out(); $this->hr(); @@ -257,7 +257,7 @@ class ControllerTask extends Shell { * Interact with the user and ask about which methods (admin or regular they want to bake) * * @return array Array containing (bakeRegular, bakeAdmin) answers - **/ + */ function _askAboutMethods() { $wannaBakeCrud = $this->in( __("Would you like to create some basic class methods \n(index(), add(), view(), edit())?", true), @@ -348,7 +348,7 @@ class ControllerTask extends Shell { * Interact with the user and get a list of additional helpers * * @return array Helpers that the user wants to use. - **/ + */ function doHelpers() { return $this->_doPropertyChoices( __("Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?", true), @@ -360,7 +360,7 @@ class ControllerTask extends Shell { * Interact with the user and get a list of additional components * * @return array Components the user wants to use. - **/ + */ function doComponents() { return $this->_doPropertyChoices( __("Would you like this controller to use any components?", true), @@ -374,7 +374,7 @@ class ControllerTask extends Shell { * @param string $prompt A yes/no question to precede the list * @param sting $example A question for a comma separated list, with examples. * @return array Array of values for property. - **/ + */ function _doPropertyChoices($prompt, $example) { $proceed = $this->in($prompt, array('y','n'), 'n'); $property = array(); diff --git a/cake/console/libs/tasks/db_config.php b/cake/console/libs/tasks/db_config.php index 6635fe8c0..b9253558a 100644 --- a/cake/console/libs/tasks/db_config.php +++ b/cake/console/libs/tasks/db_config.php @@ -53,7 +53,7 @@ class DbConfigTask extends Shell { * Used for testing. * * @var string - **/ + */ var $databaseClassName = 'DATABASE_CONFIG'; /** @@ -351,7 +351,7 @@ class DbConfigTask extends Shell { * Get a user specified Connection name * * @return void - **/ + */ function getConfig() { App::import('Model', 'ConnectionManager', false); diff --git a/cake/console/libs/tasks/fixture.php b/cake/console/libs/tasks/fixture.php index 98c1ecea8..82dec5869 100644 --- a/cake/console/libs/tasks/fixture.php +++ b/cake/console/libs/tasks/fixture.php @@ -54,14 +54,14 @@ class FixtureTask extends Shell { * The db connection being used for baking * * @var string - **/ + */ var $connection = null; /** * Schema instance * * @var object - **/ + */ var $_Schema = null; /** @@ -103,7 +103,7 @@ class FixtureTask extends Shell { * * @access public * @return void - **/ + */ function all() { $this->interactive = false; $this->Model->interactive = false; @@ -140,7 +140,7 @@ class FixtureTask extends Shell { * * @param string $modelName Name of model you are dealing with. * @return array Array of import options. - **/ + */ function importOptions($modelName) { $options = array(); $doSchema = $this->in(__('Would you like to import schema for this fixture?', true), array('y', 'n'), 'n'); @@ -230,7 +230,7 @@ class FixtureTask extends Shell { * @param string $fixture Contents of the fixture file. * @access public * @return void - **/ + */ function generateFixtureFile($model, $otherVars) { $defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null); $vars = array_merge($defaults, $otherVars); @@ -255,7 +255,7 @@ class FixtureTask extends Shell { * * @param array $table Table schema array * @return string fields definitions - **/ + */ function _generateSchema($tableInfo) { $schema = $this->_Schema->generateTable('f', $tableInfo); return substr($schema, 10, -2); @@ -266,7 +266,7 @@ class FixtureTask extends Shell { * * @param array $table Table schema array * @return array Array of records to use in the fixture. - **/ + */ function _generateRecords($tableInfo, $recordCount = 1) { $records = array(); for ($i = 0; $i < $recordCount; $i++) { @@ -337,7 +337,7 @@ class FixtureTask extends Shell { * * @param array $records Array of records to be converted to string * @return string A string value of the $records array. - **/ + */ function _makeRecordString($records) { $out = "array(\n"; foreach ($records as $record) { @@ -360,7 +360,7 @@ class FixtureTask extends Shell { * @param string $modelName name of the model to take records from. * @param string $useTable Name of table to use. * @return array Array of records. - **/ + */ function _getRecordsFromTable($modelName, $useTable = null) { if ($this->interactive) { $condition = null; diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 8d616a71a..30cce0e0d 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -64,14 +64,14 @@ class ModelTask extends Shell { * Holds tables found on connection. * * @var array - **/ + */ var $__tables = array(); /** * Holds validation method map. * * @var array - **/ + */ var $__validations = array(); /** @@ -109,7 +109,7 @@ class ModelTask extends Shell { * Bake all models at once. * * @return void - **/ + */ function all() { $this->listAll($this->connection, false); $unitTestExists = $this->_checkUnitTest(); @@ -129,7 +129,7 @@ class ModelTask extends Shell { * * @param string $className Name of class you want model to be. * @return object Model instance - **/ + */ function &_getModelObject($className) { $object = new Model(array('name' => $className, 'ds' => $this->connection)); return $object; @@ -142,7 +142,7 @@ class ModelTask extends Shell { * @param string $prompt Prompt to use for options list. * @param integer $default The default option for the given prompt. * @return result of user choice. - **/ + */ function inOptions($options, $prompt = null, $default = null) { $valid = false; $max = count($options); @@ -262,7 +262,7 @@ class ModelTask extends Shell { * @param string $associations Collection of associations. * @access protected * @return void - **/ + */ function _printAssociation($modelName, $type, $associations) { if (!empty($associations[$type])) { for ($i = 0; $i < count($associations[$type]); $i++) { @@ -278,7 +278,7 @@ class ModelTask extends Shell { * @param array $fields Array of fields that might have a primary key. * @return string Name of field that is a primary key. * @access public - **/ + */ function findPrimaryKey($fields) { foreach ($fields as $name => $field) { if (isset($field['key']) && $field['key'] == 'primary') { @@ -293,7 +293,7 @@ class ModelTask extends Shell { * * @param array $fields Array of fields to look for and choose as a displayField * @return mixed Name of field to use for displayField or false if the user declines to choose - **/ + */ function findDisplayField($fields) { $fieldNames = array_keys($fields); $prompt = __("A displayField could not be automatically detected\nwould you like to choose one?", true); @@ -337,7 +337,7 @@ class ModelTask extends Shell { * Populate the __validations array * * @return void - **/ + */ function initValidations() { $options = $choices = array(); if (class_exists('Validation')) { @@ -363,7 +363,7 @@ class ModelTask extends Shell { * @param string $fieldName Name of field to be validated. * @param array $metaData metadata for field * @return array Array of validation for the field. - **/ + */ function fieldValidation($fieldName, $metaData, $primaryKey = 'id') { $defaultChoice = count($this->__validations); $validate = $alreadyChosen = array(); @@ -484,7 +484,7 @@ class ModelTask extends Shell { * @param object $model Model instance of model being generated. * @param array $associations Array of inprogress associations * @return array $associations with belongsTo added in. - **/ + */ function findBelongsTo(&$model, $associations) { $fields = $model->schema(); foreach ($fields as $fieldName => $field) { @@ -513,7 +513,7 @@ class ModelTask extends Shell { * @param object $model Model instance being generated * @param array $associations Array of inprogress associations * @return array $associations with hasOne and hasMany added in. - **/ + */ function findHasOneAndMany(&$model, $associations) { $foreignKey = $this->_modelKey($model->name); foreach ($this->__tables as $otherTable) { @@ -556,7 +556,7 @@ class ModelTask extends Shell { * @param object $model Model instance being generated * @param array $associations Array of inprogress associations * @return array $associations with hasAndBelongsToMany added in. - **/ + */ function findHasAndBelongsToMany(&$model, $associations) { $foreignKey = $this->_modelKey($model->name); foreach ($this->__tables as $otherTable) { @@ -596,7 +596,7 @@ class ModelTask extends Shell { * @param array $model Temporary Model instance. * @param array $associations Array of associations to be confirmed. * @return array Array of confirmed associations - **/ + */ function confirmAssociations(&$model, $associations) { foreach ($associations as $type => $settings) { if (!empty($associations[$type])) { @@ -624,7 +624,7 @@ class ModelTask extends Shell { * @param object $model Temporary model instance * @param array $associations Array of associations. * @return array Array of associations. - **/ + */ function doMoreAssociations($model, $associations) { $prompt = __('Would you like to define some additional model associations?', true); $wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n'); @@ -689,7 +689,7 @@ class ModelTask extends Shell { * Finds all possible keys to use on custom associations. * * @return array array of tables and possible keys - **/ + */ function _generatePossibleKeys() { $possible = array(); foreach ($this->__tables as $otherTable) { @@ -782,7 +782,7 @@ class ModelTask extends Shell { * @param string $modelName Name of the model you want a table for. * @param string $useDbConfig Name of the database config you want to get tables from. * @return void - **/ + */ function getTable($modelName, $useDbConfig = null) { if (!isset($useDbConfig)) { $useDbConfig = $this->connection; @@ -811,7 +811,7 @@ class ModelTask extends Shell { * * @param string $useDbConfig Connection name to scan. * @return array Array of tables in the database. - **/ + */ function getAllTables($useDbConfig = null) { if (!isset($useDbConfig)) { $useDbConfig = $this->connection; @@ -906,7 +906,7 @@ class ModelTask extends Shell { * @access public * @return void * @see FixtureTask::bake - **/ + */ function bakeFixture($className, $useTable = null) { $this->Fixture->connection = $this->connection; $this->Fixture->plugin = $this->plugin; diff --git a/cake/console/libs/tasks/plugin.php b/cake/console/libs/tasks/plugin.php index 05309bdcc..03b563dc1 100644 --- a/cake/console/libs/tasks/plugin.php +++ b/cake/console/libs/tasks/plugin.php @@ -204,7 +204,7 @@ class PluginTask extends Shell { * find and change $this->path to the user selection * * @return void - **/ + */ function findPath($pathOptions) { $valid = false; $max = count($pathOptions); diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 6194fab31..196273fb3 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -30,7 +30,7 @@ class ProjectTask extends Shell { * configs path (used in testing). * * @var string - **/ + */ var $configPath = null; /** diff --git a/cake/console/libs/tasks/template.php b/cake/console/libs/tasks/template.php index fcf835492..422b775c1 100644 --- a/cake/console/libs/tasks/template.php +++ b/cake/console/libs/tasks/template.php @@ -23,7 +23,7 @@ class TemplateTask extends Shell { * variables to add to template scope * * @var array - **/ + */ var $templateVars = array(); /** @@ -31,7 +31,7 @@ class TemplateTask extends Shell { * Contains a list of $theme => $path * * @var array - **/ + */ var $templatePaths = array(); /** @@ -39,7 +39,7 @@ class TemplateTask extends Shell { * * @access public * @return void - **/ + */ function initialize() { $this->templatePaths = $this->_findThemes(); } @@ -50,7 +50,7 @@ class TemplateTask extends Shell { * Bake themes are directories not named `skel` inside a `vendors/shells/templates` path. * * @return array Array of bake themes that are installed. - **/ + */ function _findThemes() { $paths = App::path('shells'); $core = array_pop($paths); @@ -128,7 +128,7 @@ class TemplateTask extends Shell { * @param string $vars Additional vars to set to template scope. * @access public * @return contents of generated code template - **/ + */ function generate($directory, $filename, $vars = null) { if ($vars !== null) { $this->set($vars); @@ -156,7 +156,7 @@ class TemplateTask extends Shell { * If there is more than one installed theme user interaction will happen * * @return string returns the path to the selected theme. - **/ + */ function getThemePath() { if (count($this->templatePaths) == 1) { $paths = array_values($this->templatePaths); @@ -193,7 +193,7 @@ class TemplateTask extends Shell { * @param string $filename lower_case_underscored filename you want. * @access public * @return string filename will exit program if template is not found. - **/ + */ function _findTemplate($path, $directory, $filename) { $themeFile = $path . $directory . DS . $filename . '.ctp'; if (file_exists($themeFile)) { diff --git a/cake/console/libs/tasks/test.php b/cake/console/libs/tasks/test.php index b4a1929da..06cf9c5bb 100644 --- a/cake/console/libs/tasks/test.php +++ b/cake/console/libs/tasks/test.php @@ -46,28 +46,28 @@ class TestTask extends Shell { * Tasks used. * * @var array - **/ + */ var $tasks = array('Template'); /** * class types that methods can be generated for * * @var array - **/ + */ var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper'); /** * Internal list of fixtures that have been added so far. * * @var string - **/ + */ var $_fixtures = array(); /** * Flag for interactive mode * * @var boolean - **/ + */ var $interactive = false; /** @@ -164,7 +164,7 @@ class TestTask extends Shell { * Interact with the user and get their chosen type. Can exit the script. * * @return string Users chosen type. - **/ + */ function getObjectType() { $this->hr(); $this->out(__("Select an object type:", true)); @@ -188,7 +188,7 @@ class TestTask extends Shell { * * @param string $objectType Type of object to list classes for i.e. Model, Controller. * @return string Class name the user chose. - **/ + */ function getClassName($objectType) { $options = App::objects(strtolower($objectType)); $this->out(sprintf(__('Choose a %s class', true), $objectType)); @@ -209,7 +209,7 @@ class TestTask extends Shell { * Currently only model, and controller are supported * * @return boolean - **/ + */ function typeCanDetectFixtures($type) { $type = strtolower($type); return ($type == 'controller' || $type == 'model'); @@ -219,7 +219,7 @@ class TestTask extends Shell { * Check if a class with the given type is loaded or can be loaded. * * @return boolean - **/ + */ function isLoadableClass($type, $class) { return App::import($type, $class); } @@ -229,7 +229,7 @@ class TestTask extends Shell { * So that fixtures can be detected * * @return object - **/ + */ function &buildTestSubject($type, $class) { ClassRegistry::flush(); App::import($type, $class); @@ -246,7 +246,7 @@ class TestTask extends Shell { * Gets the real class name from the cake short form. * * @return string Real classname - **/ + */ function getRealClassName($type, $class) { if (strtolower($type) == 'model') { return $class; @@ -260,7 +260,7 @@ class TestTask extends Shell { * * @param string $className Name of class to look at. * @return array Array of method names. - **/ + */ function getTestableMethods($className) { $classMethods = get_class_methods($className); $parentMethods = get_class_methods(get_parent_class($className)); @@ -280,7 +280,7 @@ class TestTask extends Shell { * * @param object The object you want to generate fixtures for. * @return array Array of fixtures to be included in the test. - **/ + */ function generateFixtureList(&$subject) { $this->_fixtures = array(); if (is_a($subject, 'Model')) { @@ -297,7 +297,7 @@ class TestTask extends Shell { * * @return void * @access protected - **/ + */ function _processModel(&$subject) { $this->_addFixture($subject->name); $associated = $subject->getAssociated(); @@ -321,7 +321,7 @@ class TestTask extends Shell { * * @return void * @access protected - **/ + */ function _processController(&$subject) { $subject->constructClasses(); $models = array(Inflector::classify($subject->name)); @@ -339,7 +339,7 @@ class TestTask extends Shell { * * @return void * @access protected - **/ + */ function _addFixture($name) { $parent = get_parent_class($name); $prefix = 'app.'; @@ -355,7 +355,7 @@ class TestTask extends Shell { * Interact with the user to get additional fixtures they want to use. * * @return void - **/ + */ function getUserFixtures() { $proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n'); $fixtures = array(); @@ -373,7 +373,7 @@ class TestTask extends Shell { * Controllers require a mock class. * * @return boolean - **/ + */ function hasMockClass($type) { $type = strtolower($type); return $type == 'controller'; @@ -383,7 +383,7 @@ class TestTask extends Shell { * Generate a constructor code snippet for the type and classname * * @return string Constructor snippet for the thing you are building. - **/ + */ function generateConstructor($type, $fullClassName) { $type = strtolower($type); if ($type == 'model') { @@ -401,7 +401,7 @@ class TestTask extends Shell { * and get the plugin path if needed. * * @return string filename the test should be created on - **/ + */ function testCaseFileName($type, $className) { $path = $this->path; if (isset($this->plugin)) { @@ -418,7 +418,7 @@ class TestTask extends Shell { * Show help file. * * @return void - **/ + */ function help() { $this->hr(); $this->out("Usage: cake bake test "); diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 1bad40f5a..5a1b0a0b3 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -144,7 +144,7 @@ class ViewTask extends Shell { * Get a list of actions that can / should have views baked for them. * * @return array Array of action names that should be baked - **/ + */ function _methodsToBake() { $methods = array_diff( array_map('strtolower', get_class_methods($this->controllerName . 'Controller')), @@ -176,7 +176,7 @@ class ViewTask extends Shell { * Bake All views for All controllers. * * @return void - **/ + */ function all() { $this->Controller->interactive = false; $tables = $this->Controller->listAll($this->connection, false); @@ -308,7 +308,7 @@ class ViewTask extends Shell { * * @param array $actions Array of actions to make files for. * @return void - **/ + */ function bakeActions($actions, $vars) { foreach ($actions as $action) { $content = $this->getContent($action, $vars); @@ -320,7 +320,7 @@ class ViewTask extends Shell { * handle creation of baking a custom action view file * * @return void - **/ + */ function customAction() { $action = ''; while ($action == '') { diff --git a/cake/libs/cake_log.php b/cake/libs/cake_log.php index 571cb1c4b..a2300abb2 100644 --- a/cake/libs/cake_log.php +++ b/cake/libs/cake_log.php @@ -60,7 +60,7 @@ class CakeLog { * * @var array * @access protected - **/ + */ var $_streams = array(); /** @@ -68,7 +68,7 @@ class CakeLog { * * @return void * @static - **/ + */ function &getInstance() { static $instance = array(); if (!isset($instance[0])) { @@ -85,7 +85,7 @@ class CakeLog { * @param array $config Array of configuration information for the logger * @return boolean success of configuration. * @static - **/ + */ function config($key, $config) { if (empty($config['engine'])) { trigger_error(__('Missing logger classname', true), E_USER_WARNING); @@ -107,7 +107,7 @@ class CakeLog { * * @return mixed boolean false on any failures, string of classname to use if search was successful.\ * @access protected - **/ + */ function _getLogger($loggerName) { $plugin = null; if (strpos($loggerName, '.') !== false) { @@ -139,7 +139,7 @@ class CakeLog { * * @return array * @static - **/ + */ function streams() { $self = CakeLog::getInstance(); return array_keys($self->_streams); @@ -152,7 +152,7 @@ class CakeLog { * @param string $keyname Key name of callable to remove. * @return void * @static - **/ + */ function remove($streamName) { $self = CakeLog::getInstance(); unset($self->_streams[$streamName]); @@ -167,7 +167,7 @@ class CakeLog { * @param array $config Array of config information for the LogStream * @return boolean success * @static - **/ + */ function addStream($key, $config) { $self = CakeLog::getInstance(); $self->_streams[$key] = $config; @@ -178,7 +178,7 @@ class CakeLog { * * @return void * @access protected - **/ + */ function _autoConfig() { if (!class_exists('FileLog')) { App::import('Core', 'log/FileLog'); @@ -235,7 +235,7 @@ class CakeLog { * @param integer $line Line that triggered the error * @param array $context Context * @return void - **/ + */ function handleError($code, $description, $file = null, $line = null, $context = null) { if ($code === 2048 || $code === 8192) { return; diff --git a/cake/libs/cake_session.php b/cake/libs/cake_session.php index 357c2ec67..957af54ff 100644 --- a/cake/libs/cake_session.php +++ b/cake/libs/cake_session.php @@ -244,7 +244,7 @@ class CakeSession extends Object { * * @return boolean * @deprecated Use CakeSession::delete instead - **/ + */ function del($name) { trigger_error('CakeSession::del() is deprecated, use CakeSession::delete() instead.', E_USER_WARNING); return $this->delete($name); diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 3bdc14e8f..fb86ed3b3 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -685,7 +685,7 @@ class App extends Object { * * @param string $plugin CamelCased plugin name to find the path of. * @return string full path to the plugin. - **/ + */ function pluginPath($plugin) { $_this =& App::getInstance(); $pluginDir = Inflector::underscore($plugin); diff --git a/cake/libs/controller/component.php b/cake/libs/controller/component.php index f4ed6a4cb..081c81a5e 100644 --- a/cake/libs/controller/component.php +++ b/cake/libs/controller/component.php @@ -56,7 +56,7 @@ class Component extends Object { * * @var array * @access private - **/ + */ var $__settings = array(); /** diff --git a/cake/libs/controller/components/cookie.php b/cake/libs/controller/components/cookie.php index 9ddfc24ca..62331b1e2 100644 --- a/cake/libs/controller/components/cookie.php +++ b/cake/libs/controller/components/cookie.php @@ -263,7 +263,7 @@ class CookieComponent extends Object { /** * @deprecated use delete() - **/ + */ function del($key) { trigger_error('Deprecated method, use CookieComponent::delete instead', E_USER_WARNING); return $this->delete($key); diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index ba82dd919..2ae7d1393 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -37,7 +37,7 @@ class Inflector { * * @var array * @access protected - **/ + */ var $_plural = array( 'rules' => array( '/(s)tatus$/i' => '\1\2tatuses', @@ -105,7 +105,7 @@ class Inflector { * * @var array * @access protected - **/ + */ var $_singular = array( 'rules' => array( '/(s)tatuses$/i' => '\1\2tatus', @@ -155,7 +155,7 @@ class Inflector { * * @var array * @access protected - **/ + */ var $_uninflected = array( 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps', @@ -176,7 +176,7 @@ class Inflector { * * @var array * @access protected - **/ + */ var $_pluralized = array(); /** @@ -184,7 +184,7 @@ class Inflector { * * @var array * @access protected - **/ + */ var $_singularized = array(); /** diff --git a/cake/libs/log/file_log.php b/cake/libs/log/file_log.php index 76c0e50b9..e726bf231 100644 --- a/cake/libs/log/file_log.php +++ b/cake/libs/log/file_log.php @@ -31,7 +31,7 @@ class FileLog { * Path to save log files on. * * @var string - **/ + */ var $_path = null; /** @@ -43,7 +43,7 @@ class FileLog { * * @param array $options Options for the FileLog, see above. * @return void - **/ + */ function FileLog($options = array()) { $options += array('path' => LOGS); $this->_path = $options['path']; @@ -55,7 +55,7 @@ class FileLog { * @param string $type The type of log you are making. * @param string $message The message you want to log. * @return boolean success of write. - **/ + */ function write($type, $message) { $debugTypes = array('notice', 'info', 'debug'); diff --git a/cake/libs/magic_db.php b/cake/libs/magic_db.php index fd8965851..feb780b0e 100644 --- a/cake/libs/magic_db.php +++ b/cake/libs/magic_db.php @@ -36,7 +36,7 @@ class MagicDb extends Object { * Holds the parsed MagicDb for this class instance * * @var array - **/ + */ var $db = array(); /** @@ -45,7 +45,7 @@ class MagicDb extends Object { * @var $magicDb mixed Can be an array containing the db, a magic db as a string, or a filename pointing to a magic db in .db or magic.db.php format * @return boolean Returns false if reading / validation failed or true on success. * @author Felix - **/ + */ function read($magicDb = null) { if (!is_string($magicDb) && !is_array($magicDb)) { return false; diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 28008cbd2..82b9bdafa 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -63,7 +63,7 @@ class CakeSchema extends Object { * plugin name. * * @var string - **/ + */ var $plugin = null; /** @@ -382,7 +382,7 @@ class CakeSchema extends Object { * @param string $table Table name you want returned. * @param array $fields Array of field information to generate the table with. * @return string Variable declaration for a schema class - **/ + */ function generateTable($table, $fields) { $out = "\tvar \${$table} = array(\n"; if (is_array($fields)) { @@ -573,7 +573,7 @@ class CakeSchema extends Object { * @param array $new New indexes * @param array $old Old indexes * @return mixed False on failure, or an array of parameters to add & drop. - **/ + */ function _compareTableParameters($new, $old) { if (!is_array($new) || !is_array($old)) { return false; diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index 1e0d904ec..b4742cdfa 100644 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -404,7 +404,7 @@ class DataSource extends Object { * before establishing a connection. * * @return boolean Whether or not the Datasources conditions for use are met. - **/ + */ function enabled() { return true; } diff --git a/cake/libs/model/datasources/dbo/dbo_adodb.php b/cake/libs/model/datasources/dbo/dbo_adodb.php index ae9c20b81..ec4f2a763 100644 --- a/cake/libs/model/datasources/dbo/dbo_adodb.php +++ b/cake/libs/model/datasources/dbo/dbo_adodb.php @@ -123,7 +123,7 @@ class DboAdodb extends DboSource { * Check that AdoDB is available. * * @return boolean - **/ + */ function enabled() { return function_exists('NewADOConnection'); } diff --git a/cake/libs/model/datasources/dbo/dbo_db2.php b/cake/libs/model/datasources/dbo/dbo_db2.php index 1f44cb03a..25e4f0d0d 100644 --- a/cake/libs/model/datasources/dbo/dbo_db2.php +++ b/cake/libs/model/datasources/dbo/dbo_db2.php @@ -144,7 +144,7 @@ class DboDb2 extends DboSource { * Check that the DB2 extension is installed/loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('ibm_db2'); } diff --git a/cake/libs/model/datasources/dbo/dbo_firebird.php b/cake/libs/model/datasources/dbo/dbo_firebird.php index cfafb9f0c..d5a00c133 100644 --- a/cake/libs/model/datasources/dbo/dbo_firebird.php +++ b/cake/libs/model/datasources/dbo/dbo_firebird.php @@ -117,7 +117,7 @@ class DboFirebird extends DboSource { * Firebird Transaction commands. * * @var array - **/ + */ var $_commands = array( 'begin' => 'SET TRANSACTION', 'commit' => 'COMMIT', @@ -143,7 +143,7 @@ class DboFirebird extends DboSource { * Check that the interbase extension is loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('interbase'); } diff --git a/cake/libs/model/datasources/dbo/dbo_mssql.php b/cake/libs/model/datasources/dbo/dbo_mssql.php index b698f1c97..1424332f4 100644 --- a/cake/libs/model/datasources/dbo/dbo_mssql.php +++ b/cake/libs/model/datasources/dbo/dbo_mssql.php @@ -162,7 +162,7 @@ class DboMssql extends DboSource { * Check that MsSQL is installed/loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('mssql'); } diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 01ca7cf4d..f4b77f0a3 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -352,7 +352,7 @@ class DboMysqlBase extends DboSource { * @param array $parameters Parameters to add & drop. * @return array Array of table property alteration statementes. * @todo Implement this method. - **/ + */ function _alterTableParameters($table, $parameters) { if (isset($parameters['change'])) { return $this->buildTableParameters($parameters['change']); @@ -530,7 +530,7 @@ class DboMysql extends DboMysqlBase { * Check whether the MySQL extension is installed/loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('mysql'); } diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php index f1b45020b..6826024b2 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysqli.php +++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php @@ -87,7 +87,7 @@ class DboMysqli extends DboMysqlBase { * Check that MySQLi is installed/enabled * * @return boolean - **/ + */ function enabled() { return extension_loaded('mysqli'); } diff --git a/cake/libs/model/datasources/dbo/dbo_odbc.php b/cake/libs/model/datasources/dbo/dbo_odbc.php index 6cde21b24..a53687ad9 100644 --- a/cake/libs/model/datasources/dbo/dbo_odbc.php +++ b/cake/libs/model/datasources/dbo/dbo_odbc.php @@ -110,7 +110,7 @@ class DboOdbc extends DboSource { * Check if the ODBC extension is installed/loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('odbc'); } diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index ac2861373..33c97c815 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -127,7 +127,7 @@ class DboPostgres extends DboSource { * Check if PostgreSQL is enabled/loaded * * @return boolean - **/ + */ function enabled() { return extension_loaded('pgsql'); } diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index 0932303a6..f431f540c 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php @@ -141,7 +141,7 @@ class DboSqlite extends DboSource { * Check that SQLite is enabled/installed * * @return boolean - **/ + */ function enabled() { return extension_loaded('sqlite'); } diff --git a/cake/libs/model/datasources/dbo/dbo_sybase.php b/cake/libs/model/datasources/dbo/dbo_sybase.php index 023beb28b..0551a92b3 100644 --- a/cake/libs/model/datasources/dbo/dbo_sybase.php +++ b/cake/libs/model/datasources/dbo/dbo_sybase.php @@ -109,7 +109,7 @@ class DboSybase extends DboSource { * Check that one of the sybase extensions is installed * * @return boolean - **/ + */ function enabled() { return extension_loaded('sybase') || extension_loaded('sybase_ct'); } diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 72bdbdc05..8fd796675 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -495,7 +495,7 @@ class DboSource extends DataSource { * * @param boolean $sorted Get the queries sorted by time taken, defaults to false. * @return array Array of queries run as an array - **/ + */ function getLog($sorted = false) { if ($sorted) { $log = sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC); @@ -967,7 +967,7 @@ class DboSource extends DataSource { * @param object $model Model being merged onto * @param object $linkModel Model being merged * @return void - **/ + */ function __mergeHasMany(&$resultSet, $merge, $association, &$model, &$linkModel) { foreach ($resultSet as $i => $value) { $count = 0; @@ -2483,7 +2483,7 @@ class DboSource extends DataSource { * @param array $columnData The array of column data. * @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common * @return string a built column with the field parameters added. - **/ + */ function _buildFieldParameters($columnString, $columnData, $position) { foreach ($this->fieldParameters as $paramName => $value) { if (isset($columnData[$paramName]) && $value['position'] == $position) { diff --git a/cake/libs/router.php b/cake/libs/router.php index 3484c11d5..0b94b3907 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -161,7 +161,7 @@ class Router { * Builds __prefixes * * @return void - **/ + */ function Router() { $this->__setPrefixes(); } @@ -173,7 +173,7 @@ class Router { * @return void * @access private * @todo Remove support for Routing.admin in future versions. - **/ + */ function __setPrefixes() { $routing = Configure::read('Routing'); if (!empty($routing['admin'])) { diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index c1c57f58d..030b17fe1 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -225,7 +225,7 @@ class Helper extends Overloadable { * * @param string $path The file path to timestamp, the path must be inside WWW_ROOT * @return string Path with a timestamp added, or not. - **/ + */ function assetTimestamp($path) { $timestampEnabled = ( (Configure::read('Asset.timestamp') === true && Configure::read() > 0) || diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index c7492558b..f86c84087 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -143,14 +143,14 @@ class HtmlHelper extends AppHelper { * * @var array * @access private - **/ + */ var $__includedScripts = array(); /** * Options for the currently opened script block buffer if any. * * @var array * @access protected - **/ + */ var $_scriptBlockOptions = array(); /** * Document type definitions @@ -436,7 +436,7 @@ class HtmlHelper extends AppHelper { * @param mixed $options Array of options, and html attributes see above. If boolean sets $options['inline'] = value * @return mixed String of