diff --git a/app/webroot/css.php b/app/webroot/css.php index 7845c0815..23fc7b0e8 100644 --- a/app/webroot/css.php +++ b/app/webroot/css.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/app/webroot/css/cake.generic.css b/app/webroot/css/cake.generic.css index e8bdab629..77ca75e80 100644 --- a/app/webroot/css/cake.generic.css +++ b/app/webroot/css/cake.generic.css @@ -189,7 +189,7 @@ dl { margin: 0em 0em; width: 60%; } -dl.altrow { +dl .altrow { background: #f4f4f4; } dt { diff --git a/app/webroot/test.php b/app/webroot/test.php index ce4ce7e83..b87686602 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -2,8 +2,6 @@ /** * Web Access Frontend for TestSuite * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/console/error.php b/cake/console/error.php index 9ad3b19d9..4ccfcf058 100644 --- a/cake/console/error.php +++ b/cake/console/error.php @@ -2,8 +2,6 @@ /** * ErrorHandler for Console Shells * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/console.php b/cake/console/libs/console.php index 102fe901d..954d973d3 100644 --- a/cake/console/libs/console.php +++ b/cake/console/libs/console.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/i18n.php b/cake/console/libs/i18n.php index 08aab9afb..8dacbc948 100644 --- a/cake/console/libs/i18n.php +++ b/cake/console/libs/i18n.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index 41b24200e..7fe376a70 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -2,8 +2,6 @@ /** * Base class for Shells * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index f99660f2f..d84294cc3 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -2,8 +2,6 @@ /** * The ControllerTask handles creating and updating controller files. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -471,12 +469,12 @@ class ControllerTask extends Shell { $this->out("\t(index, view, add, edit, delete)"); $this->out(); $this->out("controller admin"); - $this->out("\tbakes a controller with basic crud actions for"); - $this->out("\tConfigure::read('Routing.admin') methods."); + $this->out("\tbakes a controller with basic crud actions for one of the"); + $this->out("\tConfigure::read('Routing.prefixes') methods."); $this->out(); $this->out("controller public admin"); - $this->out("\tbakes a controller with basic crud actions for"); - $this->out("\tConfigure::read('Routing.admin') and non admin methods."); + $this->out("\tbakes a controller with basic crud actions for one"); + $this->out("\tConfigure::read('Routing.prefixes') and non admin methods."); $this->out("\t(index, view, add, edit, delete,"); $this->out("\tadmin_index, admin_view, admin_edit, admin_add, admin_delete)"); $this->out(); diff --git a/cake/console/libs/tasks/db_config.php b/cake/console/libs/tasks/db_config.php index b9253558a..d84af2ced 100644 --- a/cake/console/libs/tasks/db_config.php +++ b/cake/console/libs/tasks/db_config.php @@ -2,8 +2,6 @@ /** * The DbConfig Task handles creating and updating the database.php * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/tasks/extract.php b/cake/console/libs/tasks/extract.php index f198d16f4..8eb8d4f4a 100644 --- a/cake/console/libs/tasks/extract.php +++ b/cake/console/libs/tasks/extract.php @@ -2,8 +2,6 @@ /** * Language string extractor * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 78cb2f6e3..3e12e9d1f 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -2,8 +2,6 @@ /** * The ModelTask handles creating and updating models files. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/tasks/plugin.php b/cake/console/libs/tasks/plugin.php index 75861b2f8..ffd05a0d7 100644 --- a/cake/console/libs/tasks/plugin.php +++ b/cake/console/libs/tasks/plugin.php @@ -2,8 +2,6 @@ /** * The Plugin Task handles creating an empty plugin, ready to be used * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 03cc23d65..ec6aaf4ae 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -251,7 +251,7 @@ class ProjectTask extends Shell { } /** - * Enables Configure::read('Routing.admin') in /app/config/core.php + * Enables Configure::read('Routing.prefixes') in /app/config/core.php * * @param string $name Name to use as admin routing * @return boolean Success @@ -275,7 +275,7 @@ class ProjectTask extends Shell { } /** - * Checks for Configure::read('Routing.admin') and forces user to input it if not enabled + * Checks for Configure::read('Routing.prefixes') and forces user to input it if not enabled * * @return string Admin route to use * @access public diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 7703bd7da..62cb1c82c 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -2,8 +2,6 @@ /** * The View Tasks handles creating and updating view files. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/templates/default/views/form.ctp b/cake/console/templates/default/views/form.ctp index 8095f6478..a86f034cc 100644 --- a/cake/console/templates/default/views/form.ctp +++ b/cake/console/templates/default/views/form.ctp @@ -24,7 +24,7 @@ Form->input('{$field}');\n"; diff --git a/cake/console/templates/skel/webroot/css.php b/cake/console/templates/skel/webroot/css.php index 407eaabbc..028310262 100644 --- a/cake/console/templates/skel/webroot/css.php +++ b/cake/console/templates/skel/webroot/css.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/templates/skel/webroot/css/cake.generic.css b/cake/console/templates/skel/webroot/css/cake.generic.css index 4fe85cded..6c68821e9 100644 --- a/cake/console/templates/skel/webroot/css/cake.generic.css +++ b/cake/console/templates/skel/webroot/css/cake.generic.css @@ -190,7 +190,7 @@ dl { margin: 0em 0em; width: 60%; } -dl.altrow { +dl .altrow { background: #f4f4f4; } dt { diff --git a/cake/console/templates/skel/webroot/index.php b/cake/console/templates/skel/webroot/index.php index a3c5a246e..ebb3c6c72 100644 --- a/cake/console/templates/skel/webroot/index.php +++ b/cake/console/templates/skel/webroot/index.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/console/templates/skel/webroot/test.php b/cake/console/templates/skel/webroot/test.php index d7e0f8516..3b1becf8c 100644 --- a/cake/console/templates/skel/webroot/test.php +++ b/cake/console/templates/skel/webroot/test.php @@ -2,8 +2,6 @@ /** * Web Access Frontend for TestSuite * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 10c7527d9..82a4b9b17 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -115,13 +115,11 @@ class Dispatcher extends Object { $url = $this->getUrl(); $this->params = array_merge($this->parseParams($url), $additionalParams); } - $this->here = $this->base . '/' . $url; if ($this->cached($url)) { $this->_stop(); } - $controller =& $this->__getController(); if (!is_object($controller)) { @@ -133,7 +131,6 @@ class Dispatcher extends Object { 'base' => $this->base ))); } - $privateAction = $this->params['action'][0] === '_'; $prefixes = Router::prefixes(); @@ -159,7 +156,6 @@ class Dispatcher extends Object { 'base' => $this->base ))); } - $controller->base = $this->base; $controller->here = $this->here; $controller->webroot = $this->webroot; @@ -369,21 +365,21 @@ class Dispatcher extends Object { $this->webroot = $base .'/'; return $base; } - $file = '/' . basename($baseUrl); - $base = dirname($baseUrl); + $file = '/' . basename($baseUrl); + $base = dirname($baseUrl); + + if ($base === DS || $base === '.') { + $base = ''; + } + $this->webroot = $base .'/'; - if ($base === DS || $base === '.') { - $base = ''; - } - $this->webroot = $base .'/'; - - if (strpos($this->webroot, $dir) === false) { - $this->webroot .= $dir . '/' ; - } - if (strpos($this->webroot, $webroot) === false) { - $this->webroot .= $webroot . '/'; - } - return $base . $file; + if (strpos($this->webroot, $dir) === false) { + $this->webroot .= $dir . '/' ; + } + if (strpos($this->webroot, $webroot) === false) { + $this->webroot .= $webroot . '/'; + } + return $base . $file; } /** @@ -601,14 +597,15 @@ class Dispatcher extends Object { $this->_stop(); } App::import('View', 'Media', false); - $Media = new MediaView(); + $controller = null; + $Media = new MediaView($controller); $ext = array_pop(explode('.', $url)); - + if (isset($Media->mimeType[$ext])) { + $pos = 0; $parts = explode('/', $url); - if ($parts[0] === 'css' || $parts[0] === 'js' || $parts[0] === 'img') { - $pos = 0; - } elseif ($parts[0] === 'theme') { + + if ($parts[0] === 'theme') { $pos = strlen($parts[0] . $parts[1]) + 1; } elseif (count($parts) > 2) { $pos = strlen($parts[0]); @@ -630,10 +627,10 @@ class Dispatcher extends Object { if (strpos($plugin, '/') !== false) { list($plugin, $theme) = explode('/', $plugin); $themePaths = App::path('views'); - + foreach ($themePaths as $viewPath) { $path = $viewPath . 'themed' . DS . $theme . DS . 'webroot' . DS; - + if ($plugin === 'theme' && (is_file($path . $url) && file_exists($path . $url))) { $assetFile = $path . $url; $matched = true; diff --git a/cake/libs/class_registry.php b/cake/libs/class_registry.php index 4d9e98f16..1a879fc2f 100644 --- a/cake/libs/class_registry.php +++ b/cake/libs/class_registry.php @@ -241,7 +241,7 @@ class ClassRegistry { * Return object which corresponds to given key. * * @param string $key Key of object to look for - * @return mixed Object stored in registry + * @return mixed Object stored in registry or boolean false if the object does not exist. * @access public * @static */ diff --git a/cake/libs/configure.php b/cake/libs/configure.php index b60ba74a0..450d0a8e0 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -390,7 +390,7 @@ class Configure extends Object { $libPaths = $modelPaths = $behaviorPaths = $controllerPaths = $componentPaths = $viewPaths = $helperPaths = $pluginPaths = $vendorPaths = $localePaths = $shellPaths = null; if ($boot) { - Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR)); + Configure::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT)); if (!include(CONFIGS . 'core.php')) { 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); diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index b14c766e4..e05cdc8d8 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -259,19 +259,21 @@ class AuthComponent extends Object { $this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud)); $this->_methods = $controller->methods; - $admin = Configure::read('Routing.admin'); - if (!empty($admin)) { - $this->actionMap = array_merge($this->actionMap, array( - $admin . '_index' => 'read', - $admin . '_add' => 'create', - $admin . '_edit' => 'update', - $admin . '_view' => 'read', - $admin . '_remove' => 'delete', - $admin . '_create' => 'create', - $admin . '_read' => 'read', - $admin . '_update' => 'update', - $admin . '_delete' => 'delete' - )); + $prefixes = Router::prefixes(); + if (!empty($prefixes)) { + foreach ($prefixes as $prefix) { + $this->actionMap = array_merge($this->actionMap, array( + $prefix . '_index' => 'read', + $prefix . '_add' => 'create', + $prefix . '_edit' => 'update', + $prefix . '_view' => 'read', + $prefix . '_remove' => 'delete', + $prefix . '_create' => 'create', + $prefix . '_read' => 'read', + $prefix . '_update' => 'update', + $prefix . '_delete' => 'delete' + )); + } } if (Configure::read() > 0) { App::import('Debugger'); diff --git a/cake/libs/controller/components/cookie.php b/cake/libs/controller/components/cookie.php index 62331b1e2..d6783c3bd 100644 --- a/cake/libs/controller/components/cookie.php +++ b/cake/libs/controller/components/cookie.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index 21473e63c..8eb16fec4 100644 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index e9937663a..20de444b9 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs.controller.components */ diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 9de802e52..6e913e007 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -947,11 +947,12 @@ class Controller extends Object { $op = ''; } + $arrayOp = is_array($op); foreach ($data as $model => $fields) { foreach ($fields as $field => $value) { $key = $model.'.'.$field; $fieldOp = $op; - if (is_array($op)) { + if ($arrayOp) { if (array_key_exists($key, $op)) { $fieldOp = $op[$key]; } elseif (array_key_exists($field, $op)) { diff --git a/cake/libs/i18n.php b/cake/libs/i18n.php index 1a4a5d41e..9ffa9b601 100644 --- a/cake/libs/i18n.php +++ b/cake/libs/i18n.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -28,8 +26,6 @@ App::import('Core', 'l10n'); /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs */ diff --git a/cake/libs/l10n.php b/cake/libs/l10n.php index 615bc286e..9d84da4c9 100644 --- a/cake/libs/l10n.php +++ b/cake/libs/l10n.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs */ diff --git a/cake/libs/model/behaviors/acl.php b/cake/libs/model/behaviors/acl.php index 046ee805c..8bc2c3969 100644 --- a/cake/libs/model/behaviors/acl.php +++ b/cake/libs/model/behaviors/acl.php @@ -23,8 +23,6 @@ /** * Short description for file * - * Long description for file - * * @package cake * @subpackage cake.cake.libs.model.behaviors */ diff --git a/cake/libs/model/behaviors/translate.php b/cake/libs/model/behaviors/translate.php index 7b2baaa66..e3de72fe3 100644 --- a/cake/libs/model/behaviors/translate.php +++ b/cake/libs/model/behaviors/translate.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs.model.behaviors */ diff --git a/cake/libs/model/behaviors/tree.php b/cake/libs/model/behaviors/tree.php index cf7be124f..8f6ba49e7 100644 --- a/cake/libs/model/behaviors/tree.php +++ b/cake/libs/model/behaviors/tree.php @@ -140,15 +140,6 @@ class TreeBehavior extends ModelBehavior { function beforeSave(&$Model) { extract($this->settings[$Model->alias]); - if (isset($Model->data[$Model->alias][$Model->primaryKey])) { - if ($Model->data[$Model->alias][$Model->primaryKey]) { - if (!$Model->id) { - $Model->id = $Model->data[$Model->alias][$Model->primaryKey]; - } - } - unset($Model->data[$Model->alias][$Model->primaryKey]); - } - $this->_addToWhitelist($Model, array($left, $right)); if (!$Model->id) { if (array_key_exists($parent, $Model->data[$Model->alias]) && $Model->data[$Model->alias][$parent]) { diff --git a/cake/libs/model/connection_manager.php b/cake/libs/model/connection_manager.php index 49aa0f16a..2686aded2 100644 --- a/cake/libs/model/connection_manager.php +++ b/cake/libs/model/connection_manager.php @@ -25,8 +25,6 @@ include_once CONFIGS . 'database.php'; /** * Manages loaded instances of DataSource objects * - * Long description for file - * * @package cake * @subpackage cake.cake.libs.model */ diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index b4742cdfa..966dab87a 100644 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -2,8 +2,6 @@ /** * DataSource base class * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * DataSource base class * - * Long description for file - * * @package cake * @subpackage cake.cake.libs.model.datasources */ diff --git a/cake/libs/model/datasources/dbo/dbo_adodb.php b/cake/libs/model/datasources/dbo/dbo_adodb.php deleted file mode 100644 index bda6157b5..000000000 --- a/cake/libs/model/datasources/dbo/dbo_adodb.php +++ /dev/null @@ -1,547 +0,0 @@ - 'adodb' . DS . 'adodb.inc.php')); - -/** - * AdoDB DBO implementation. - * - * Database abstraction implementation for the AdoDB library. - * - * @package cake - * @subpackage cake.cake.libs.model.datasources.dbo - */ -class DboAdodb extends DboSource { - -/** - * Enter description here... - * - * @var string - */ - var $description = "ADOdb DBO Driver"; - -/** - * ADOConnection object with which we connect. - * - * @var ADOConnection The connection object. - * @access private - */ - var $_adodb = null; - -/** - * Array translating ADOdb column MetaTypes to cake-supported metatypes - * - * @var array - * @access private - */ - var $_adodbColumnTypes = array( - 'string' => 'C', - 'text' => 'X', - 'date' => 'D', - 'timestamp' => 'T', - 'time' => 'T', - 'datetime' => 'T', - 'boolean' => 'L', - 'float' => 'N', - 'integer' => 'I', - 'binary' => 'R', - ); - -/** - * ADOdb column definition - * - * @var array - */ - var $columns = array( - 'primary_key' => array('name' => 'R', 'limit' => 11), - 'string' => array('name' => 'C', 'limit' => '255'), - 'text' => array('name' => 'X'), - 'integer' => array('name' => 'I', 'limit' => '11', 'formatter' => 'intval'), - 'float' => array('name' => 'N', 'formatter' => 'floatval'), - 'timestamp' => array('name' => 'T', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'), - 'time' => array('name' => 'T', 'format' => 'H:i:s', 'formatter' => 'date'), - 'datetime' => array('name' => 'T', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'), - 'date' => array('name' => 'D', 'format' => 'Y-m-d', 'formatter' => 'date'), - 'binary' => array('name' => 'B'), - 'boolean' => array('name' => 'L', 'limit' => '1') - ); - -/** - * Connects to the database using options in the given configuration array. - * - * @param array $config Configuration array for connecting - */ - function connect() { - $config = $this->config; - $persistent = strrpos($config['connect'], '|p'); - - if ($persistent === false) { - $adodb_driver = $config['connect']; - $connect = 'Connect'; - } else { - $adodb_driver = substr($config['connect'], 0, $persistent); - $connect = 'PConnect'; - } - if (!$this->enabled()) { - return false; - } - $this->_adodb = NewADOConnection($adodb_driver); - - $this->_adodbDataDict = NewDataDictionary($this->_adodb, $adodb_driver); - - $this->startQuote = $this->_adodb->nameQuote; - $this->endQuote = $this->_adodb->nameQuote; - - $this->connected = $this->_adodb->$connect($config['host'], $config['login'], $config['password'], $config['database']); - $this->_adodbMetatyper = &$this->_adodb->execute('Select 1'); - return $this->connected; - } - -/** - * Check that AdoDB is available. - * - * @return boolean - */ - function enabled() { - return function_exists('NewADOConnection'); - } -/** - * Disconnects from database. - * - * @return boolean True if the database could be disconnected, else false - */ - function disconnect() { - return $this->_adodb->Close(); - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return resource Result resource identifier - */ - function _execute($sql) { - global $ADODB_FETCH_MODE; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - return $this->_adodb->execute($sql); - } - -/** - * Returns a row from current resultset as an array . - * - * @return array The fetched row as an array - */ - function fetchRow($sql = null) { - if (!empty($sql) && is_string($sql) && strlen($sql) > 5) { - if (!$this->execute($sql)) { - return null; - } - } - - if (!$this->hasResult()) { - return null; - } else { - $resultRow = $this->_result->FetchRow(); - $this->resultSet($resultRow); - return $this->fetchResult(); - } - } - -/** - * Begin a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions). - */ - function begin(&$model) { - if (parent::begin($model)) { - if ($this->_adodb->BeginTrans()) { - $this->_transactionStarted = true; - return true; - } - } - return false; - } - -/** - * Commit a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function commit(&$model) { - if (parent::commit($model)) { - $this->_transactionStarted = false; - return $this->_adodb->CommitTrans(); - } - return false; - } - -/** - * Rollback a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function rollback(&$model) { - if (parent::rollback($model)) { - return $this->_adodb->RollbackTrans(); - } - return false; - } - -/** - * Returns an array of tables in the database. If there are no tables, an error is raised and the application exits. - * - * @return array Array of tablenames in the database - */ - function listSources() { - $tables = $this->_adodb->MetaTables('TABLES'); - - if (!count($tables) > 0) { - trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE); - exit; - } - return $tables; - } - -/** - * Returns an array of the fields in the table used by the given model. - * - * @param AppModel $model Model object - * @return array Fields in table. Keys are name and type - */ - function describe(&$model) { - $cache = parent::describe($model); - if ($cache != null) { - return $cache; - } - - $fields = false; - $cols = $this->_adodb->MetaColumns($this->fullTableName($model, false)); - - foreach ($cols as $column) { - $fields[$column->name] = array( - 'type' => $this->column($column->type), - 'null' => !$column->not_null, - 'length' => $column->max_length, - ); - if ($column->has_default) { - $fields[$column->name]['default'] = $column->default_value; - } - if ($column->primary_key == 1) { - $fields[$column->name]['key'] = 'primary'; - } - } - - $this->__cacheDescription($this->fullTableName($model, false), $fields); - return $fields; - } - -/** - * Returns a formatted error message from previous database operation. - * - * @return string Error message - */ - function lastError() { - return $this->_adodb->ErrorMsg(); - } - -/** - * Returns number of affected rows in previous database operation, or false if no previous operation exists. - * - * @return integer Number of affected rows - */ - function lastAffected() { - return $this->_adodb->Affected_Rows(); - } - -/** - * Returns number of rows in previous resultset, or false if no previous resultset exists. - * - * @return integer Number of rows in resultset - */ - function lastNumRows() { - return $this->_result ? $this->_result->RecordCount() : false; - } - -/** - * Returns the ID generated from the previous INSERT operation. - * - * @return int - * - * @Returns the last autonumbering ID inserted. Returns false if function not supported. - */ - function lastInsertId() { - return $this->_adodb->Insert_ID(); - } - -/** - * Returns a LIMIT statement in the correct format for the particular database. - * - * @param integer $limit Limit of results returned - * @param integer $offset Offset from which to start results - * @return string SQL limit/offset statement - * @todo Please change output string to whatever select your database accepts. adodb doesn't allow us to get the correct limit string out of it. - */ - function limit($limit, $offset = null) { - if ($limit) { - $rt = ''; - if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { - $rt = ' LIMIT'; - } - - if ($offset) { - $rt .= ' ' . $offset . ','; - } - - $rt .= ' ' . $limit; - return $rt; - } - return null; - // please change to whatever select your database accepts - // adodb doesn't allow us to get the correct limit string out of it - } - -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - $metaTypes = array_flip($this->_adodbColumnTypes); - - $interpreted_type = $this->_adodbMetatyper->MetaType($real); - - if (!isset($metaTypes[$interpreted_type])) { - return 'text'; - } - return $metaTypes[$interpreted_type]; - } - -/** - * Returns a quoted and escaped string of $data for use in an SQL statement. - * - * @param string $data String to be prepared for use in an SQL statement - * @param string $column_type The type of the column into which this data will be inserted - * @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided - * @return string Quoted and escaped data - */ - function value($data, $column = null, $safe = false) { - $parent = parent::value($data, $column, $safe); - if ($parent != null) { - return $parent; - } - - if ($data === null) { - return 'NULL'; - } - - if ($data === '') { - return "''"; - } - return $this->_adodb->qstr($data); - } - -/** - * Generates the fields list of an SQL query. - * - * @param Model $model - * @param string $alias Alias tablename - * @param mixed $fields - * @return array - */ - function fields(&$model, $alias = null, $fields = array(), $quote = true) { - if (empty($alias)) { - $alias = $model->alias; - } - $fields = parent::fields($model, $alias, $fields, false); - - if (!$quote) { - return $fields; - } - $count = count($fields); - - if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false) { - for ($i = 0; $i < $count; $i++) { - if (!preg_match('/^.+\\(.*\\)/', $fields[$i]) && !preg_match('/\s+AS\s+/', $fields[$i])) { - $prepend = ''; - if (strpos($fields[$i], 'DISTINCT') !== false) { - $prepend = 'DISTINCT '; - $fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i])); - } - - if (strrpos($fields[$i], '.') === false) { - $fields[$i] = $prepend . $this->name($alias) . '.' . $this->name($fields[$i]) . ' AS ' . $this->name($alias . '__' . $fields[$i]); - } else { - $build = explode('.', $fields[$i]); - $fields[$i] = $prepend . $this->name($build[0]) . '.' . $this->name($build[1]) . ' AS ' . $this->name($build[0] . '__' . $build[1]); - } - } - } - } - return $fields; - } - -/** - * Build ResultSets and map data - * - * @param array $results - */ - function resultSet(&$results) { - $num_fields = count($results); - $fields = array_keys($results); - $this->results =& $results; - $this->map = array(); - $index = 0; - $j = 0; - - while ($j < $num_fields) { - $columnName = $fields[$j]; - - if (strpos($columnName, '__')) { - $parts = explode('__', $columnName); - $this->map[$index++] = array($parts[0], $parts[1]); - } else { - $this->map[$index++] = array(0, $columnName); - } - $j++; - } - } - -/** - * Fetches the next row from the current result set - * - * @return unknown - */ - function fetchResult() { - if (!empty($this->results)) { - $row = $this->results; - $this->results = null; - } else { - $row = $this->_result->FetchRow(); - } - - if (empty($row)) { - return false; - } - - $resultRow = array(); - $fields = array_keys($row); - $count = count($fields); - $i = 0; - for ($i = 0; $i < $count; $i++) { //$row as $index => $field) { - list($table, $column) = $this->map[$i]; - $resultRow[$table][$column] = $row[$fields[$i]]; - } - return $resultRow; - } - -/** - * Generate a database-native column schema string - * - * @param array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), - * where options can be 'default', 'length', or 'key'. - * @return string - */ - function buildColumn($column) { - $name = $type = null; - extract(array_merge(array('null' => true), $column)); - - if (empty($name) || empty($type)) { - trigger_error('Column name or type not defined in schema', E_USER_WARNING); - return null; - } - - //$metaTypes = array_flip($this->_adodbColumnTypes); - if (!isset($this->_adodbColumnTypes[$type])) { - trigger_error("Column type {$type} does not exist", E_USER_WARNING); - return null; - } - $metaType = $this->_adodbColumnTypes[$type]; - $concreteType = $this->_adodbDataDict->ActualType($metaType); - $real = $this->columns[$type]; - - //UUIDs are broken so fix them. - if ($type == 'string' && isset($real['length']) && $real['length'] == 36) { - $concreteType = 'CHAR'; - } - - $out = $this->name($name) . ' ' . $concreteType; - - if (isset($real['limit']) || isset($real['length']) || isset($column['limit']) || isset($column['length'])) { - if (isset($column['length'])) { - $length = $column['length']; - } elseif (isset($column['limit'])) { - $length = $column['limit']; - } elseif (isset($real['length'])) { - $length = $real['length']; - } else { - $length = $real['limit']; - } - $out .= '(' . $length . ')'; - } - $_notNull = $_default = $_autoInc = $_constraint = $_unsigned = false; - - if (isset($column['key']) && $column['key'] == 'primary' && $type == 'integer') { - $_constraint = ''; - $_autoInc = true; - } elseif (isset($column['key']) && $column['key'] == 'primary') { - $_notNull = ''; - } elseif (isset($column['default']) && isset($column['null']) && $column['null'] == false) { - $_notNull = true; - $_default = $column['default']; - } elseif ( isset($column['null']) && $column['null'] == true) { - $_notNull = false; - $_default = 'NULL'; - } - if (isset($column['default']) && $_default == false) { - $_default = $this->value($column['default']); - } - if (isset($column['null']) && $column['null'] == false) { - $_notNull = true; - } - //use concrete instance of DataDict to make the suffixes for us. - $out .= $this->_adodbDataDict->_CreateSuffix($out, $metaType, $_notNull, $_default, $_autoInc, $_constraint, $_unsigned); - return $out; - - } - -/** - * Checks if the result is valid - * - * @return boolean True if the result is valid, else false - */ - function hasResult() { - return is_object($this->_result) && !$this->_result->EOF; - } -} -?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo/dbo_db2.php b/cake/libs/model/datasources/dbo/dbo_db2.php deleted file mode 100644 index 25e4f0d0d..000000000 --- a/cake/libs/model/datasources/dbo/dbo_db2.php +++ /dev/null @@ -1,594 +0,0 @@ - true, - 'login' => 'db2inst1', - 'password' => '', - 'database' => 'cake', - 'schema' => '', - 'hostname' => '127.0.0.1', - 'port' => '50001', - 'encoding' => 'UTF-8', - 'cataloged' => true, - 'autocommit' => true - ); - -/** - * An array that maps Cake column types to database native column types. - * The mapped information can include a reference to a function that should - * be used to format the data, as well as a string that defines the - * formatting according to that function. - * - * @var array - */ - var $columns = array( - 'primary_key' => array('name' => 'not null generated by default as identity (start with 1, increment by 1)'), - 'string' => array('name' => 'varchar', 'limit' => '255'), - 'text' => array('name' => 'clob'), - 'integer' => array('name' => 'integer', 'limit' => '10', 'formatter' => 'intval'), - 'float' => array('name' => 'double', 'formatter' => 'floatval'), - 'datetime' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'), - 'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'), - 'time' => array('name' => 'time', 'format' => 'H.i.s', 'formatter' => 'date'), - 'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'), - 'binary' => array('name' => 'blob'), - 'boolean' => array('name' => 'smallint', 'limit' => '1') - ); - -/** - * A map for every result mapping tables to columns - * - * @var array result -> ( table -> column ) - */ - var $_resultMap = array(); - -/** - * Connects to the database using options in the given configuration array. - * - * @return boolean True if the database could be connected, else false - */ - function connect() { - $config = $this->config; - $connect = 'db2_connect'; - if ($config['persistent']) { - $connect = 'db2_pconnect'; - } - $this->connected = false; - - if ($config['cataloged']) { - $this->connection = $connect($config['database'], $config['login'], $config['password']); - } else { - $connString = sprintf( - "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;", - $config['database'], - $config['hostname'], - $config['port'], - $config['login'], - $config['password'] - ); - $this->connection = db2_connect($connString, '', ''); - } - - if ($this->connection) { - $this->connected = true; - } - - if ($config['schema'] !== '') { - $this->_execute('SET CURRENT SCHEMA = ' . $config['schema']); - } - return $this->connected; - } - -/** - * Check that the DB2 extension is installed/loaded - * - * @return boolean - */ - function enabled() { - return extension_loaded('ibm_db2'); - } -/** - * Disconnects from database. - * - * @return boolean True if the database could be disconnected, else false - */ - function disconnect() { - @db2_free_result($this->results); - $this->connected = !@db2_close($this->connection); - return !$this->connected; - } - -/** - * Executes given SQL statement. We should use prepare / execute to allow the - * database server to reuse its access plan and increase the efficiency - * of your database access - * - * @param string $sql SQL statement - * @return resource Result resource identifier - * @access protected - */ - function _execute($sql) { - // get result from db - $result = db2_exec($this->connection, $sql); - - if (!is_bool($result)) { - // build table/column map for this result - $map = array(); - $numFields = db2_num_fields($result); - $index = 0; - $j = 0; - $offset = 0; - - while ($j < $numFields) { - $columnName = strtolower(db2_field_name($result, $j)); - $tmp = strpos($sql, '.' . $columnName, $offset); - $tableName = substr($sql, $offset, ($tmp-$offset)); - $tableName = substr($tableName, strrpos($tableName, ' ') + 1); - $map[$index++] = array($tableName, $columnName); - $j++; - $offset = strpos($sql, ' ', $tmp); - } - - $this->_resultMap[$result] = $map; - } - - return $result; - } - -/** - * Returns an array of all the tables in the database. - * Should call parent::listSources twice in the method: - * once to see if the list is cached, and once to cache - * the list if not. - * - * @return array Array of tablenames in the database - */ - function listSources() { - $cache = parent::listSources(); - - if ($cache != null) { - return $cache; - } - $result = db2_tables($this->connection); - $tables = array(); - - while (db2_fetch_row($result)) { - $tables[] = strtolower(db2_result($result, 'TABLE_NAME')); - } - parent::listSources($tables); - return $tables; - } - -/** - * Returns an array of the fields in given table name. - * - * @param Model $model Model object to describe - * @return array Fields in table. Keys are name and type - */ - function &describe(&$model) { - $cache = parent::describe($model); - - if ($cache != null) { - return $cache; - } - $fields = array(); - $result = db2_columns($this->connection, '', '', strtoupper($this->fullTableName($model))); - - while (db2_fetch_row($result)) { - $fields[strtolower(db2_result($result, 'COLUMN_NAME'))] = array( - 'type' => $this->column(strtolower(db2_result($result, 'TYPE_NAME'))), - 'null' => db2_result($result, 'NULLABLE'), - 'default' => db2_result($result, 'COLUMN_DEF'), - 'length' => db2_result($result, 'COLUMN_SIZE') - ); - } - $this->__cacheDescription($model->tablePrefix . $model->table, $fields); - return $fields; - } - -/** - * Returns a quoted name of $data for use in an SQL statement. - * - * @param string $data Name (table.field) to be prepared for use in an SQL statement - * @return string Quoted for MySQL - */ - function name($data) { - return $data; - } - -/** - * Returns a quoted and escaped string of $data for use in an SQL statement. - * - * @param string $data String to be prepared for use in an SQL statement - * @param string $column The column into which this data will be inserted - * @return string Quoted and escaped - * @todo Add logic that formats/escapes data based on column type - */ - function value($data, $column = null, $safe = false) { - $parent = parent::value($data, $column, $safe); - - if ($parent != null) { - return $parent; - } - - if ($data === null) { - return 'NULL'; - } - - if ($data === '') { - return "''"; - } - - switch ($column) { - case 'boolean': - $data = $this->boolean((bool)$data); - break; - case 'integer': - $data = intval($data); - break; - default: - $data = str_replace("'", "''", $data); - break; - } - - if ($column == 'integer' || $column == 'float') { - return $data; - } - return "'" . $data . "'"; - } - -/** - * Not sure about this one, MySQL needs it but does ODBC? Safer just to leave it - * Translates between PHP boolean values and MySQL (faked) boolean values - * - * @param mixed $data Value to be translated - * @return mixed Converted boolean value - */ - function boolean($data) { - if ($data === true || $data === false) { - if ($data === true) { - return 1; - } - return 0; - } else { - if (intval($data !== 0)) { - return true; - } - return false; - } - } - -/** - * Begins a transaction. Returns true if the transaction was - * started successfully, otherwise false. - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions). - */ - function begin(&$model) { - if (parent::begin($model)) { - if (db2_autocommit($this->connection, DB2_AUTOCOMMIT_OFF)) { - $this->_transactionStarted = true; - return true; - } - } - return false; - } - -/** - * Commit a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function commit(&$model) { - if (parent::commit($model)) { - if (db2_commit($this->connection)) { - $this->_transactionStarted = false; - db2_autocommit($this->connection, DB2_AUTOCOMMIT_ON); - return true; - } - } - return false; - } - -/** - * Rollback a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function rollback(&$model) { - if (parent::rollback($model)) { - $this->_transactionStarted = false; - db2_autocommit($this->connection, DB2_AUTOCOMMIT_ON); - return db2_rollback($this->connection); - } - return false; - } - -/** - * Removes Identity (primary key) column from update data before returning to parent - * - * @param Model $model - * @param array $fields - * @param array $values - * @return array - */ - function update(&$model, $fields = array(), $values = array()) { - foreach ($fields as $i => $field) { - if ($field == $model->primaryKey) { - unset ($fields[$i]); - unset ($values[$i]); - break; - } - } - return parent::update($model, $fields, $values); - } - -/** - * Returns a formatted error message from previous database operation. - * DB2 distinguishes between statement and connnection errors so we - * must check for both. - * - * @return string Error message with error number - */ - function lastError() { - if (db2_stmt_error()) { - return db2_stmt_error() . ': ' . db2_stmt_errormsg(); - } elseif (db2_conn_error()) { - return db2_conn_error() . ': ' . db2_conn_errormsg(); - } - return null; - } - -/** - * Returns number of affected rows in previous database operation. If no previous operation exists, - * this returns false. - * - * @return integer Number of affected rows - */ - function lastAffected() { - if ($this->_result) { - return db2_num_rows($this->_result); - } - return null; - } - -/** - * Returns number of rows in previous resultset. If no previous resultset exists, - * this returns false. - * - * @return integer Number of rows in resultset - */ - function lastNumRows() { - if ($this->_result) { - return db2_num_rows($this->_result); - } - return null; - } - -/** - * Returns the ID generated from the previous INSERT operation. - * - * @param unknown_type $source - * @return in - */ - function lastInsertId($source = null) { - $data = $this->fetchRow(sprintf('SELECT SYSIBM.IDENTITY_VAL_LOCAL() AS ID FROM %s FETCH FIRST ROW ONLY', $source)); - - if ($data && isset($data[0]['id'])) { - return $data[0]['id']; - } - return null; - } - -/** - * Returns a limit statement in the correct format for the particular database. - * - * @param integer $limit Limit of results returned - * @param integer $offset Offset from which to start results - * @return string SQL limit/offset statement - */ - function limit($limit, $offset = null) { - if ($limit) { - $rt = ''; - - // If limit is not in the passed value already, add a limit clause. - if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { - $rt = sprintf('FETCH FIRST %d ROWS ONLY', $limit); - } - - // TODO: Implement paging with the offset. This could get hairy. - /* - WITH WHOLE AS - (SELECT FIRSTNME, MIDINIT, LASTNAME, SALARY, - ROW_NUMBER() OVER (ORDER BY SALARY DESC) AS RN - FROM EMPLOYEE) - SELECT FIRSTNME, MIDINIT, LASTNAME, SALARY, RN - FROM WHOLE - WHERE RN BETWEEN 10 AND 15 - */ - - /* - if ($offset) { - $rt .= ' ' . $offset . ','; - } - - $rt .= ' ' . $limit; - */ - - return $rt; - } - return null; - } - -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - if (is_array($real)) { - $col = $real['name']; - - if (isset($real['limit'])) { - $col .= '(' . $real['limit'] . ')'; - } - return $col; - } - $col = str_replace(')', '', $real); - $limit = null; - if (strpos($col, '(') !== false) { - list($col, $limit) = explode('(', $col); - } - - if (in_array($col, array('date', 'time', 'datetime', 'timestamp'))) { - return $col; - } - - if ($col == 'smallint') { - return 'boolean'; - } - - if (strpos($col, 'char') !== false) { - return 'string'; - } - - if (strpos($col, 'clob') !== false) { - return 'text'; - } - - if (strpos($col, 'blob') !== false || $col == 'image') { - return 'binary'; - } - - if (in_array($col, array('double', 'real', 'decimal'))) { - return 'float'; - } - return 'text'; - } - -/** - * Maps a result set to an array so that returned fields are - * grouped by model. Any calculated fields, or fields that - * do not correspond to a particular model belong under array - * key 0. - * - * 1. Gets the column headers - * {{{ - * Post.id - * Post.title - * - * [0] => Array - * ( - * [0] => Post - * [1] => id - * ) - * - * [1] => Array - * ( - * [0] => Post - * [1] => title - * ) - * }}} - * @param unknown_type $results - */ - function resultSet(&$results, $sql = null) { - $this->results =& $results; - $this->map = $this->_resultMap[$this->results]; - } - -/** - * Fetches the next row from the current result set - * Maps the records in the $result property to the map - * created in resultSet(). - * - * 2. Gets the actual values. - * - * @return unknown - */ - function fetchResult() { - if ($row = db2_fetch_array($this->results)) { - $resultRow = array(); - $i = 0; - - foreach ($row as $index => $field) { - $table = $this->map[$index][0]; - $column = strtolower($this->map[$index][1]); - $resultRow[$table][$column] = $row[$index]; - $i++; - } - return $resultRow; - } - return false; - } -} -?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo/dbo_firebird.php b/cake/libs/model/datasources/dbo/dbo_firebird.php deleted file mode 100644 index d5a00c133..000000000 --- a/cake/libs/model/datasources/dbo/dbo_firebird.php +++ /dev/null @@ -1,546 +0,0 @@ - true, - 'host' => 'localhost', - 'login' => 'SYSDBA', - 'password' => 'masterkey', - 'database' => 'c:\\CAKE.FDB', - 'port' => '3050', - 'connect' => 'ibase_connect' - ); - -/** - * Firebird column definition - * - * @var array - */ - var $columns = array( - 'primary_key' => array('name' => 'IDENTITY (1, 1) NOT NULL'), - 'string' => array('name' => 'varchar', 'limit' => '255'), - 'text' => array('name' => 'BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET NONE'), - 'integer' => array('name' => 'integer'), - 'float' => array('name' => 'float', 'formatter' => 'floatval'), - 'datetime' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'), - 'timestamp' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'), - 'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'), - 'date' => array('name' => 'date', 'format' => 'd.m.Y', 'formatter' => 'date'), - 'binary' => array('name' => 'blob'), - 'boolean' => array('name' => 'smallint') - ); - -/** - * Firebird Transaction commands. - * - * @var array - */ - var $_commands = array( - 'begin' => 'SET TRANSACTION', - 'commit' => 'COMMIT', - 'rollback' => 'ROLLBACK' - ); - -/** - * Connects to the database using options in the given configuration array. - * - * @return boolean True if the database could be connected, else false - */ - function connect() { - $config = $this->config; - $connect = $config['connect']; - - $this->connected = false; - - $this->connection = $connect($config['host'] . ':' . $config['database'], $config['login'], $config['password']); - $this->connected = true; - } - -/** - * Check that the interbase extension is loaded - * - * @return boolean - */ - function enabled() { - return extension_loaded('interbase'); - } -/** - * Disconnects from database. - * - * @return boolean True if the database could be disconnected, else false - */ - function disconnect() { - $this->connected = false; - return @ibase_close($this->connection); - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return resource Result resource identifier - * @access protected - */ - function _execute($sql) { - return @ibase_query($this->connection, $sql); - } - -/** - * Returns a row from given resultset as an array . - * - * @return array The fetched row as an array - */ - function fetchRow() { - if ($this->hasResult()) { - $this->resultSet($this->_result); - $resultRow = $this->fetchResult(); - return $resultRow; - } else { - return null; - } - } - -/** - * Returns an array of sources (tables) in the database. - * - * @return array Array of tablenames in the database - */ - function listSources() { - $cache = parent::listSources(); - - if ($cache != null) { - return $cache; - } - $sql = "select RDB" . "$" . "RELATION_NAME as name - FROM RDB" ."$" . "RELATIONS - Where RDB" . "$" . "SYSTEM_FLAG =0"; - - $result = @ibase_query($this->connection,$sql); - $tables = array(); - while ($row = ibase_fetch_row ($result)) { - $tables[] = strtolower(trim($row[0])); - } - parent::listSources($tables); - return $tables; - } - -/** - * Returns an array of the fields in given table name. - * - * @param Model $model Model object to describe - * @return array Fields in table. Keys are name and type - */ - function describe(&$model) { - $this->modeltmp[$model->table] = $model->alias; - $cache = parent::describe($model); - - if ($cache != null) { - return $cache; - } - $fields = false; - $sql = "SELECT * FROM " . $this->fullTableName($model, false); - $rs = ibase_query($sql); - $coln = ibase_num_fields($rs); - $fields = false; - - for ($i = 0; $i < $coln; $i++) { - $col_info = ibase_field_info($rs, $i); - $fields[strtolower($col_info['name'])] = array( - 'type' => $this->column($col_info['type']), - 'null' => '', - 'length' => $col_info['length'] - ); - } - $this->__cacheDescription($this->fullTableName($model, false), $fields); - return $fields; - } - -/** - * Returns a quoted name of $data for use in an SQL statement. - * - * @param string $data Name (table.field) to be prepared for use in an SQL statement - * @return string Quoted for Firebird - */ - function name($data) { - if ($data == '*') { - return '*'; - } - $pos = strpos($data, '"'); - - if ($pos === false) { - if (!strpos($data, ".")) { - $data = '"' . strtoupper($data) . '"'; - } else { - $build = explode('.', $data); - $data = '"' . strtoupper($build[0]) . '"."' . strtoupper($build[1]) . '"'; - } - } - return $data; - } - -/** - * Returns a quoted and escaped string of $data for use in an SQL statement. - * - * @param string $data String to be prepared for use in an SQL statement - * @param string $column The column into which this data will be inserted - * @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided - * @return string Quoted and escaped data - */ - function value($data, $column = null, $safe = false) { - $parent = parent::value($data, $column, $safe); - - if ($parent != null) { - return $parent; - } - if ($data === null) { - return 'NULL'; - } - if ($data === '') { - return "''"; - } - - switch($column) { - case 'boolean': - $data = $this->boolean((bool)$data); - break; - default: - if (get_magic_quotes_gpc()) { - $data = stripslashes(str_replace("'", "''", $data)); - } else { - $data = str_replace("'", "''", $data); - } - break; - } - return "'" . $data . "'"; - } - -/** - * Removes Identity (primary key) column from update data before returning to parent - * - * @param Model $model - * @param array $fields - * @param array $values - * @return array - */ - function update(&$model, $fields = array(), $values = array()) { - foreach ($fields as $i => $field) { - if ($field == $model->primaryKey) { - unset ($fields[$i]); - unset ($values[$i]); - break; - } - } - return parent::update($model, $fields, $values); - } - -/** - * Returns a formatted error message from previous database operation. - * - * @return string Error message with error number - */ - function lastError() { - $error = ibase_errmsg(); - - if ($error !== false) { - return $error; - } - return null; - } - -/** - * Returns number of affected rows in previous database operation. If no previous operation exists, - * this returns false. - * - * @return integer Number of affected rows - */ - function lastAffected() { - if ($this->_result) { - return ibase_affected_rows($this->connection); - } - return null; - } - -/** - * Returns number of rows in previous resultset. If no previous resultset exists, - * this returns false. - * - * @return integer Number of rows in resultset - */ - function lastNumRows() { - return $this->_result? /*ibase_affected_rows($this->_result)*/ 1: false; - } - -/** - * Returns the ID generated from the previous INSERT operation. - * - * @param unknown_type $source - * @return in - */ - function lastInsertId($source = null, $field = 'id') { - $query = "SELECT RDB\$TRIGGER_SOURCE - FROM RDB\$TRIGGERS WHERE RDB\$RELATION_NAME = '". strtoupper($source) . "' AND - RDB\$SYSTEM_FLAG IS NULL AND RDB\$TRIGGER_TYPE = 1 "; - - $result = @ibase_query($this->connection,$query); - $generator = ""; - - while ($row = ibase_fetch_row($result, IBASE_TEXT)) { - if (strpos($row[0], "NEW." . strtoupper($field))) { - $pos = strpos($row[0], "GEN_ID("); - - if ($pos > 0) { - $pos2 = strpos($row[0],",",$pos + 7); - - if ($pos2 > 0) { - $generator = substr($row[0], $pos +7, $pos2 - $pos- 7); - } - } - break; - } - } - - if (!empty($generator)) { - $sql = "SELECT GEN_ID(". $generator . ",0) AS maxi FROM RDB" . "$" . "DATABASE"; - $res = $this->rawQuery($sql); - $data = $this->fetchRow($res); - return $data['maxi']; - } else { - return false; - } - } - -/** - * Returns a limit statement in the correct format for the particular database. - * - * @param integer $limit Limit of results returned - * @param integer $offset Offset from which to start results - * @return string SQL limit/offset statement - */ - function limit($limit, $offset = null) { - if ($limit) { - $rt = ''; - - if (!strpos(strtolower($limit), 'top') || strpos(strtolower($limit), 'top') === 0) { - $rt = ' FIRST'; - } - $rt .= ' ' . $limit; - - if (is_int($offset) && $offset > 0) { - $rt .= ' SKIP ' . $offset; - } - return $rt; - } - return null; - } - -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - if (is_array($real)) { - $col = $real['name']; - - if (isset($real['limit'])) { - $col .= '(' . $real['limit'] . ')'; - } - return $col; - } - - $col = str_replace(')', '', $real); - $limit = null; - if (strpos($col, '(') !== false) { - list($col, $limit) = explode('(', $col); - } - - if (in_array($col, array('DATE', 'TIME'))) { - return strtolower($col); - } - if ($col == 'TIMESTAMP') { - return 'datetime'; - } - if ($col == 'SMALLINT') { - return 'boolean'; - } - if (strpos($col, 'int') !== false || $col == 'numeric' || $col == 'INTEGER') { - return 'integer'; - } - if (strpos($col, 'char') !== false) { - return 'string'; - } - if (strpos($col, 'text') !== false) { - return 'text'; - } - if (strpos($col, 'VARCHAR') !== false) { - return 'string'; - } - if (strpos($col, 'BLOB') !== false) { - return 'text'; - } - if (in_array($col, array('FLOAT', 'NUMERIC', 'DECIMAL'))) { - return 'float'; - } - return 'text'; - } - -/** - * Enter description here... - * - * @param unknown_type $results - */ - function resultSet(&$results) { - $this->results =& $results; - $this->map = array(); - $num_fields = ibase_num_fields($results); - $index = 0; - $j = 0; - - while ($j < $num_fields) { - $column = ibase_field_info($results, $j); - if (!empty($column[2])) { - $this->map[$index++] = array(ucfirst(strtolower($this->modeltmp[strtolower($column[2])])), strtolower($column[1])); - } else { - $this->map[$index++] = array(0, strtolower($column[1])); - } - $j++; - } - } - -/** - * Builds final SQL statement - * - * @param string $type Query type - * @param array $data Query data - * @return string - */ - function renderStatement($type, $data) { - extract($data); - - if (strtolower($type) == 'select') { - if (preg_match('/offset\s+([0-9]+)/i', $limit, $offset)) { - $limit = preg_replace('/\s*offset.*$/i', '', $limit); - preg_match('/top\s+([0-9]+)/i', $limit, $limitVal); - $offset = intval($offset[1]) + intval($limitVal[1]); - $rOrder = $this->__switchSort($order); - list($order2, $rOrder) = array($this->__mapFields($order), $this->__mapFields($rOrder)); - return "SELECT * FROM (SELECT {$limit} * FROM (SELECT TOP {$offset} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$order}) AS Set1 {$rOrder}) AS Set2 {$order2}"; - } else { - return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$order}"; - } - } else { - return parent::renderStatement($type, $data); - } - } - -/** - * Fetches the next row from the current result set - * - * @return unknown - */ - function fetchResult() { - if ($row = ibase_fetch_row($this->results, IBASE_TEXT)) { - $resultRow = array(); - $i = 0; - - foreach ($row as $index => $field) { - list($table, $column) = $this->map[$index]; - - if (trim($table) == "") { - $resultRow[0][$column] = $row[$index]; - } else { - $resultRow[$table][$column] = $row[$index]; - $i++; - } - } - return $resultRow; - } else { - return false; - } - } -} -?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo/dbo_mssql.php b/cake/libs/model/datasources/dbo/dbo_mssql.php index d1510d610..2e26fdb92 100644 --- a/cake/libs/model/datasources/dbo/dbo_mssql.php +++ b/cake/libs/model/datasources/dbo/dbo_mssql.php @@ -2,8 +2,6 @@ /** * MS SQL layer for DBO * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -429,7 +427,7 @@ class DboMssql extends DboSource { $error = mssql_get_last_message(); if ($error) { - if (!preg_match('/contexto de la base de datos a|contesto di database|changed database|datenbankkontext/i', $error)) { + if (!preg_match('/contexto de la base de datos a|contesto di database|changed database|contexte de la base de don|datenbankkontext/i', $error)) { return $error; } } diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index 9fe9940f4..814ffcb31 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -2,8 +2,6 @@ /** * MySQL layer for DBO * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -450,19 +448,51 @@ class DboMysqlBase extends DboSource { } /** - * Query charset by collation + * Converts database-layer column types to basic types * - * @param string $name Collation name - * @return string Character set name + * @param string $real Real database-layer column type (i.e. "varchar(255)") + * @return string Abstract column type (i.e. "string") */ - function getCharsetName($name) { - if ((bool)version_compare(mysql_get_server_info($this->connection), "5", ">=")) { - $cols = $this->query('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= ' . $this->value($name) . ';'); - if (isset($cols[0]['COLLATIONS']['CHARACTER_SET_NAME'])) { - return $cols[0]['COLLATIONS']['CHARACTER_SET_NAME']; + function column($real) { + if (is_array($real)) { + $col = $real['name']; + if (isset($real['limit'])) { + $col .= '('.$real['limit'].')'; } + return $col; } - return false; + + $col = str_replace(')', '', $real); + $limit = $this->length($real); + if (strpos($col, '(') !== false) { + list($col, $vals) = explode('(', $col); + } + + if (in_array($col, array('date', 'time', 'datetime', 'timestamp'))) { + return $col; + } + if (($col == 'tinyint' && $limit == 1) || $col == 'boolean') { + return 'boolean'; + } + if (strpos($col, 'int') !== false) { + return 'integer'; + } + if (strpos($col, 'char') !== false || $col == 'tinytext') { + return 'string'; + } + if (strpos($col, 'text') !== false) { + return 'text'; + } + if (strpos($col, 'blob') !== false || $col == 'binary') { + return 'binary'; + } + if (strpos($col, 'float') !== false || strpos($col, 'double') !== false || strpos($col, 'decimal') !== false) { + return 'float'; + } + if (strpos($col, 'enum') !== false) { + return "enum($vals)"; + } + return 'text'; } } @@ -682,54 +712,6 @@ class DboMysql extends DboMysqlBase { return null; } -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - if (is_array($real)) { - $col = $real['name']; - if (isset($real['limit'])) { - $col .= '('.$real['limit'].')'; - } - return $col; - } - - $col = str_replace(')', '', $real); - $limit = $this->length($real); - if (strpos($col, '(') !== false) { - list($col, $vals) = explode('(', $col); - } - - if (in_array($col, array('date', 'time', 'datetime', 'timestamp'))) { - return $col; - } - if (($col == 'tinyint' && $limit == 1) || $col == 'boolean') { - return 'boolean'; - } - if (strpos($col, 'int') !== false) { - return 'integer'; - } - if (strpos($col, 'char') !== false || $col == 'tinytext') { - return 'string'; - } - if (strpos($col, 'text') !== false) { - return 'text'; - } - if (strpos($col, 'blob') !== false || $col == 'binary') { - return 'binary'; - } - if (strpos($col, 'float') !== false || strpos($col, 'double') !== false || strpos($col, 'decimal') !== false) { - return 'float'; - } - if (strpos($col, 'enum') !== false) { - return "enum($vals)"; - } - return 'text'; - } - /** * Enter description here... * @@ -785,5 +767,21 @@ class DboMysql extends DboMysqlBase { function getEncoding() { return mysql_client_encoding($this->connection); } + +/** + * Query charset by collation + * + * @param string $name Collation name + * @return string Character set name + */ + function getCharsetName($name) { + if ((bool)version_compare(mysql_get_server_info($this->connection), "5", ">=")) { + $cols = $this->query('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= ' . $this->value($name) . ';'); + if (isset($cols[0]['COLLATIONS']['CHARACTER_SET_NAME'])) { + return $cols[0]['COLLATIONS']['CHARACTER_SET_NAME']; + } + } + return false; + } } ?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php index 6826024b2..571095a52 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysqli.php +++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php @@ -2,8 +2,6 @@ /** * MySQLi layer for DBO * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -260,54 +258,6 @@ class DboMysqli extends DboMysqlBase { return null; } -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - if (is_array($real)) { - $col = $real['name']; - if (isset($real['limit'])) { - $col .= '('.$real['limit'].')'; - } - return $col; - } - - $col = str_replace(')', '', $real); - $limit = $this->length($real); - if (strpos($col, '(') !== false) { - list($col, $vals) = explode('(', $col); - } - - if (in_array($col, array('date', 'time', 'datetime', 'timestamp'))) { - return $col; - } - if (($col == 'tinyint' && $limit == 1) || $col == 'boolean') { - return 'boolean'; - } - if (strpos($col, 'int') !== false) { - return 'integer'; - } - if (strpos($col, 'char') !== false || $col == 'tinytext') { - return 'string'; - } - if (strpos($col, 'text') !== false) { - return 'text'; - } - if (strpos($col, 'blob') !== false || $col == 'binary') { - return 'binary'; - } - if (strpos($col, 'float') !== false || strpos($col, 'double') !== false || strpos($col, 'decimal') !== false) { - return 'float'; - } - if (strpos($col, 'enum') !== false) { - return "enum($vals)"; - } - return 'text'; - } - /** * Enter description here... * @@ -364,6 +314,22 @@ class DboMysqli extends DboMysqlBase { return mysqli_client_encoding($this->connection); } +/** + * Query charset by collation + * + * @param string $name Collation name + * @return string Character set name + */ + function getCharsetName($name) { + if ((bool)version_compare(mysqli_get_server_info($this->connection), "5", ">=")) { + $cols = $this->query('SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE COLLATION_NAME= ' . $this->value($name) . ';'); + if (isset($cols[0]['COLLATIONS']['CHARACTER_SET_NAME'])) { + return $cols[0]['COLLATIONS']['CHARACTER_SET_NAME']; + } + } + return false; + } + /** * Checks if the result is valid * diff --git a/cake/libs/model/datasources/dbo/dbo_odbc.php b/cake/libs/model/datasources/dbo/dbo_odbc.php deleted file mode 100644 index 42dc3f659..000000000 --- a/cake/libs/model/datasources/dbo/dbo_odbc.php +++ /dev/null @@ -1,381 +0,0 @@ - true, - 'login' => 'root', - 'password' => '', - 'database' => 'cake', - 'connect' => 'odbc_pconnect' - ); - -/** - * Enter description here... - * - * @var unknown_type - */ - var $columns = array(); - - // var $columns = array('primary_key' => array('name' => 'int(11) DEFAULT NULL auto_increment'), - // 'string' => array('name' => 'varchar', 'limit' => '255'), - // 'text' => array('name' => 'text'), - // 'integer' => array('name' => 'int', 'limit' => '11'), - // 'float' => array('name' => 'float'), - // 'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d h:i:s', 'formatter' => 'date'), - // 'timestamp' => array('name' => 'datetime', 'format' => 'Y-m-d h:i:s', 'formatter' => 'date'), - // 'time' => array('name' => 'time', 'format' => 'h:i:s', 'formatter' => 'date'), - // 'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'), - // 'binary' => array('name' => 'blob'), - // 'boolean' => array('name' => 'tinyint', 'limit' => '1')); - -/** - * Connects to the database using options in the given configuration array. - * - * @return boolean True if the database could be connected, else false - */ - function connect() { - $config = $this->config; - $connect = $config['connect']; - if (!$config['persistent']) { - $connect = 'odbc_connect'; - } - if (!function_exists($connect)) { - exit('no odbc?'); - } - $this->connected = false; - $this->connection = $connect($config['database'], $config['login'], $config['password'], SQL_CUR_USE_ODBC); - if ($this->connection) { - $this->connected = true; - } - - return $this->connected; - } - -/** - * Check if the ODBC extension is installed/loaded - * - * @return boolean - */ - function enabled() { - return extension_loaded('odbc'); - } -/** - * Disconnects from database. - * - * @return boolean True if the database could be disconnected, else false - */ - function disconnect() { - return @odbc_close($this->connection); - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return resource Result resource identifier - * @access protected - */ - function _execute($sql) { - switch ($sql) { - case 'BEGIN': - return odbc_autocommit($this->connection, false); - case 'COMMIT': - return odbc_commit($this->connection); - case 'ROLLBACK': - return odbc_rollback($this->connection); - } - // TODO: should flags be set? possible requirement: SQL_CURSOR_STATIC - return odbc_exec($this->connection, $sql); - } - -/** - * Returns an array of sources (tables) in the database. - * - * @return array Array of tablenames in the database - */ - function listSources() { - $cache = parent::listSources(); - if ($cache != null) { - return $cache; - } - - $result = odbc_tables($this->connection); - - $tables = array(); - while (odbc_fetch_row($result)) { - array_push($tables, odbc_result($result, 'TABLE_NAME')); - } - - parent::listSources($tables); - return $tables; - } - -/** - * Returns an array of the fields in given table name. - * - * @param Model $model Model object to describe - * @return array Fields in table. Keys are name and type - */ - function &describe(&$model) { - $cache=parent::describe($model); - - if ($cache != null) { - return $cache; - } - - $fields = array(); - $sql = 'SELECT * FROM ' . $this->fullTableName($model); - $result = odbc_exec($this->connection, $sql); - - $count = odbc_num_fields($result); - - for ($i = 1; $i <= $count; $i++) { - $cols[$i - 1] = odbc_field_name($result, $i); - } - - foreach ($cols as $column) { - $type = odbc_field_type(odbc_exec($this->connection, 'SELECT ' . $column . ' FROM ' . $this->fullTableName($model)), 1); - $fields[$column] = array('type' => $type); - } - - $this->__cacheDescription($model->tablePrefix . $model->table, $fields); - return $fields; - } - -/** - * Returns a quoted and escaped string of $data for use in an SQL statement. - * - * @param string $data String to be prepared for use in an SQL statement - * @param string $column The column into which this data will be inserted - * @return string Quoted and escaped - * @todo Add logic that formats/escapes data based on column type - */ - function value($data, $column = null) { - $parent=parent::value($data, $column); - - if ($parent != null) { - return $parent; - } - - if ($data === null) { - return 'NULL'; - } - - if (!is_numeric($data)) { - return "'" . $data . "'"; - } - - return $data; - } - -/** - * Returns a formatted error message from previous database operation. - * - * @return string Error message with error number - */ - function lastError() { - if ($error = odbc_errormsg($this->connection)) { - return odbc_error($this->connection) . ': ' . $error; - } - return null; - } - -/** - * Returns number of affected rows in previous database operation. If no previous operation exists, - * this returns false. - * - * @return integer Number of affected rows - */ - function lastAffected() { - if ($this->hasResult()) { - return odbc_num_rows($this->_result); - } - return null; - } - -/** - * Returns number of rows in previous resultset. If no previous resultset exists, - * this returns false. - * - * @return int Number of rows in resultset - */ - function lastNumRows() { - if ($this->hasResult()) { - return odbc_num_rows($this->_result); - } - return null; - } - -/** - * Returns the ID generated from the previous INSERT operation. - * - * @param unknown_type $source - * @return int - */ - function lastInsertId($source = null) { - $result = $this->fetchRow('SELECT @@IDENTITY'); - return $result[0]; - } - -/** - * Enter description here... - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - */ - function column($real) { - if (is_array($real)) { - $col=$real['name']; - if (isset($real['limit'])) { - $col .= '(' . $real['limit'] . ')'; - } - return $col; - } - return $real; - } - -/** -* Enter description here... -* -* @param unknown_type $results -*/ - function resultSet(&$results) { - $this->results =& $results; - $num_fields = odbc_num_fields($results); - $this->map = array(); - $index = 0; - $j = 0; - while ($j < $num_fields) { - $column = odbc_field_name($results, $j+1); - - if (strpos($column, '_dot_') !== false) { - list($table, $column) = explode('_dot_', $column); - $this->map[$index++] = array($table, $column); - } else { - $this->map[$index++] = array(0, $column); - } - $j++; - } - } - -/** -* Generates the fields list of an SQL query. -* -* @param Model $model -* @param string $alias Alias tablename -* @param mixed $fields -* @return array -*/ - function fields(&$model, $alias = null, $fields = null, $quote = true) { - if (empty($alias)) { - $alias = $model->name; - } - if (!is_array($fields)) { - if ($fields != null) { - $fields = array_map('trim', explode(',', $fields)); - } else { - foreach($model->tableToModel as $tableName => $modelName) { - foreach($this->__descriptions[$model->tablePrefix .$tableName] as $field => $type) { - $fields[] = $modelName .'.' .$field; - } - } - } - } - - $count = count($fields); - - if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false) { - for ($i = 0; $i < $count; $i++) { - if (!preg_match('/^.+\\(.*\\)/', $fields[$i])) { - $prepend = ''; - if (strpos($fields[$i], 'DISTINCT') !== false) { - $prepend = 'DISTINCT '; - $fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i])); - } - - if (strrpos($fields[$i], '.') === false) { - $fields[$i] = $prepend . $this->name($alias) . '.' . $this->name($fields[$i]) . ' AS ' . $this->name($alias . '_dot_' . $fields[$i]); - } else { - $build = explode('.', $fields[$i]); - $fields[$i] = $prepend . $this->name($build[0]) . '.' . $this->name($build[1]) . ' AS ' . $this->name($build[0] . '_dot_' . $build[1]); - } - } - } - } - return $fields; - } - -/** - * Fetches the next row from the current result set - * - * @return unknown - */ - function fetchResult() { - if ($row = odbc_fetch_row($this->results)) { - $resultRow = array(); - $numFields = odbc_num_fields($this->results); - $i = 0; - for($i = 0; $i < $numFields; $i++) { - list($table, $column) = $this->map[$i]; - $resultRow[$table][$column] = odbc_result($this->results, $i + 1); - } - return $resultRow; - } - return false; - } -} -?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo/dbo_oracle.php b/cake/libs/model/datasources/dbo/dbo_oracle.php index e39c8246f..471f3c80e 100644 --- a/cake/libs/model/datasources/dbo/dbo_oracle.php +++ b/cake/libs/model/datasources/dbo/dbo_oracle.php @@ -2,8 +2,6 @@ /** * Oracle layer for DBO. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 092e302d9..f00f1ddb4 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -2,8 +2,6 @@ /** * PostgreSQL layer for DBO. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index fd0348fb3..248f36200 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php @@ -2,8 +2,6 @@ /** * SQLite layer for DBO * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/model/datasources/dbo/dbo_sybase.php b/cake/libs/model/datasources/dbo/dbo_sybase.php deleted file mode 100644 index 0551a92b3..000000000 --- a/cake/libs/model/datasources/dbo/dbo_sybase.php +++ /dev/null @@ -1,410 +0,0 @@ - true, - 'host' => 'localhost', - 'login' => 'sa', - 'password' => '', - 'database' => 'cake', - 'port' => '4100' - ); - -/** - * Sybase column definition - * - * @var array - */ - var $columns = array( - 'primary_key' => array('name' => 'numeric(9,0) IDENTITY PRIMARY KEY'), - 'string' => array('name' => 'varchar', 'limit' => '255'), - 'text' => array('name' => 'text'), - 'integer' => array('name' => 'int', 'limit' => '11', 'formatter' => 'intval'), - 'float' => array('name' => 'float', 'formatter' => 'floatval'), - 'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'), - 'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'), - 'time' => array('name' => 'datetime', 'format' => 'H:i:s', 'formatter' => 'date'), - 'date' => array('name' => 'datetime', 'format' => 'Y-m-d', 'formatter' => 'date'), - 'binary' => array('name' => 'image'), - 'boolean' => array('name' => 'bit') - ); - -/** - * Connects to the database using options in the given configuration array. - * - * @return boolean True if the database could be connected, else false - */ - function connect() { - $config = $this->config; - - $port = ''; - if ($config['port'] !== null) { - $port = ':' . $config['port']; - } - if ($config['persistent']) { - $this->connection = sybase_pconnect($config['host'] . $port, $config['login'], $config['password']); - } else { - $this->connection = sybase_connect($config['host'] . $port, $config['login'], $config['password'], true); - } - $this->connected = sybase_select_db($config['database'], $this->connection); - return $this->connected; - } - -/** - * Check that one of the sybase extensions is installed - * - * @return boolean - */ - function enabled() { - return extension_loaded('sybase') || extension_loaded('sybase_ct'); - } -/** - * Disconnects from database. - * - * @return boolean True if the database could be disconnected, else false - */ - function disconnect() { - $this->connected = !@sybase_close($this->connection); - return !$this->connected; - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return resource Result resource identifier - * @access protected - */ - function _execute($sql) { - return sybase_query($sql, $this->connection); - } - -/** - * Returns an array of sources (tables) in the database. - * - * @return array Array of tablenames in the database - */ - function listSources() { - $cache = parent::listSources(); - if ($cache != null) { - return $cache; - } - - $result = $this->_execute("SELECT name FROM sysobjects WHERE type IN ('U', 'V')"); - if (!$result) { - return array(); - } else { - - $tables = array(); - while ($line = sybase_fetch_array($result)) { - $tables[] = $line[0]; - } - - parent::listSources($tables); - return $tables; - } - } - -/** - * Returns an array of the fields in given table name. - * - * @param string $tableName Name of database table to inspect - * @return array Fields in table. Keys are name and type - */ - function describe(&$model) { - - $cache = parent::describe($model); - if ($cache != null) { - return $cache; - } - - $fields = false; - $cols = $this->query('DESC ' . $this->fullTableName($model)); - - foreach ($cols as $column) { - $colKey = array_keys($column); - if (isset($column[$colKey[0]]) && !isset($column[0])) { - $column[0] = $column[$colKey[0]]; - } - if (isset($column[0])) { - $fields[$column[0]['Field']] = array( - 'type' => $this->column($column[0]['Type']), - 'null' => $column[0]['Null'], - 'length' => $this->length($column[0]['Type']), - ); - } - } - - $this->__cacheDescription($model->tablePrefix.$model->table, $fields); - return $fields; - } - -/** - * Returns a quoted and escaped string of $data for use in an SQL statement. - * - * @param string $data String to be prepared for use in an SQL statement - * @param string $column The column into which this data will be inserted - * @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided - * @return string Quoted and escaped data - */ - function value($data, $column = null, $safe = false) { - $parent = parent::value($data, $column, $safe); - - if ($parent != null) { - return $parent; - } - - if ($data === null) { - return 'NULL'; - } - - if ($data === '') { - return "''"; - } - - switch ($column) { - case 'boolean': - $data = $this->boolean((bool)$data); - break; - default: - $data = str_replace("'", "''", $data); - break; - } - - return "'" . $data . "'"; - } - -/** - * Begin a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions). - */ - function begin(&$model) { - if (parent::begin($model)) { - if ($this->execute('BEGIN TRAN')) { - $this->_transactionStarted = true; - return true; - } - } - return false; - } - -/** - * Commit a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function commit(&$model) { - if (parent::commit($model)) { - $this->_transactionStarted = false; - return $this->execute('COMMIT TRAN'); - } - return false; - } - -/** - * Rollback a transaction - * - * @param unknown_type $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - */ - function rollback(&$model) { - if (parent::rollback($model)) { - return $this->execute('ROLLBACK TRAN'); - } - return false; - } - -/** - * Returns a formatted error message from previous database operation. - * - * @todo not implemented - * @return string Error message with error number - */ - function lastError() { - return null; - } - -/** - * Returns number of affected rows in previous database operation. If no previous operation exists, - * this returns false. - * - * @return integer Number of affected rows - */ - function lastAffected() { - if ($this->_result) { - return sybase_affected_rows($this->connection); - } - return null; - } - -/** - * Returns number of rows in previous resultset. If no previous resultset exists, - * this returns false. - * - * @return integer Number of rows in resultset - */ - function lastNumRows() { - if ($this->hasResult()) { - return @sybase_num_rows($this->_result); - } - return null; - } - -/** - * Returns the ID generated from the previous INSERT operation. - * - * @param unknown_type $source - * @return in - */ - function lastInsertId($source = null) { - $result=$this->fetchRow('SELECT @@IDENTITY'); - return $result[0]; - } - -/** - * Converts database-layer column types to basic types - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return string Abstract column type (i.e. "string") - */ - function column($real) { - if (is_array($real)) { - $col = $real['name']; - if (isset($real['limit'])) - { - $col .= '('.$real['limit'].')'; - } - return $col; - } - - $col = str_replace(')', '', $real); - $limit = null; - if (strpos($col, '(') !== false) { - list($col, $limit) = explode('(', $col); - } - - if (in_array($col, array('datetime', 'smalldatetime'))) { - return 'datetime'; - } elseif (in_array($col, array('int', 'bigint', 'smallint', 'tinyint'))) { - return 'integer'; - } elseif (in_array($col, array('float', 'double', 'real', 'decimal', 'money', 'numeric', 'smallmoney'))) { - return 'float'; - } elseif (strpos($col, 'text') !== false) { - return 'text'; - } elseif (in_array($col, array('char', 'nchar', 'nvarchar', 'string', 'varchar'))) { - return 'binary'; - } elseif (in_array($col, array('binary', 'image', 'varbinary'))) { - return 'binary'; - } - - return 'text'; - } - -/** - * Enter description here... - * - * @param unknown_type $results - */ - function resultSet(&$results) { - $this->results =& $results; - $this->map = array(); - $num_fields = sybase_num_fields($results); - $index = 0; - $j = 0; - - while ($j < $num_fields) { - - $column = sybase_fetch_field($results,$j); - if (!empty($column->table)) { - $this->map[$index++] = array($column->table, $column->name); - } else { - $this->map[$index++] = array(0, $column->name); - } - $j++; - } - } - -/** - * Fetches the next row from the current result set - * - * @return unknown - */ - function fetchResult() { - if ($row = sybase_fetch_row($this->results)) { - $resultRow = array(); - $i = 0; - foreach ($row as $index => $field) { - list($table, $column) = $this->map[$index]; - $resultRow[$table][$column] = $row[$index]; - $i++; - } - return $resultRow; - } else { - return false; - } - } -} -?> \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index b46e928d0..dcaf89980 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/model/db_acl.php b/cake/libs/model/db_acl.php index 4588c0903..6599f2ac9 100644 --- a/cake/libs/model/db_acl.php +++ b/cake/libs/model/db_acl.php @@ -28,8 +28,6 @@ App::import('Model', 'App'); /** * Short description for file. * - * Long description for file - * * * @package cake * @subpackage cake.cake.libs.model diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index 00e613c7f..726f628db 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -2419,6 +2419,8 @@ class Model extends Overloadable { /** * Returns true if all fields pass validation. * + * Will validate the currently set data. Use Model::set() or Model::create() to set the active data. + * * @param string $options An optional array of custom options to be made available in the beforeValidate callback * @return boolean True if there are no errors * @access public @@ -2437,6 +2439,7 @@ class Model extends Overloadable { * * @param string $options An optional array of custom options to be made available in the beforeValidate callback * @return array Array of invalid fields + * @see Model::validates() * @access public * @link http://book.cakephp.org/view/410/Validating-Data-from-the-Controller */ diff --git a/cake/libs/router.php b/cake/libs/router.php index 402fc4138..22beb1f1f 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -2,8 +2,6 @@ /** * Parses the request URL into controller, action, and parameters. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -97,18 +95,6 @@ class Router { */ var $__currentRoute = array(); -/** - * HTTP header shortcut map. Used for evaluating header-based route expressions. - * - * @var array - * @access private - */ - var $__headerMap = array( - 'type' => 'content_type', - 'method' => 'request_method', - 'server' => 'server_name' - ); - /** * Default HTTP request method => controller action map. * @@ -124,6 +110,18 @@ class Router { array('action' => 'edit', 'method' => 'POST', 'id' => true) ); +/** + * HTTP header shortcut map. Used for evaluating header-based route expressions. + * + * @var array + * @access private + */ + var $__headerMap = array( + 'type' => 'content_type', + 'method' => 'request_method', + 'server' => 'server_name' + ); + /** * List of resource-mapped controllers * @@ -156,6 +154,14 @@ class Router { */ var $__defaultsMapped = false; +/** + * Keeps track of whether the connection of default routes is enabled or disabled. + * + * @var boolean + * @access private + */ + var $__connectDefaults = true; + /** * Constructor for Router. * Builds __prefixes @@ -209,39 +215,76 @@ class Router { * @static */ function getNamedExpressions() { - $_this =& Router::getInstance(); - return $_this->__named; + $self =& Router::getInstance(); + return $self->__named; } /** - * Returns this object's routes array. Returns false if there are no routes available. + * Connects a new Route in the router. * - * @param string $route An empty string, or a route string "/" - * @param array $default NULL or an array describing the default route - * @param array $params An array matching the named elements in the route to regular expressions which that element should match. + * Routes are a way of connecting request urls to objects in your application. At their core routes + * are a set or regular expressions that are used to match requests to destinations. + * + * Examples: + * + * `Router::connect('/:controller/:action/*');` + * + * The first parameter will be used as a controller name while the second is used as the action name. + * the '/*' syntax makes this route greedy in that it will match requests like `/posts/index` as well as requests + * like `/posts/edit/1/foo/bar`. + * + * `Router::connect('/home-page', array('controller' => 'pages', 'action' => 'display', 'home'));` + * + * The above shows the use of route parameter defaults. And providing routing parameters for a static route. + * + * {{{ + * Router::connect( + * '/:lang/:controller/:action/:id', + * array(), + * array('id' => '[0-9]+', 'lang' => '[a-z]{3}') + * ); + * }}} + * + * Shows connecting a route with custom route parameters as well as providing patterns for those parameters. + * Patterns for routing parameters do not need capturing groups, as one will be added for each route params. + * + * @param string $route A string describing the template of the route + * @param array $defaults An array describing the default route parameters. These parameters will be used by default + * and can supply routing parameters that are not dynamic. See above. + * @param array $options An array matching the named elements in the route to regular expressions which that + * element should match. Also contains additional parameters such as which routed parameters should be + * shifted into the passed arguments. As well as supplying patterns for routing parameters. * @see routes * @return array Array of routes * @access public * @static */ - function connect($route, $default = array(), $params = array()) { - $_this =& Router::getInstance(); + function connect($route, $defaults = array(), $options = array()) { + $self =& Router::getInstance(); - if (!isset($default['action'])) { - $default['action'] = 'index'; - } - foreach ($_this->__prefixes as $prefix) { - if (isset($default[$prefix])) { - $default['prefix'] = $prefix; + foreach ($self->__prefixes as $prefix) { + if (isset($defaults[$prefix])) { + $defaults['prefix'] = $prefix; break; } } - if (isset($default['prefix'])) { - $_this->__prefixes[] = $default['prefix']; - $_this->__prefixes = array_keys(array_flip($_this->__prefixes)); + if (isset($defaults['prefix'])) { + $self->__prefixes[] = $defaults['prefix']; + $self->__prefixes = array_keys(array_flip($self->__prefixes)); } - $_this->routes[] = array($route, $default, $params); - return $_this->routes; + $defaults += array('action' => 'index', 'plugin' => null, 'controller' => null); + $routeClass = 'CakeRoute'; + if (isset($options['routeClass'])) { + $routeClass = $options['routeClass']; + unset($options['routeClass']); + } + $Route =& new $routeClass($route, $defaults, $options); + if ($routeClass !== 'CakeRoute' && !is_subclass_of($Route, 'CakeRoute')) { + trigger_error(__('Route classes must extend CakeRoute', true), E_USER_WARNING); + return false; + } + $self->routes[] =& $Route; + return $self->routes; } /** @@ -272,36 +315,51 @@ class Router { * @static */ function connectNamed($named, $options = array()) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); if (isset($options['argSeparator'])) { - $_this->named['separator'] = $options['argSeparator']; + $self->named['separator'] = $options['argSeparator']; unset($options['argSeparator']); } if ($named === true || $named === false) { $options = array_merge(array('default' => $named, 'reset' => true, 'greedy' => $named), $options); $named = array(); + } else { + $options = array_merge(array('default' => false, 'reset' => false, 'greedy' => true), $options); } - $options = array_merge(array('default' => false, 'reset' => false, 'greedy' => true), $options); - if ($options['reset'] == true || $_this->named['rules'] === false) { - $_this->named['rules'] = array(); + if ($options['reset'] == true || $self->named['rules'] === false) { + $self->named['rules'] = array(); } if ($options['default']) { - $named = array_merge($named, $_this->named['default']); + $named = array_merge($named, $self->named['default']); } foreach ($named as $key => $val) { if (is_numeric($key)) { - $_this->named['rules'][$val] = true; + $self->named['rules'][$val] = true; } else { - $_this->named['rules'][$key] = $val; + $self->named['rules'][$key] = $val; } } - $_this->named['greedy'] = $options['greedy']; - return $_this->named; + $self->named['greedy'] = $options['greedy']; + return $self->named; + } + +/** + * Tell router to connect or not connect the default routes. + * + * If default routes are disabled all automatic route generation will be disabled + * and you will need to manually configure all the routes you want. + * + * @param boolean $connect Set to true or false depending on whether you want or don't want default routes. + * @return void + */ + function defaults($connect = true) { + $self =& Router::getInstance(); + $self->__connectDefaults = $connect; } /** @@ -320,14 +378,14 @@ class Router { * @static */ function mapResources($controller, $options = array()) { - $_this =& Router::getInstance(); - $options = array_merge(array('prefix' => '/', 'id' => $_this->__named['ID'] . '|' . $_this->__named['UUID']), $options); + $self =& Router::getInstance(); + $options = array_merge(array('prefix' => '/', 'id' => $self->__named['ID'] . '|' . $self->__named['UUID']), $options); $prefix = $options['prefix']; foreach ((array)$controller as $ctlName) { $urlName = Inflector::underscore($ctlName); - foreach ($_this->__resourceMap as $params) { + foreach ($self->__resourceMap as $params) { extract($params); $url = $prefix . $urlName . (($id) ? '/:id' : ''); @@ -336,83 +394,10 @@ class Router { array('id' => $options['id'], 'pass' => array('id')) ); } - $_this->__resourceMapped[] = $urlName; + $self->__resourceMapped[] = $urlName; } } -/** - * Builds a route regular expression - * - * @param string $route An empty string, or a route string "/" - * @param array $default NULL or an array describing the default route - * @param array $params An array matching the named elements in the route to regular expressions which that element should match. - * @return array - * @see routes - * @access public - * @static - */ - function writeRoute($route, $default, $params) { - if (empty($route) || ($route === '/')) { - return array('/^[\/]*$/', array()); - } - $names = array(); - $elements = explode('/', $route); - - foreach ($elements as $element) { - if (empty($element)) { - continue; - } - $q = null; - $element = trim($element); - $namedParam = strpos($element, ':') !== false; - - if ($namedParam && preg_match('/^:([^:]+)$/', $element, $r)) { - if (isset($params[$r[1]])) { - if ($r[1] != 'plugin' && array_key_exists($r[1], $default)) { - $q = '?'; - } - $parsed[] = '(?:/(' . $params[$r[1]] . ')' . $q . ')' . $q; - } else { - $parsed[] = '(?:/([^\/]+))?'; - } - $names[] = $r[1]; - } elseif ($element === '*') { - $parsed[] = '(?:/(.*))?'; - } else if ($namedParam && preg_match_all('/(?!\\\\):([a-z_0-9]+)/i', $element, $matches)) { - $matchCount = count($matches[1]); - - foreach ($matches[1] as $i => $name) { - $pos = strpos($element, ':' . $name); - $before = substr($element, 0, $pos); - $element = substr($element, $pos + strlen($name) + 1); - $after = null; - - if ($i + 1 === $matchCount && $element) { - $after = preg_quote($element); - } - - if ($i === 0) { - $before = '/' . $before; - } - $before = preg_quote($before, '#'); - - if (isset($params[$name])) { - if (isset($default[$name]) && $name != 'plugin') { - $q = '?'; - } - $parsed[] = '(?:' . $before . '(' . $params[$name] . ')' . $q . $after . ')' . $q; - } else { - $parsed[] = '(?:' . $before . '([^\/]+)' . $after . ')?'; - } - $names[] = $name; - } - } else { - $parsed[] = '/' . $element; - } - } - return array('#^' . implode('', $parsed) . '[\/]*$#', $names); - } - /** * Returns the list of prefixes used in connected routes * @@ -421,8 +406,8 @@ class Router { * @static */ function prefixes() { - $_this =& Router::getInstance(); - return $_this->__prefixes; + $self =& Router::getInstance(); + return $self->__prefixes; } /** @@ -435,9 +420,9 @@ class Router { * @static */ function parse($url) { - $_this =& Router::getInstance(); - if (!$_this->__defaultsMapped) { - $_this->__connectDefaultRoutes(); + $self =& Router::getInstance(); + if (!$self->__defaultsMapped && $self->__connectDefaults) { + $self->__connectDefaultRoutes(); } $out = array('pass' => array(), 'named' => array()); $r = $ext = null; @@ -452,16 +437,14 @@ class Router { if (strpos($url, '?') !== false) { $url = substr($url, 0, strpos($url, '?')); } - extract($_this->__parseExtension($url)); + extract($self->__parseExtension($url)); - foreach ($_this->routes as $i => $route) { - if (count($route) === 3) { - $route = $_this->compile($i); - } + for ($i = 0, $len = count($self->routes); $i < $len; $i++) { + $route =& $self->routes[$i]; + if (($r = $route->parse($url)) !== false) { + $self->__currentRoute[] =& $route; - if (($r = $_this->__matchRoute($route, $url)) !== false) { - $_this->__currentRoute[] = $route; - list($route, $regexp, $names, $defaults, $params) = $route; + $params = $route->options; $argOptions = array(); if (array_key_exists('named', $params)) { @@ -472,38 +455,19 @@ class Router { $argOptions['greedy'] = $params['greedy']; unset($params['greedy']); } - array_shift($r); + $out = $r; - foreach ($names as $name) { - $out[$name] = null; - } - if (is_array($defaults)) { - foreach ($defaults as $name => $value) { - if (preg_match('#[a-zA-Z_\-]#i', $name)) { - $out[$name] = $value; - } else { - $out['pass'][] = $value; - } - } - } - - foreach ($r as $key => $found) { - if (empty($found) && $found != 0) { - continue; - } - - if (isset($names[$key])) { - $out[$names[$key]] = $_this->stripEscape($found); - } else { - $argOptions['context'] = array('action' => $out['action'], 'controller' => $out['controller']); - extract($_this->getArgs($found, $argOptions)); - $out['pass'] = array_merge($out['pass'], $pass); - $out['named'] = $named; - } + if (isset($out['_args_'])) { + $argOptions['context'] = array('action' => $out['action'], 'controller' => $out['controller']); + $parsedArgs = $self->getArgs($out['_args_'], $argOptions); + $out['pass'] = array_merge($out['pass'], $parsedArgs['pass']); + $out['named'] = $parsedArgs['named']; + unset($out['_args_']); } if (isset($params['pass'])) { - for ($j = count($params['pass']) - 1; $j > -1; $j--) { + $j = count($params['pass']); + while($j--) { if (isset($out[$params['pass'][$j]])) { array_unshift($out['pass'], $out[$params['pass'][$j]]); } @@ -519,65 +483,6 @@ class Router { return $out; } -/** - * Checks to see if the given URL matches the given route - * - * @param array $route - * @param string $url - * @return mixed Boolean false on failure, otherwise array - * @access private - */ - function __matchRoute($route, $url) { - list($route, $regexp, $names, $defaults) = $route; - - if (!preg_match($regexp, $url, $r)) { - return false; - } else { - foreach ($defaults as $key => $val) { - if ($key{0} === '[' && preg_match('/^\[(\w+)\]$/', $key, $header)) { - if (isset($this->__headerMap[$header[1]])) { - $header = $this->__headerMap[$header[1]]; - } else { - $header = 'http_' . $header[1]; - } - - $val = (array)$val; - $h = false; - - foreach ($val as $v) { - if (env(strtoupper($header)) === $v) { - $h = true; - } - } - if (!$h) { - return false; - } - } - } - } - return $r; - } - -/** - * Compiles a route by numeric key and returns the compiled expression, replacing - * the existing uncompiled route. Do not call statically. - * - * @param integer $i - * @return array Returns an array containing the compiled route - * @access public - */ - function compile($i) { - $route = $this->routes[$i]; - - list($pattern, $names) = $this->writeRoute($route[0], $route[1], $route[2]); - $this->routes[$i] = array( - $route[0], $pattern, $names, - array_merge(array('plugin' => null, 'controller' => null), (array)$route[1]), - $route[2] - ); - return $this->routes[$i]; - } - /** * Parses a file extension out of a URL, if Router::parseExtensions() is enabled. * @@ -619,28 +524,25 @@ class Router { * @access private */ function __connectDefaultRoutes() { - if ($this->__defaultsMapped) { - return; - } - if ($plugins = App::objects('plugin')) { foreach ($plugins as $key => $value) { $plugins[$key] = Inflector::underscore($value); } - $match = array('plugin' => implode('|', $plugins)); - $this->connect('/:plugin/:controller/:action/*', array(), $match); foreach ($this->__prefixes as $prefix) { $params = array('prefix' => $prefix, $prefix => true); - $this->connect("/{$prefix}/:plugin/:controller", $params, $match); + $indexParams = $params + array('action' => 'index'); + $this->connect("/{$prefix}/:plugin/:controller", $indexParams, $match); $this->connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match); } + $this->connect('/:plugin/:controller/:action/*', array(), $match); } foreach ($this->__prefixes as $prefix) { $params = array('prefix' => $prefix, $prefix => true); - $this->connect("/{$prefix}/:controller", $params); + $indexParams = $params + array('action' => 'index'); + $this->connect("/{$prefix}/:controller", $indexParams); $this->connect("/{$prefix}/:controller/:action/*", $params); } $this->connect('/:controller', array('action' => 'index')); @@ -661,16 +563,16 @@ class Router { * @static */ function setRequestInfo($params) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); $defaults = array('plugin' => null, 'controller' => null, 'action' => null); $params[0] = array_merge($defaults, (array)$params[0]); $params[1] = array_merge($defaults, (array)$params[1]); - list($_this->__params[], $_this->__paths[]) = $params; + list($self->__params[], $self->__paths[]) = $params; - if (count($_this->__paths)) { - if (isset($_this->__paths[0]['namedArgs'])) { - foreach ($_this->__paths[0]['namedArgs'] as $arg => $value) { - $_this->named['rules'][$arg] = true; + if (count($self->__paths)) { + if (isset($self->__paths[0]['namedArgs'])) { + foreach ($self->__paths[0]['namedArgs'] as $arg => $value) { + $self->named['rules'][$arg] = true; } } } @@ -685,12 +587,12 @@ class Router { * @static */ function getParams($current = false) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); if ($current) { - return $_this->__params[count($_this->__params) - 1]; + return $self->__params[count($self->__params) - 1]; } - if (isset($_this->__params[0])) { - return $_this->__params[0]; + if (isset($self->__params[0])) { + return $self->__params[0]; } return array(); } @@ -721,14 +623,14 @@ class Router { * @static */ function getPaths($current = false) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); if ($current) { - return $_this->__paths[count($_this->__paths) - 1]; + return $self->__paths[count($self->__paths) - 1]; } - if (!isset($_this->__paths[0])) { + if (!isset($self->__paths[0])) { return array('base' => null); } - return $_this->__paths[0]; + return $self->__paths[0]; } /** @@ -739,11 +641,11 @@ class Router { * @static */ function reload() { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); foreach (get_class_vars('Router') as $key => $val) { - $_this->{$key} = $val; + $self->{$key} = $val; } - $_this->__setPrefixes(); + $self->__setPrefixes(); } /** @@ -756,16 +658,16 @@ class Router { * @static */ function promote($which = null) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); if ($which === null) { - $which = count($_this->routes) - 1; + $which = count($self->routes) - 1; } - if (!isset($_this->routes[$which])) { + if (!isset($self->routes[$which])) { return false; } - $route = $_this->routes[$which]; - unset($_this->routes[$which]); - array_unshift($_this->routes, $route); + $route =& $self->routes[$which]; + unset($self->routes[$which]); + array_unshift($self->routes, $route); return true; } @@ -775,7 +677,7 @@ class Router { * Returns an URL pointing to a combination of controller and action. Param * $url can be: * - * - Empty - the method will find adress to actuall controller/action. + * - Empty - the method will find address to actuall controller/action. * - '/' - the method will find base URL of application. * - A combination of controller/action - the method will find url for it. * @@ -792,20 +694,20 @@ class Router { * @static */ function url($url = null, $full = false) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); $defaults = $params = array('plugin' => null, 'controller' => null, 'action' => 'index'); if (is_bool($full)) { $escape = false; } else { - extract(array_merge(array('escape' => false, 'full' => false), $full)); + extract($full + array('escape' => false, 'full' => false)); } - if (!empty($_this->__params)) { + if (!empty($self->__params)) { if (isset($this) && !isset($this->params['requested'])) { - $params = $_this->__params[0]; + $params = $self->__params[0]; } else { - $params = end($_this->__params); + $params = end($self->__params); } if (isset($params['prefix']) && strpos($params['action'], $params['prefix']) === 0) { $params['action'] = substr($params['action'], strlen($params['prefix']) + 1); @@ -813,11 +715,11 @@ class Router { } $path = array('base' => null); - if (!empty($_this->__paths)) { + if (!empty($self->__paths)) { if (isset($this) && !isset($this->params['requested'])) { - $path = $_this->__paths[0]; + $path = $self->__paths[0]; } else { - $path = end($_this->__paths); + $path = end($self->__paths); } } $base = $path['base']; @@ -848,26 +750,16 @@ class Router { } } - $prefixExists = (array_intersect_key($url, array_flip($_this->__prefixes))); - foreach ($_this->__prefixes as $prefix) { + $prefixExists = (array_intersect_key($url, array_flip($self->__prefixes))); + foreach ($self->__prefixes as $prefix) { if (!isset($url[$prefix]) && !empty($params[$prefix]) && !$prefixExists) { $url[$prefix] = true; } elseif (isset($url[$prefix]) && !$url[$prefix]) { unset($url[$prefix]); } } - $plugin = false; - if (array_key_exists('plugin', $url)) { - $plugin = $url['plugin']; - } - - $_url = $url; - $url = array_merge(array('controller' => $params['controller'], 'plugin' => $params['plugin']), Set::filter($url, true)); - - if ($plugin !== false) { - $url['plugin'] = $plugin; - } + $url += array('controller' => $params['controller'], 'plugin' => $params['plugin']); if (isset($url['ext'])) { $extension = '.' . $url['ext']; @@ -875,87 +767,22 @@ class Router { } $match = false; - foreach ($_this->routes as $i => $route) { - if (count($route) === 3) { - $route = $_this->compile($i); - } + for ($i = 0, $len = count($self->routes); $i < $len; $i++) { $originalUrl = $url; - if (isset($route[4]['persist'], $_this->__params[0])) { - foreach($route[4]['persist'] as $_key) { - if (array_key_exists($_key, $_url)) { - $url[$_key] = $_url[$_key]; - } elseif (array_key_exists($_key, $params)) { - $url[$_key] = $params[$_key]; - } - } + if (isset($self->routes[$i]->options['persist'], $params)) { + $url = $self->routes[$i]->persistParams($url, $params); } - if ($match = $_this->mapRouteElements($route, $url)) { + + if ($match = $self->routes[$i]->match($url)) { $output = trim($match, '/'); $url = array(); break; } $url = $originalUrl; } - - $named = $args = array(); - $skip = array_merge( - array('bare', 'action', 'controller', 'plugin', 'ext', '?', '#', 'prefix'), - $_this->__prefixes - ); - - $keys = array_values(array_diff(array_keys($url), $skip)); - $count = count($keys); - - // Remove this once parsed URL parameters can be inserted into 'pass' - for ($i = 0; $i < $count; $i++) { - if (is_numeric($keys[$i])) { - $args[] = $url[$keys[$i]]; - } else { - $named[$keys[$i]] = $url[$keys[$i]]; - } - } - if ($match === false) { - list($args, $named) = array(Set::filter($args, true), Set::filter($named)); - foreach ($_this->__prefixes as $prefix) { - if (!empty($url[$prefix])) { - $url['action'] = str_replace($prefix . '_', '', $url['action']); - break; - } - } - - if (empty($named) && empty($args) && (!isset($url['action']) || $url['action'] === 'index')) { - $url['action'] = null; - } - - $urlOut = Set::filter(array($url['controller'], $url['action'])); - - if (isset($url['plugin']) && $url['plugin'] != $url['controller']) { - array_unshift($urlOut, $url['plugin']); - } - - foreach ($_this->__prefixes as $prefix) { - if (isset($url[$prefix])) { - array_unshift($urlOut, $prefix); - break; - } - } - $output = implode('/', $urlOut) . '/'; - } - - if (!empty($args)) { - $args = implode('/', $args); - if ($output{strlen($output) - 1} != '/') { - $args = '/'. $args; - } - $output .= $args; - } - - if (!empty($named)) { - foreach ($named as $name => $value) { - $output .= '/' . $name . $_this->named['separator'] . $value; - } + $output = $self->_handleNoRoute($url); } $output = str_replace('//', '/', $base . '/' . $output); } else { @@ -971,7 +798,7 @@ class Router { $output = $base . $url; } else { $output = $base . '/'; - foreach ($_this->__prefixes as $prefix) { + foreach ($self->__prefixes as $prefix) { if (isset($params[$prefix])) { $output .= $prefix . '/'; break; @@ -991,188 +818,91 @@ class Router { $output = substr($output, 0, -1); } - return $output . $extension . $_this->queryString($q, array(), $escape) . $frag; + return $output . $extension . $self->queryString($q, array(), $escape) . $frag; } /** - * Maps a URL array onto a route and returns the string result, or false if no match + * A special fallback method that handles url arrays that cannot match + * any defined routes. * - * @param array $route Route Route - * @param array $url URL URL to map - * @return mixed Result (as string) or false if no match - * @access public - * @static + * @param array $url A url that didn't match any routes + * @return string A generated url for the array + * @see Router::url() */ - function mapRouteElements($route, $url) { - if (isset($route[3]['prefix'])) { - $prefix = $route[3]['prefix']; - unset($route[3]['prefix']); - } + function _handleNoRoute($url) { + $named = $args = array(); + $skip = array_merge( + array('bare', 'action', 'controller', 'plugin', 'prefix'), + $this->__prefixes + ); - $pass = array(); - $defaults = $route[3]; - $routeParams = $route[2]; - $params = Set::diff($url, $defaults); - $urlInv = array_combine(array_values($url), array_keys($url)); + $keys = array_values(array_diff(array_keys($url), $skip)); + $count = count($keys); - $i = 0; - while (isset($defaults[$i])) { - if (isset($urlInv[$defaults[$i]])) { - if (!in_array($defaults[$i], $url) && is_int($urlInv[$defaults[$i]])) { - return false; - } - unset($urlInv[$defaults[$i]], $defaults[$i]); + // Remove this once parsed URL parameters can be inserted into 'pass' + for ($i = 0; $i < $count; $i++) { + if (is_numeric($keys[$i])) { + $args[] = $url[$keys[$i]]; } else { - return false; - } - $i++; - } - - foreach ($params as $key => $value) { - if (is_int($key)) { - $pass[] = $value; - unset($params[$key]); - } - } - list($named, $params) = Router::getNamedElements($params); - - if (!strpos($route[0], '*') && (!empty($pass) || !empty($named))) { - return false; - } - - $urlKeys = array_keys($url); - $paramsKeys = array_keys($params); - $defaultsKeys = array_keys($defaults); - - if (!empty($params)) { - if (array_diff($paramsKeys, $routeParams) != array()) { - return false; - } - $required = array_values(array_diff($routeParams, $urlKeys)); - $reqCount = count($required); - - for ($i = 0; $i < $reqCount; $i++) { - if (array_key_exists($required[$i], $defaults) && $defaults[$required[$i]] === null) { - unset($required[$i]); - } - } - } - $isFilled = true; - - if (!empty($routeParams)) { - $filled = array_intersect_key($url, array_combine($routeParams, array_keys($routeParams))); - $isFilled = (array_diff($routeParams, array_keys($filled)) === array()); - if (!$isFilled && empty($params)) { - return false; + $named[$keys[$i]] = $url[$keys[$i]]; } } - if (empty($params)) { - return Router::__mapRoute($route, array_merge($url, compact('pass', 'named', 'prefix'))); - } elseif (!empty($routeParams) && !empty($route[3])) { - - if (!empty($required)) { - return false; - } - foreach ($params as $key => $val) { - if ((!isset($url[$key]) || $url[$key] != $val) || (!isset($defaults[$key]) || $defaults[$key] != $val) && !in_array($key, $routeParams)) { - if (!isset($defaults[$key])) { - continue; - } - return false; - } - } - } else { - if (empty($required) && $defaults['plugin'] === $url['plugin'] && $defaults['controller'] === $url['controller'] && $defaults['action'] === $url['action']) { - return Router::__mapRoute($route, array_merge($url, compact('pass', 'named', 'prefix'))); - } - return false; - } - - if (!empty($route[4])) { - foreach ($route[4] as $key => $reg) { - if (array_key_exists($key, $url) && !preg_match('#' . $reg . '#', $url[$key])) { - return false; - } + list($args, $named) = array(Set::filter($args, true), Set::filter($named, true)); + foreach ($this->__prefixes as $prefix) { + if (!empty($url[$prefix])) { + $url['action'] = str_replace($prefix . '_', '', $url['action']); + break; } } - return Router::__mapRoute($route, array_merge($filled, compact('pass', 'named', 'prefix'))); - } -/** - * Merges URL parameters into a route string - * - * @param array $route Route - * @param array $params Parameters - * @return string Merged URL with parameters - * @access private - */ - function __mapRoute($route, $params = array()) { - if (isset($params['plugin']) && isset($params['controller']) && $params['plugin'] === $params['controller']) { - unset($params['controller']); + if (empty($named) && empty($args) && (!isset($url['action']) || $url['action'] === 'index')) { + $url['action'] = null; } - if (isset($params['prefix']) && isset($params['action'])) { - $params['action'] = str_replace($params['prefix'] . '_', '', $params['action']); - unset($params['prefix']); + $urlOut = array_filter(array($url['controller'], $url['action'])); + + if (isset($url['plugin']) && $url['plugin'] != $url['controller']) { + array_unshift($urlOut, $url['plugin']); } - if (isset($params['pass']) && is_array($params['pass'])) { - $params['pass'] = implode('/', Set::filter($params['pass'], true)); - } elseif (!isset($params['pass'])) { - $params['pass'] = ''; - } - - if (isset($params['named'])) { - if (is_array($params['named'])) { - $count = count($params['named']); - $keys = array_keys($params['named']); - $named = array(); - - for ($i = 0; $i < $count; $i++) { - $named[] = $keys[$i] . $this->named['separator'] . $params['named'][$keys[$i]]; - } - $params['named'] = implode('/', $named); + foreach ($this->__prefixes as $prefix) { + if (isset($url[$prefix])) { + array_unshift($urlOut, $prefix); + break; } - $params['pass'] = str_replace('//', '/', $params['pass'] . '/' . $params['named']); } - $out = $route[0]; + $output = implode('/', $urlOut); - foreach ($route[2] as $key) { - $string = null; - if (isset($params[$key])) { - $string = $params[$key]; - unset($params[$key]); - } elseif (strpos($out, $key) != strlen($out) - strlen($key)) { - $key = $key . '/'; + if (!empty($args)) { + $output .= '/' . implode('/', $args); + } + + if (!empty($named)) { + foreach ($named as $name => $value) { + $output .= '/' . $name . $this->named['separator'] . $value; } - $out = str_replace(':' . $key, $string, $out); } - - if (strpos($route[0], '*')) { - $out = str_replace('*', $params['pass'], $out); - } - - return $out; + return $output; } /** * Takes an array of URL parameters and separates the ones that can be used as named arguments * - * @param array $params Associative array of URL parameters. - * @param string $controller Name of controller being routed. Used in scoping. - * @param string $action Name of action being routed. Used in scoping. + * @param array $params Associative array of URL parameters. + * @param string $controller Name of controller being routed. Used in scoping. + * @param string $action Name of action being routed. Used in scoping. * @return array * @access public * @static */ function getNamedElements($params, $controller = null, $action = null) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); $named = array(); foreach ($params as $param => $val) { - if (isset($_this->named['rules'][$param])) { - $rule = $_this->named['rules'][$param]; + if (isset($self->named['rules'][$param])) { + $rule = $self->named['rules'][$param]; if (Router::matchNamed($param, $val, $rule, compact('controller', 'action'))) { $named[$param] = $val; unset($params[$param]); @@ -1212,8 +942,7 @@ class Router { if (!$actionMatches) { return false; } - $valueMatches = !isset($rule['match']) || preg_match(sprintf('/%s/', $rule['match']), $val); - return $valueMatches; + return (!isset($rule['match']) || preg_match('/' . $rule['match'] . '/', $val)); } /** @@ -1255,6 +984,7 @@ class Router { * @param mixed $url URL to normalize * @return string Normalized URL * @access public + * @static */ function normalize($url = '/') { if (is_array($url)) { @@ -1288,8 +1018,8 @@ class Router { * @static */ function requestRoute() { - $_this =& Router::getInstance(); - return $_this->__currentRoute[0]; + $self =& Router::getInstance(); + return $self->__currentRoute[0]; } /** @@ -1300,8 +1030,8 @@ class Router { * @static */ function currentRoute() { - $_this =& Router::getInstance(); - return $_this->__currentRoute[count($_this->__currentRoute) - 1]; + $self =& Router::getInstance(); + return $self->__currentRoute[count($self->__currentRoute) - 1]; } /** @@ -1327,36 +1057,6 @@ class Router { return $base; } -/** - * Strip escape characters from parameter values. - * - * @param mixed $param Either an array, or a string - * @return mixed Array or string escaped - * @access public - * @static - */ - function stripEscape($param) { - $_this =& Router::getInstance(); - if (!is_array($param) || empty($param)) { - if (is_bool($param)) { - return $param; - } - - return preg_replace('/^(?:[\\t ]*(?:-!)+)/', '', $param); - } - - foreach ($param as $key => $value) { - if (is_string($value)) { - $return[$key] = preg_replace('/^(?:[\\t ]*(?:-!)+)/', '', $value); - } else { - foreach ($value as $array => $string) { - $return[$key][$array] = $_this->stripEscape($string); - } - } - } - return $return; - } - /** * Instructs the router to parse out file extensions from the URL. For example, * http://example.com/posts.rss would yield an file extension of "rss". @@ -1374,10 +1074,10 @@ class Router { * @static */ function parseExtensions() { - $_this =& Router::getInstance(); - $_this->__parseExtensions = true; + $self =& Router::getInstance(); + $self->__parseExtensions = true; if (func_num_args() > 0) { - $_this->__validExtensions = func_get_args(); + $self->__validExtensions = func_get_args(); } } @@ -1390,19 +1090,16 @@ class Router { * @static */ function getArgs($args, $options = array()) { - $_this =& Router::getInstance(); + $self =& Router::getInstance(); $pass = $named = array(); $args = explode('/', $args); - $greedy = $_this->named['greedy']; - if (isset($options['greedy'])) { - $greedy = $options['greedy']; - } + $greedy = isset($options['greedy']) ? $options['greedy'] : $self->named['greedy']; $context = array(); if (isset($options['context'])) { $context = $options['context']; } - $rules = $_this->named['rules']; + $rules = $self->named['rules']; if (isset($options['named'])) { $greedy = isset($options['greedy']) && $options['greedy'] === true; foreach ((array)$options['named'] as $key => $val) { @@ -1418,13 +1115,12 @@ class Router { if (empty($param) && $param !== '0' && $param !== 0) { continue; } - $param = $_this->stripEscape($param); - $separatorIsPresent = strpos($param, $_this->named['separator']) !== false; + $separatorIsPresent = strpos($param, $self->named['separator']) !== false; if ((!isset($options['named']) || !empty($options['named'])) && $separatorIsPresent) { - list($key, $val) = explode($_this->named['separator'], $param, 2); + list($key, $val) = explode($self->named['separator'], $param, 2); $hasRule = isset($rules[$key]); - $passIt = (!$hasRule && !$greedy) || ($hasRule && !$_this->matchNamed($key, $val, $rules[$key], $context)); + $passIt = (!$hasRule && !$greedy) || ($hasRule && !$self->matchNamed($key, $val, $rules[$key], $context)); if ($passIt) { $pass[] = $param; } else { @@ -1437,4 +1133,376 @@ class Router { return compact('pass', 'named'); } } + +/** + * A single Route used by the Router to connect requests to + * parameter maps. + * + * Not normally created as a standalone. Use Router::connect() to create + * Routes for your application. + * + * @package cake.libs + * @since 1.3.0 + * @see Router::connect + */ +class CakeRoute { + +/** + * An array of named segments in a Route. + * `/:controller/:action/:id` has 3 named elements + * + * @var array + * @access public + */ + var $keys = array(); + +/** + * An array of additional parameters for the Route. + * + * @var array + * @access public + */ + var $options = array(); +/** + * Default parameters for a Route + * + * @var array + * @access public + */ + var $defaults = array(); + +/** + * The routes template string. + * + * @var string + * @access public + */ + var $template = null; + +/** + * Is this route a greedy route? Greedy routes have a `/*` in their + * template + * + * @var string + * @access protected + */ + var $_greedy = false; + +/** + * The compiled route regular expresssion + * + * @var string + * @access protected + */ + var $_compiledRoute = null; + +/** + * HTTP header shortcut map. Used for evaluating header-based route expressions. + * + * @var array + * @access private + */ + var $__headerMap = array( + 'type' => 'content_type', + 'method' => 'request_method', + 'server' => 'server_name' + ); + +/** + * Constructor for a Route + * + * @param string $template Template string with parameter placeholders + * @param array $defaults Array of defaults for the route. + * @param string $params Array of parameters and additional options for the Route + * @return void + * @access public + */ + function CakeRoute($template, $defaults = array(), $options = array()) { + $this->template = $template; + $this->defaults = (array)$defaults; + $this->options = (array)$options; + } + +/** + * Check if a Route has been compiled into a regular expression. + * + * @return boolean + * @access public + */ + function compiled() { + return !empty($this->_compiledRoute); + } + +/** + * Compiles the routes regular expression. Modifies defaults property so all necessary keys are set + * and populates $this->names with the named routing elements. + * + * @return array Returns a string regular expression of the compiled route. + * @access public + */ + function compile() { + if ($this->compiled()) { + return $this->_compiledRoute; + } + $this->_writeRoute(); + return $this->_compiledRoute; + } + +/** + * Builds a route regular expression. Uses the template, defaults and options + * properties to compile a regular expression that can be used to match/parse request strings. + * + * @return void + * @access protected + */ + function _writeRoute() { + if (empty($this->template) || ($this->template === '/')) { + $this->_compiledRoute = '#^/*$#'; + $this->keys = array(); + return; + } + $route = $this->template; + $names = $replacements = $search = array(); + $parsed = preg_quote($this->template, '#'); + + preg_match_all('#:([A-Za-z0-9_-]+[A-Z0-9a-z])#', $route, $namedElements); + foreach ($namedElements[1] as $i => $name) { + if (isset($this->options[$name])) { + $option = null; + if ($name !== 'plugin' && array_key_exists($name, $this->defaults)) { + $option = '?'; + } + $slashParam = '/\\' . $namedElements[0][$i]; + if (strpos($parsed, $slashParam) !== false) { + $replacements[] = '(?:/(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option; + $search[] = $slashParam; + } else { + $search[] = '\\' . $namedElements[0][$i]; + $replacements[] = '(?:(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option; + } + } else { + $replacements[] = '(?:(?P<' . $name . '>[^/]+))?'; + $search[] = '\\' . $namedElements[0][$i]; + } + $names[] = $name; + } + if (preg_match('#\/\*$#', $route, $m)) { + $parsed = preg_replace('#/\\\\\*$#', '(?:/(?P<_args_>.*))?', $parsed); + $this->_greedy = true; + } + $parsed = str_replace($search, $replacements, $parsed); + $this->_compiledRoute = '#^' . $parsed . '[/]*$#'; + $this->keys = $names; + } + +/** + * Checks to see if the given URL can be parsed by this route. + * If the route can be parsed an array of parameters will be returned if not + * false will be returned. + * + * @param string $url The url to attempt to parse. + * @return mixed Boolean false on failure, otherwise an array or parameters + * @access public + */ + function parse($url) { + if (!$this->compiled()) { + $this->compile(); + } + + if (!preg_match($this->_compiledRoute, $url, $route)) { + return false; + } else { + foreach ($this->defaults as $key => $val) { + if ($key[0] === '[' && preg_match('/^\[(\w+)\]$/', $key, $header)) { + if (isset($this->__headerMap[$header[1]])) { + $header = $this->__headerMap[$header[1]]; + } else { + $header = 'http_' . $header[1]; + } + + $val = (array)$val; + $h = false; + + foreach ($val as $v) { + if (env(strtoupper($header)) === $v) { + $h = true; + } + } + if (!$h) { + return false; + } + } + } + array_shift($route); + $count = count($this->keys); + for ($i = 0; $i <= $count; $i++) { + unset($route[$i]); + } + $route['pass'] = $route['named'] = array(); + $route += $this->defaults; + + foreach ($route as $key => $value) { + if (is_integer($key)) { + $route['pass'][] = $value; + unset($route[$key]); + } + } + return $route; + } + } + +/** + * Apply persistent parameters to a url array. + * + * @param array $url The array to apply persistent parameters to. + * @param array $params An array of persistent values to replace persistent ones. + * @return array An array with persistent parameters applied. + * @access public + */ + function persistParams($url, $params) { + foreach ($this->options['persist'] as $persistKey) { + if (array_key_exists($persistKey, $params)) { + $url[$persistKey] = $params[$persistKey]; + } + } + return $url; + } + +/** + * Attempt to match a url array. If the url matches the routes pattern, then + * return an array of parsed params. If the url doesn't match the routes compiled pattern + * returns false. + * + * @param array $url An array of parameters to check matching with. + * @return mixed Either a string url for the parameters if they match or false. + * @access public + */ + function match($url) { + if (!$this->compiled()) { + $this->compile(); + } + $defaults = $this->defaults; + + if (isset($defaults['prefix'])) { + $url['prefix'] = $defaults['prefix']; + } + + //check that all the key names are in the url + $keyNames = array_flip($this->keys); + if (array_intersect_key($keyNames, $url) != $keyNames) { + return false; + } + + $diffUnfiltered = Set::diff($url, $defaults); + $diff = array(); + + foreach ($diffUnfiltered as $key => $var) { + if ($var === 0 || $var === '0' || !empty($var)) { + $diff[$key] = $var; + } + } + + //if a not a greedy route, no extra params are allowed. + if (!$this->_greedy && array_diff_key($diff, $keyNames) != array()) { + return false; + } + + //remove defaults that are also keys. They can cause match failures + foreach ($this->keys as $key) { + unset($defaults[$key]); + } + $filteredDefaults = array_filter($defaults); + + //if the difference between the url diff and defaults contains keys from defaults its not a match + if (array_intersect_key($filteredDefaults, $diffUnfiltered) !== array()) { + return false; + } + + $passedArgsAndParams = array_diff_key($diff, $filteredDefaults, $keyNames); + list($named, $params) = Router::getNamedElements($passedArgsAndParams, $url['controller'], $url['action']); + + //remove any pass params, they have numeric indexes, skip any params that are in the defaults + $pass = array(); + $i = 0; + while (isset($url[$i])) { + if (!isset($diff[$i])) { + $i++; + continue; + } + $pass[] = $url[$i]; + unset($url[$i], $params[$i]); + $i++; + } + + //still some left over parameters that weren't named or passed args, bail. + if (!empty($params)) { + return false; + } + + //check patterns for routed params + if (!empty($this->options)) { + foreach ($this->options as $key => $pattern) { + if (array_key_exists($key, $url) && !preg_match('#^' . $pattern . '$#', $url[$key])) { + return false; + } + } + } + return $this->_writeUrl(array_merge($url, compact('pass', 'named'))); + } + +/** + * Converts a matching route array into a url string. + * + * @param array $params The params to convert to a string url. + * @return string Compiled route string. + * @access protected + */ + function _writeUrl($params) { + if (isset($params['plugin'], $params['controller']) && $params['plugin'] === $params['controller']) { + unset($params['controller']); + } + + if (isset($params['prefix'], $params['action'])) { + $params['action'] = str_replace($params['prefix'] . '_', '', $params['action']); + unset($params['prefix']); + } + + if (is_array($params['pass'])) { + $params['pass'] = implode('/', $params['pass']); + } + + $instance =& Router::getInstance(); + $separator = $instance->named['separator']; + + if (!empty($params['named'])) { + if (is_array($params['named'])) { + $named = array(); + foreach ($params['named'] as $key => $value) { + $named[] = $key . $separator . $value; + } + $params['pass'] = $params['pass'] . '/' . implode('/', $named);; + } + } + $out = $this->template; + + $search = $replace = array(); + foreach ($this->keys as $key) { + $string = null; + if (isset($params[$key])) { + $string = $params[$key]; + } elseif (strpos($out, $key) != strlen($out) - strlen($key)) { + $key = $key . '/'; + } + $search[] = ':' . $key; + $replace[] = $string; + } + $out = str_replace($search, $replace, $out); + + if (strpos($this->template, '*')) { + $out = str_replace('*', $params['pass'], $out); + } + $out = str_replace('//', '/', $out); + return $out; + } +} ?> \ No newline at end of file diff --git a/cake/libs/security.php b/cake/libs/security.php index b90f8c0b1..b93f9934e 100644 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs */ diff --git a/cake/libs/validation.php b/cake/libs/validation.php index c6fde1e76..19c8c4d2f 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -2,8 +2,6 @@ /** * Validation Class. Used for validation of model data * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -25,8 +23,6 @@ if (!class_exists('Multibyte')) { /** * Offers different validation methods. * - * Long description for file - * * @package cake * @subpackage cake.cake.libs * @since CakePHP v 1.2.0.3830 diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index db2f95fae..5ff3bb4d1 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -201,17 +201,28 @@ class Helper extends Overloadable { $asset = explode('?', $file); $asset[1] = isset($asset[1]) ? '?' . $asset[1] : null; $webPath = "{$this->webroot}" . $asset[0]; + $file = $asset[0]; if (!empty($this->theme)) { - $viewPaths = App::path('views'); + $file = trim($file, '/'); + $theme = $this->theme . '/'; - foreach ($viewPaths as $viewPath) { - $path = $viewPath . 'themed'. DS . $this->theme . DS . 'webroot' . DS . $asset[0]; - $theme = $this->theme . '/'; + if (DS === '\\') { + $file = str_replace('/', '\\', $file); + } + + if (file_exists(Configure::read('App.www_root') . 'theme' . DS . $this->theme . DS . $file)) { + $webPath = "{$this->webroot}theme/" . $theme . $asset[0]; + } else { + $viewPaths = App::path('views'); - if (file_exists($path)) { - $webPath = "{$this->webroot}theme/" . $theme . $asset[0]; - break; + foreach ($viewPaths as $viewPath) { + $path = $viewPath . 'themed'. DS . $this->theme . DS . 'webroot' . DS . $file; + + if (file_exists($path)) { + $webPath = "{$this->webroot}theme/" . $theme . $asset[0]; + break; + } } } } diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index e966ec1c9..16d924624 100755 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -289,7 +289,7 @@ class FormHelper extends AppHelper { } if (!empty($append)) { - $append = sprintf($this->Html->tags['fieldset'], ' style="display:none;"', $append); + $append = sprintf($this->Html->tags['block'], ' style="display:none;"', $append); } $this->setEntity($model . '.', true); @@ -363,7 +363,6 @@ class FormHelper extends AppHelper { if (!isset($this->params['_Token']) || empty($this->params['_Token'])) { return; } - $out = '
'; $locked = array(); foreach ($fields as $key => $value) { @@ -379,11 +378,12 @@ class FormHelper extends AppHelper { $fields = Security::hash(serialize($fields) . Configure::read('Security.salt')); $locked = str_rot13(serialize(array_keys($locked))); - $out .= $this->hidden('_Token.fields', array( + $out = $this->hidden('_Token.fields', array( 'value' => urlencode($fields . ':' . $locked), 'id' => 'TokenFields' . mt_rand() )); - return $out .= '
'; + $out = sprintf($this->Html->tags['block'], ' style="display:none;"', $out); + return $out; } /** diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index fe7ae59a2..e913795cc 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -593,7 +593,7 @@ class JavascriptHelper extends AppHelper { * - postfix - Appends the string to the returned data. Default is '' * - stringKeys - A list of array keys to be treated as a string. * - quoteKeys - If false treats $stringKeys as a list of keys **not** to be quoted. Default is true. - * - q - The type of quote to use. Default is "'" + * - q - The type of quote to use. Default is '"'. This option only affects the keys, not the values. * * @param array $data Data to be converted * @param array $options Set of options: block, prefix, postfix, stringKeys, quoteKeys, q diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index ccd955fc1..d2976683f 100644 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -162,6 +162,19 @@ class JsHelper extends AppHelper { return $this->{$this->__engineName}->object($data, $options); } +/** + * Overwrite inherited Helper::value() + * See JsBaseEngineHelper::value() for more information on this method. + * + * @param mixed $val A PHP variable to be converted to JSON + * @param boolean $quoteStrings If false, leaves string values unquoted + * @return string a JavaScript-safe/JSON representation of $val + * @access public + **/ + function value($val, $quoteString = true) { + return $this->{$this->__engineName}->value($val, $quoteString); + } + /** * Writes all Javascript generated so far to a code block or * caches them to a file and returns a linked script. @@ -235,7 +248,7 @@ class JsHelper extends AppHelper { */ function _createVars() { if (!empty($this->__jsVars)) { - $setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'var ' . $this->setVariable; + $setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'window.' . $this->setVariable; $this->buffer($setVar . ' = ' . $this->object($this->__jsVars) . ';'); } } diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php index dc0fe30f4..84263d567 100644 --- a/cake/libs/view/helpers/paginator.php +++ b/cake/libs/view/helpers/paginator.php @@ -411,12 +411,12 @@ class PaginatorHelper extends AppHelper { ${$key} = $options[$key]; unset($options[$key]); } - $url = array_merge(array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)), $url); + $urlParams = array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)); if ($this->{$check}($model)) { - return $this->link($title, $url, array_merge($options, array('escape' => $escape, 'class' => $class))); + return $this->link($title, $urlParams, array_merge($options, compact('escape', 'class', 'url'))); } else { - return $this->Html->tag($tag, $title, array_merge($options, array('class' => $class, 'escape' => $escape))); + return $this->Html->tag($tag, $title, array_merge($options, compact('escape', 'class'))); } } diff --git a/cake/libs/view/helpers/session.php b/cake/libs/view/helpers/session.php index 82c7184b4..5383b4351 100644 --- a/cake/libs/view/helpers/session.php +++ b/cake/libs/view/helpers/session.php @@ -2,8 +2,6 @@ /** * Session Helper provides access to the Session in the Views. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/libs/view/media.php b/cake/libs/view/media.php index 145ca631d..085ba91da 100644 --- a/cake/libs/view/media.php +++ b/cake/libs/view/media.php @@ -17,7 +17,9 @@ * @since CakePHP(tm) v 1.2.0.5714 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -class MediaView { +App::import('View', 'View', false); + +class MediaView extends View { /** * Holds known mime type mappings @@ -35,11 +37,11 @@ class MediaView { 'eps' => 'application/postscript', 'exe' => 'application/octet-stream', 'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv', 'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'bz2' => 'application/x-bzip', '7z' => 'application/x-7z-compressed', 'hdf' => 'application/x-hdf', - 'hqx' => 'application/mac-binhex40', 'ips' => 'application/x-ipscript', 'ipx' => 'application/x-ipix', - 'js' => 'application/x-javascript', 'latex' => 'application/x-latex', 'lha' => 'application/octet-stream', - 'lsp' => 'application/x-lisp', 'lzh' => 'application/octet-stream', 'man' => 'application/x-troff-man', - 'me' => 'application/x-troff-me', 'mif' => 'application/vnd.mif', 'ms' => 'application/x-troff-ms', - 'nc' => 'application/x-netcdf', 'oda' => 'application/oda', 'pdf' => 'application/pdf', + 'hqx' => 'application/mac-binhex40', 'ico' => 'image/vnd.microsoft.icon', 'ips' => 'application/x-ipscript', + 'ipx' => 'application/x-ipix', 'js' => 'application/x-javascript', 'latex' => 'application/x-latex', + 'lha' => 'application/octet-stream', 'lsp' => 'application/x-lisp', 'lzh' => 'application/octet-stream', + 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'mif' => 'application/vnd.mif', + 'ms' => 'application/x-troff-ms', 'nc' => 'application/x-netcdf', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'pgn' => 'application/x-chess-pgn', 'pot' => 'application/mspowerpoint', 'pps' => 'application/mspowerpoint', 'ppt' => 'application/mspowerpoint', 'ppz' => 'application/mspowerpoint', 'pre' => 'application/x-freelance', 'prt' => 'application/pro_eng', 'ps' => 'application/postscript', 'roff' => 'application/x-troff', @@ -90,7 +92,8 @@ class MediaView { * * @param object $controller */ - function __construct($controller = null) { + function __construct(&$controller = null) { + parent::__construct($controller); } /** diff --git a/cake/libs/view/theme.php b/cake/libs/view/theme.php index a5df7f740..fb0fae942 100644 --- a/cake/libs/view/theme.php +++ b/cake/libs/view/theme.php @@ -37,8 +37,8 @@ class ThemeView extends View { * * @param Controller $controller */ - function __construct(&$controller) { - parent::__construct($controller); + function __construct(&$controller, $register = true) { + parent::__construct($controller, $register); $this->theme =& $controller->theme; } @@ -51,19 +51,23 @@ class ThemeView extends View { */ function _paths($plugin = null, $cached = true) { $paths = parent::_paths($plugin, $cached); + $themePaths = array(); if (!empty($this->theme)) { $count = count($paths); for ($i = 0; $i < $count; $i++) { - $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS; + if (strpos($paths[$i], DS . 'plugins' . DS) === false + && strpos($paths[$i], DS . 'libs' . DS . 'view') === false) { + if ($plugin) { + $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS . 'plugins' . DS . $plugin . DS; + } + $themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS; + } } $paths = array_merge($themePaths, $paths); } - - if (empty($this->__paths)) { - $this->__paths = $paths; - } - return $paths; + $this->__paths = $paths; + return $this->__paths; } } ?> \ No newline at end of file diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 701e21044..0df79cd62 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -609,7 +609,7 @@ class View extends Object { function entity() { $assoc = ($this->association) ? $this->association : $this->model; if (!empty($this->entityPath)) { - $path = explode('.',$this->entityPath); + $path = explode('.', $this->entityPath); $count = count($path); if ( ($count == 1 && !empty($this->association)) || @@ -947,12 +947,8 @@ class View extends Object { } $paths[] = App::pluginPath($plugin) . 'views' . DS; } - $paths = array_merge($paths, $viewPaths); - - if (empty($this->__paths)) { - $this->__paths = $paths; - } - return $paths; + $this->__paths = array_merge($paths, $viewPaths); + return $this->__paths; } } diff --git a/cake/libs/xml.php b/cake/libs/xml.php index 41d246e3f..a1fe11368 100644 --- a/cake/libs/xml.php +++ b/cake/libs/xml.php @@ -114,7 +114,6 @@ class XmlNode extends Object { $this->createTextNode($value); } } - /** * Adds a namespace to the current node * @@ -250,7 +249,7 @@ class XmlNode extends Object { } $n = $name; - if (!empty($chldObjs['_name_'])) { + if (isset($chldObjs['_name_'])) { $n = null; unset($chldObjs['_name_']); } @@ -760,13 +759,13 @@ class XmlNode extends Object { * if given the $recursive parameter. * * @param boolean $recursive Recursively delete elements. - * @access private + * @access protected */ - function __killParent($recursive = true) { + function _killParent($recursive = true) { unset($this->__parent, $this->_log); if ($recursive && $this->hasChildren()) { for ($i = 0; $i < count($this->children); $i++) { - $this->children[$i]->__killParent(true); + $this->children[$i]->_killParent(true); } } } @@ -1135,6 +1134,7 @@ class Xml extends XmlNode { if (is_resource($this->__parser)) { xml_parser_free($this->__parser); } + $this->_killParent(true); } /** diff --git a/cake/tests/cases/basics.test.php b/cake/tests/cases/basics.test.php index bb24c70f9..8cb720838 100644 --- a/cake/tests/cases/basics.test.php +++ b/cake/tests/cases/basics.test.php @@ -2,8 +2,6 @@ /** * BasicsTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/console/cake.test.php b/cake/tests/cases/console/cake.test.php index 317afe851..a2aa1023e 100644 --- a/cake/tests/cases/console/cake.test.php +++ b/cake/tests/cases/console/cake.test.php @@ -2,8 +2,6 @@ /** * ShellDispatcherTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/console/libs/tasks/view.test.php b/cake/tests/cases/console/libs/tasks/view.test.php index be7e9321c..70715288f 100644 --- a/cake/tests/cases/console/libs/tasks/view.test.php +++ b/cake/tests/cases/console/libs/tasks/view.test.php @@ -336,6 +336,11 @@ class ViewTaskTest extends CakeTestCase { $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result); $this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'body\'\]/', $result); + $result = $this->Task->getContent('admin_add', $vars); + $this->assertPattern("/input\('name'\)/", $result); + $this->assertPattern("/input\('body'\)/", $result); + $this->assertPattern('/List .+Test View Models/', $result); + Configure::write('Routing', $_back); } diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index 1029ab543..0c10a5f51 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -2,8 +2,6 @@ /** * DispatcherTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -1379,7 +1377,7 @@ class DispatcherTest extends CakeTestCase { function testAdminDispatch() { $_POST = array(); $Dispatcher =& new TestDispatcher(); - Configure::write('Routing.admin', 'admin'); + Configure::write('Routing.prefixes', array('admin')); Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php'); $url = 'admin/test_dispatch_pages/index/param:value/param2:value2'; @@ -1545,7 +1543,7 @@ class DispatcherTest extends CakeTestCase { $this->assertEqual($controller->params['controller'], $expected); - Configure::write('Routing.admin', 'admin'); + Configure::write('Routing.prefixes', array('admin')); Router::reload(); $Dispatcher =& new TestDispatcher(); @@ -1811,13 +1809,24 @@ class DispatcherTest extends CakeTestCase { $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg'); $this->assertEqual($file, $result); - $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/css/test_asset.css'); ob_start(); $Dispatcher->cached('theme/test_theme/css/test_asset.css'); $result = ob_get_clean(); $this->assertEqual('this is the test asset css file', $result); + $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/js/theme.js'); + ob_start(); + $Dispatcher->cached('theme/test_theme/js/theme.js'); + $result = ob_get_clean(); + $this->assertEqual('root theme js file', $result); + + $Dispatcher->params = $Dispatcher->parseParams('theme/test_theme/js/one/theme_one.js'); + ob_start(); + $Dispatcher->cached('theme/test_theme/js/one/theme_one.js'); + $result = ob_get_clean(); + $this->assertEqual('nested theme js file', $result); + ob_start(); $Dispatcher->dispatch('test_plugin/flash/plugin_test.swf'); $result = ob_get_clean(); @@ -1856,16 +1865,22 @@ class DispatcherTest extends CakeTestCase { $file = file_get_contents(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' .DS . 'webroot' . DS . 'img' . DS . 'cake.icon.gif'); $this->assertEqual($file, $result); - - Configure::write('debug', $debug); $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. + + $Dispatcher->params = $Dispatcher->parseParams('plugin_js/js/one/plugin_one.js'); + ob_start(); + $Dispatcher->cached('plugin_js/js/one/plugin_one.js'); + $result = ob_get_clean(); + $expected = "alert('plugin one nested js file');"; + $this->assertEqual($result, $expected); + Configure::write('debug', $debug); + //reset the header content-type without page can render as plain text. + header('Content-type: text/html'); } /** diff --git a/cake/tests/cases/libs/cache.test.php b/cake/tests/cases/libs/cache.test.php index 4e575bc8c..09346da8e 100644 --- a/cake/tests/cases/libs/cache.test.php +++ b/cake/tests/cases/libs/cache.test.php @@ -2,8 +2,6 @@ /** * CacheTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/cache/apc.test.php b/cake/tests/cases/libs/cache/apc.test.php index 1377cfe41..10f9593dd 100644 --- a/cake/tests/cases/libs/cache/apc.test.php +++ b/cake/tests/cases/libs/cache/apc.test.php @@ -2,8 +2,6 @@ /** * ApcEngineTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/cache/xcache.test.php b/cake/tests/cases/libs/cache/xcache.test.php index 50ed9c280..f78955cb0 100644 --- a/cake/tests/cases/libs/cache/xcache.test.php +++ b/cake/tests/cases/libs/cache/xcache.test.php @@ -2,8 +2,6 @@ /** * XcacheEngineTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/cake_session.test.php b/cake/tests/cases/libs/cake_session.test.php index 99d030cfd..506e896b7 100644 --- a/cake/tests/cases/libs/cake_session.test.php +++ b/cake/tests/cases/libs/cake_session.test.php @@ -2,8 +2,6 @@ /** * SessionTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/cake_socket.test.php b/cake/tests/cases/libs/cake_socket.test.php index 501839a8c..ecdfe2f09 100644 --- a/cake/tests/cases/libs/cake_socket.test.php +++ b/cake/tests/cases/libs/cake_socket.test.php @@ -2,8 +2,6 @@ /** * SocketTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/cake_test_fixture.test.php b/cake/tests/cases/libs/cake_test_fixture.test.php index 385b07562..2721310f5 100644 --- a/cake/tests/cases/libs/cake_test_fixture.test.php +++ b/cake/tests/cases/libs/cake_test_fixture.test.php @@ -2,8 +2,6 @@ /** * CakeTestFixture file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/class_registry.test.php b/cake/tests/cases/libs/class_registry.test.php index 205df9108..8ba53b41f 100644 --- a/cake/tests/cases/libs/class_registry.test.php +++ b/cake/tests/cases/libs/class_registry.test.php @@ -2,8 +2,6 @@ /** * ClassRegistryTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/code_coverage_manager.test.php b/cake/tests/cases/libs/code_coverage_manager.test.php index f24a2c059..cfc5968b2 100644 --- a/cake/tests/cases/libs/code_coverage_manager.test.php +++ b/cake/tests/cases/libs/code_coverage_manager.test.php @@ -2,8 +2,6 @@ /** * CodeCoverageManagerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/component.test.php b/cake/tests/cases/libs/controller/component.test.php index f5a6745d1..eaa19895f 100644 --- a/cake/tests/cases/libs/controller/component.test.php +++ b/cake/tests/cases/libs/controller/component.test.php @@ -2,8 +2,6 @@ /** * ComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index 2a2f07c47..90dad8c03 100644 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/cake/tests/cases/libs/controller/components/acl.test.php @@ -2,8 +2,6 @@ /** * AclComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 07bf1b8f7..664da4b0f 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -2,8 +2,6 @@ /** * AuthComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -1332,8 +1330,8 @@ class AuthTest extends CakeTestCase { * @return void */ function testAdminRoute() { - $admin = Configure::read('Routing.admin'); - Configure::write('Routing.admin', 'admin'); + $prefixes = Configure::read('Routing.prefixes'); + Configure::write('Routing.prefixes', array('admin')); Router::reload(); $url = '/admin/auth_test/add'; @@ -1360,7 +1358,7 @@ class AuthTest extends CakeTestCase { $this->Controller->Auth->startup($this->Controller); $this->assertEqual($this->Controller->testUrl, '/admin/auth_test/login'); - Configure::write('Routing.admin', $admin); + Configure::write('Routing.prefixes', $prefixes); } /** @@ -1481,5 +1479,41 @@ class AuthTest extends CakeTestCase { $this->Controller->Auth->shutdown($this->Controller); $this->assertFalse($this->Controller->Session->read('Auth.redirect')); } + +/** + * test the initialize callback and its interactions with Router::prefixes() + * + * @return void + */ + function testInitializeAndRoutingPrefixes() { + $restore = Configure::read('Routing'); + Configure::write('Routing.prefixes', array('admin', 'super_user')); + Router::reload(); + $this->Controller->Auth->initialize($this->Controller); + + $this->assertTrue(isset($this->Controller->Auth->actionMap['delete'])); + $this->assertTrue(isset($this->Controller->Auth->actionMap['view'])); + $this->assertTrue(isset($this->Controller->Auth->actionMap['add'])); + $this->assertTrue(isset($this->Controller->Auth->actionMap['admin_view'])); + $this->assertTrue(isset($this->Controller->Auth->actionMap['super_user_delete'])); + + Configure::write('Routing', $restore); + } + +/** + * test that logout deletes the session variables. and returns the correct url + * + * @return void + */ + function testLogout() { + $this->Controller->Session->write('Auth.User.id', '1'); + $this->Controller->Session->write('Auth.redirect', '/users/login'); + $this->Controller->Auth->logoutRedirect = '/'; + $result = $this->Controller->Auth->logout(); + + $this->assertEqual($result, '/'); + $this->assertNull($this->Controller->Session->read('Auth.AuthUser')); + $this->assertNull($this->Controller->Session->read('Auth.redirect')); + } } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/controller/components/cookie.test.php b/cake/tests/cases/libs/controller/components/cookie.test.php index a5b36cffd..6bb0a2372 100644 --- a/cake/tests/cases/libs/controller/components/cookie.test.php +++ b/cake/tests/cases/libs/controller/components/cookie.test.php @@ -2,8 +2,6 @@ /** * CookieComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/components/request_handler.test.php b/cake/tests/cases/libs/controller/components/request_handler.test.php index ca757321f..58542dc5b 100644 --- a/cake/tests/cases/libs/controller/components/request_handler.test.php +++ b/cake/tests/cases/libs/controller/components/request_handler.test.php @@ -2,8 +2,6 @@ /** * RequestHandlerComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php index d0973e23b..f9024902d 100644 --- a/cake/tests/cases/libs/controller/components/security.test.php +++ b/cake/tests/cases/libs/controller/components/security.test.php @@ -2,8 +2,6 @@ /** * SecurityComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/components/session.test.php b/cake/tests/cases/libs/controller/components/session.test.php index 445e8fd03..8dea61c8c 100644 --- a/cake/tests/cases/libs/controller/components/session.test.php +++ b/cake/tests/cases/libs/controller/components/session.test.php @@ -2,8 +2,6 @@ /** * SessionComponentTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index fe35ba865..5382e3d57 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -2,8 +2,6 @@ /** * ControllerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/tests/cases/libs/controller/pages_controller.test.php b/cake/tests/cases/libs/controller/pages_controller.test.php index 941a13087..a1b5f5a87 100644 --- a/cake/tests/cases/libs/controller/pages_controller.test.php +++ b/cake/tests/cases/libs/controller/pages_controller.test.php @@ -2,8 +2,6 @@ /** * PagesControllerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index 0813be0c2..cca0342ff 100644 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -2,8 +2,6 @@ /** * ScaffoldTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/debugger.test.php b/cake/tests/cases/libs/debugger.test.php index 3aa254d10..175fbadf2 100644 --- a/cake/tests/cases/libs/debugger.test.php +++ b/cake/tests/cases/libs/debugger.test.php @@ -2,8 +2,6 @@ /** * DebuggerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/tests/cases/libs/error.test.php b/cake/tests/cases/libs/error.test.php index ac53aa6a2..32914e2cb 100644 --- a/cake/tests/cases/libs/error.test.php +++ b/cake/tests/cases/libs/error.test.php @@ -2,8 +2,6 @@ /** * ErrorHandlerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/file.test.php b/cake/tests/cases/libs/file.test.php index 56d17906e..a909a4be5 100644 --- a/cake/tests/cases/libs/file.test.php +++ b/cake/tests/cases/libs/file.test.php @@ -2,8 +2,6 @@ /** * FileTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/folder.test.php b/cake/tests/cases/libs/folder.test.php index 84a24601b..59403a506 100644 --- a/cake/tests/cases/libs/folder.test.php +++ b/cake/tests/cases/libs/folder.test.php @@ -2,8 +2,6 @@ /** * FolderTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php index 2a059ce06..925e809b1 100644 --- a/cake/tests/cases/libs/http_socket.test.php +++ b/cake/tests/cases/libs/http_socket.test.php @@ -2,8 +2,6 @@ /** * HttpSocketTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/i18n.test.php b/cake/tests/cases/libs/i18n.test.php index cd44f2ff1..589c4c3fa 100644 --- a/cake/tests/cases/libs/i18n.test.php +++ b/cake/tests/cases/libs/i18n.test.php @@ -2,8 +2,6 @@ /** * I18nTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/l10n.test.php b/cake/tests/cases/libs/l10n.test.php index 999f2d364..969cbf372 100644 --- a/cake/tests/cases/libs/l10n.test.php +++ b/cake/tests/cases/libs/l10n.test.php @@ -2,8 +2,6 @@ /** * L10nTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/log/file_log.test.php b/cake/tests/cases/libs/log/file_log.test.php index a479bc302..8b4549adb 100644 --- a/cake/tests/cases/libs/log/file_log.test.php +++ b/cake/tests/cases/libs/log/file_log.test.php @@ -2,8 +2,6 @@ /** * FileLogTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index 716794339..bdf867e13 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -2,8 +2,6 @@ /** * ContainableBehaviorTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/behaviors/translate.test.php b/cake/tests/cases/libs/model/behaviors/translate.test.php index f5fbc0140..d5f28fdb8 100644 --- a/cake/tests/cases/libs/model/behaviors/translate.test.php +++ b/cake/tests/cases/libs/model/behaviors/translate.test.php @@ -2,8 +2,6 @@ /** * TranslateBehaviorTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_adodb.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_adodb.test.php deleted file mode 100644 index 549bf8e66..000000000 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_adodb.test.php +++ /dev/null @@ -1,293 +0,0 @@ -testing) { - $this->simulated[] = $sql; - return null; - } - return parent::_execute($sql); - } - -/** - * getLastQuery method - * - * @access public - * @return void - */ - function getLastQuery() { - return $this->simulated[count($this->simulated) - 1]; - } -} - -/** - * AdodbTestModel - * - * @package cake - * @subpackage cake.tests.cases.libs.model.datasources - */ -class AdodbTestModel extends CakeTestModel { - -/** - * name property - * - * @var string 'AdodbTestModel' - * @access public - */ - var $name = 'AdodbTestModel'; - -/** - * useTable property - * - * @var bool false - * @access public - */ - var $useTable = false; - -/** - * find method - * - * @param mixed $conditions - * @param mixed $fields - * @param mixed $order - * @param mixed $recursive - * @access public - * @return void - */ - function find($conditions = null, $fields = null, $order = null, $recursive = null) { - return $conditions; - } - -/** - * findAll method - * - * @param mixed $conditions - * @param mixed $fields - * @param mixed $order - * @param mixed $recursive - * @access public - * @return void - */ - function findAll($conditions = null, $fields = null, $order = null, $recursive = null) { - return $conditions; - } - -/** - * schema method - * - * @access public - * @return void - */ - function schema() { - return array( - 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), - 'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'), - 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), - 'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), - 'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), - 'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), - 'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'), - 'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'), - 'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'), - 'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''), - 'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''), - 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), - 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) - ); - } -} -if (!class_exists('Article')) { - -/** - * Article class - * - * @package cake - * @subpackage cake.tests.cases.libs.model.datasources.dbo - */ - class Article extends CakeTestModel { - -/** - * name property - * - * @var string 'Article' - * @access public - */ - var $name = 'Article'; - } -} - -/** - * DboAdodbTest class - * - * @package cake - * @subpackage cake.tests.cases.libs.model.datasources.dbo - */ -class DboAdodbTest extends CakeTestCase { - -/** - * The Dbo instance to be tested - * - * @var DboSource - * @access public - */ - var $db = null; - -/** - * fixtures property - * - * @var string - * @access public - */ - var $fixtures = array('core.article'); - -/** - * Skip if cannot connect to AdoDb - * - * @access public - */ - function skip() { - $this->_initDb(); - $db =& ConnectionManager::getDataSource('test_suite'); - $this->skipIf($db->config['driver'] != 'adodb', '%s Adodb connection not available'); - } - -/** - * Sets up a Dbo class instance for testing - * - * @access public - */ - function setUp() { - $db = ConnectionManager::getDataSource('test_suite'); - $this->db = new DboAdoTestDb($db->config); - $this->model = new AdodbTestModel(); - } - -/** - * Sets up a Dbo class instance for testing - * - * @access public - */ - function tearDown() { - unset($this->db); - } - -/** - * Test Dbo value method - * - * @access public - */ - function testQuoting() { - $result = $this->db->fields($this->model); - $expected = array( - '`AdodbTestModel`.`id` AS `AdodbTestModel__id`', - '`AdodbTestModel`.`client_id` AS `AdodbTestModel__client_id`', - '`AdodbTestModel`.`name` AS `AdodbTestModel__name`', - '`AdodbTestModel`.`login` AS `AdodbTestModel__login`', - '`AdodbTestModel`.`passwd` AS `AdodbTestModel__passwd`', - '`AdodbTestModel`.`addr_1` AS `AdodbTestModel__addr_1`', - '`AdodbTestModel`.`addr_2` AS `AdodbTestModel__addr_2`', - '`AdodbTestModel`.`zip_code` AS `AdodbTestModel__zip_code`', - '`AdodbTestModel`.`city` AS `AdodbTestModel__city`', - '`AdodbTestModel`.`country` AS `AdodbTestModel__country`', - '`AdodbTestModel`.`phone` AS `AdodbTestModel__phone`', - '`AdodbTestModel`.`fax` AS `AdodbTestModel__fax`', - '`AdodbTestModel`.`url` AS `AdodbTestModel__url`', - '`AdodbTestModel`.`email` AS `AdodbTestModel__email`', - '`AdodbTestModel`.`comments` AS `AdodbTestModel__comments`', - '`AdodbTestModel`.`last_login` AS `AdodbTestModel__last_login`', - '`AdodbTestModel`.`created` AS `AdodbTestModel__created`', - '`AdodbTestModel`.`updated` AS `AdodbTestModel__updated`' - ); - $this->assertEqual($result, $expected); - - $expected = "'1.2'"; - $result = $this->db->value(1.2, 'float'); - $this->assertEqual($expected, $result); - - $expected = "'1,2'"; - $result = $this->db->value('1,2', 'float'); - $this->assertEqual($expected, $result); - - $expected = "'4713e29446'"; - $result = $this->db->value('4713e29446'); - $this->assertEqual($expected, $result); - - $expected = "'10010001'"; - $result = $this->db->value('10010001'); - $this->assertEqual($expected, $result); - - $expected = "'00010010001'"; - $result = $this->db->value('00010010001'); - $this->assertEqual($expected, $result); - } - -/** - * testColumns method - * - * @access public - * @return void - */ - function testColumns() { - - } -} -?> \ No newline at end of file diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index be57aab6c..8fa9c2f69 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -386,6 +386,7 @@ class DboMysqlTest extends CakeTestCase { * @return void */ function testBuildColumn() { + $restore = $this->db->columns; $this->db->columns = array('varchar(255)' => 1); $data = array( 'name' => 'testName', @@ -411,6 +412,7 @@ class DboMysqlTest extends CakeTestCase { $result = $this->db->buildColumn($data); $expected = '`testName` CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL'; $this->assertEqual($result, $expected); + $this->db->columns = $restore; } /** diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index cb74f5687..865000320 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -2,8 +2,6 @@ /** * DboSourceTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/db_acl.test.php b/cake/tests/cases/libs/model/db_acl.test.php index ef9b9ee08..483428cfa 100644 --- a/cake/tests/cases/libs/model/db_acl.test.php +++ b/cake/tests/cases/libs/model/db_acl.test.php @@ -2,8 +2,6 @@ /** * DbAclTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index 6fe033259..f55a6ca0c 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -2,8 +2,6 @@ /** * ModelTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model_delete.test.php b/cake/tests/cases/libs/model/model_delete.test.php index 6702d1752..49f79f4c3 100644 --- a/cake/tests/cases/libs/model/model_delete.test.php +++ b/cake/tests/cases/libs/model/model_delete.test.php @@ -2,8 +2,6 @@ /** * ModelDeleteTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model_integration.test.php b/cake/tests/cases/libs/model/model_integration.test.php index 33d9e9ea6..1bf2d24bc 100644 --- a/cake/tests/cases/libs/model/model_integration.test.php +++ b/cake/tests/cases/libs/model/model_integration.test.php @@ -4,8 +4,6 @@ /** * ModelIntegrationTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model_read.test.php b/cake/tests/cases/libs/model/model_read.test.php index dd314ca48..86b855900 100644 --- a/cake/tests/cases/libs/model/model_read.test.php +++ b/cake/tests/cases/libs/model/model_read.test.php @@ -2,8 +2,6 @@ /** * ModelReadTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model_validation.test.php b/cake/tests/cases/libs/model/model_validation.test.php index a9a46b9d0..640b3b9a5 100644 --- a/cake/tests/cases/libs/model/model_validation.test.php +++ b/cake/tests/cases/libs/model/model_validation.test.php @@ -4,8 +4,6 @@ /** * ModelValidationTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/model/model_write.test.php b/cake/tests/cases/libs/model/model_write.test.php index dfea3324e..769a79f85 100644 --- a/cake/tests/cases/libs/model/model_write.test.php +++ b/cake/tests/cases/libs/model/model_write.test.php @@ -4,8 +4,6 @@ /** * ModelWriteTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -3106,6 +3104,19 @@ class ModelWriteTest extends BaseModelTest { 'attachment' => 'some_file.zip' ))); $this->assertEqual($result, $expected); + + + $model->Attachment->bindModel(array('belongsTo' => array('Comment')), false); + $data = array( + 'Comment' => array( + 'comment' => 'Comment with attachment', + 'article_id' => 1, + 'user_id' => 1 + ), + 'Attachment' => array( + 'attachment' => 'some_file.zip' + )); + $this->assertTrue($model->saveAll($data, array('validate' => 'first'))); } /** diff --git a/cake/tests/cases/libs/multibyte.test.php b/cake/tests/cases/libs/multibyte.test.php index b42a66bfc..a96133110 100644 --- a/cake/tests/cases/libs/multibyte.test.php +++ b/cake/tests/cases/libs/multibyte.test.php @@ -2,8 +2,6 @@ /** * MultibyteTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/object.test.php b/cake/tests/cases/libs/object.test.php index 1fc0c8335..e54ba9150 100644 --- a/cake/tests/cases/libs/object.test.php +++ b/cake/tests/cases/libs/object.test.php @@ -2,8 +2,6 @@ /** * ObjectTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/overloadable.test.php b/cake/tests/cases/libs/overloadable.test.php index 0f5cda85b..b85fba3c9 100644 --- a/cake/tests/cases/libs/overloadable.test.php +++ b/cake/tests/cases/libs/overloadable.test.php @@ -2,8 +2,6 @@ /** * OverloadableTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 40a8527f6..bfac8ccbd 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -2,8 +2,6 @@ /** * RouterTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -78,76 +76,6 @@ class RouterTest extends CakeTestCase { $this->assertPattern('/^http(s)?:\/\//', Router::url(null, true)); } -/** - * testRouteWriting method - * - * @access public - * @return void - */ - function testRouteWriting() { - Router::connect('/'); - Router::parse('/'); - $this->assertEqual($this->router->routes[0][0], '/'); - $this->assertEqual($this->router->routes[0][1], '/^[\/]*$/'); - $this->assertEqual($this->router->routes[0][2], array()); - - Router::reload(); - Router::connect('/', array('controller' => 'testing')); - Router::parse('/'); - $this->assertTrue(is_array($this->router->routes[0][3]) && !empty($this->router->routes[0][3])); - $this->assertEqual($this->router->routes[0][3]['controller'], 'testing'); - $this->assertEqual($this->router->routes[0][3]['action'], 'index'); - $this->assertEqual(count($this->router->routes[0][3]), 3); - - $this->router->routes = array(); - Router::connect('/:controller', array('controller' => 'testing2')); - Router::parse('/testing2'); - $this->assertTrue(is_array($this->router->routes[0][3]) && !empty($this->router->routes[0][3]), '/'); - $this->assertEqual($this->router->routes[0][3]['controller'], 'testing2'); - $this->assertEqual($this->router->routes[0][3]['action'], 'index'); - $this->assertEqual(count($this->router->routes[0][3]), 3); - - $this->router->routes = array(); - Router::connect('/:controller/:action', array('controller' => 'testing3')); - Router::parse('/testing3/index'); - $this->assertEqual($this->router->routes[0][0], '/:controller/:action'); - $this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?[\/]*$#'); - $this->assertEqual($this->router->routes[0][2], array('controller', 'action')); - $this->assertEqual($this->router->routes[0][3], array('controller' => 'testing3', 'action' => 'index', 'plugin' => null)); - - $this->router->routes = array(); - Router::connect('/:controller/:action/:id', array('controller' => 'testing4', 'id' => null), array('id' => $this->router->__named['ID'])); - Router::parse('/testing4/view/5'); - $this->assertEqual($this->router->routes[0][0], '/:controller/:action/:id'); - $this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+)?)?[\/]*$#'); - $this->assertEqual($this->router->routes[0][2], array('controller', 'action', 'id')); - - $this->router->routes = array(); - Router::connect('/:controller/:action/:id', array('controller' => 'testing4'), array('id' => $this->router->__named['ID'])); - Router::parse('/testing4/view/5'); - $this->assertEqual($this->router->routes[0][1], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+))[\/]*$#'); - - $this->router->routes = array(); - Router::connect('/posts/foo:id'); - Router::parse('/posts/foo5'); - $this->assertEqual($this->router->routes[0][2], array('id')); - $this->assertEqual($this->router->routes[0][1], '#^/posts(?:/foo([^\/]+))?[\/]*$#'); - - foreach (array(':', '@', ';', '$', '-') as $delim) { - $this->router->routes = array(); - Router::connect('/posts/:id'.$delim.':title'); - Router::parse('/posts/5' . $delim . 'foo'); - $this->assertEqual($this->router->routes[0][2], array('id', 'title')); - $this->assertEqual($this->router->routes[0][1], '#^/posts(?:/([^\/]+))?(?:'.preg_quote($delim, '#').'([^\/]+))?[\/]*$#'); - } - - $this->router->routes = array(); - Router::connect('/posts/:id::title/:year'); - Router::parse('/posts/5:foo:2007'); - $this->assertEqual($this->router->routes[0][2], array('id', 'title', 'year')); - $this->assertEqual($this->router->routes[0][1], '#^/posts(?:/([^\/]+))?(?:\\:([^\/]+))?(?:/([^\/]+))?[\/]*$#'); - } - /** * testRouteDefaultParams method * @@ -344,12 +272,12 @@ class RouterTest extends CakeTestCase { } /** - * testUrlGeneration method + * test generation of basic urls. * * @access public * @return void */ - function testUrlGeneration() { + function testUrlGenerationBasic() { extract(Router::getNamedExpressions()); Router::setRequestInfo(array( @@ -377,9 +305,9 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); Router::reload(); + Router::connect('/:plugin/:id/*', array('controller' => 'posts', 'action' => 'view'), array('id' => $ID)); Router::parse('/'); - Router::connect('/:plugin/:id/*', array('controller' => 'posts', 'action' => 'view'), array('id' => $ID)); $result = Router::url(array('plugin' => 'cake_plugin', 'controller' => 'posts', 'action' => 'view', 'id' => '1')); $expected = '/cake_plugin/1'; $this->assertEqual($result, $expected); @@ -389,17 +317,17 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); Router::reload(); + Router::connect('/:controller/:action/:id', array(), array('id' => $ID)); Router::parse('/'); - Router::connect('/:controller/:action/:id', array(), array('id' => $ID)); $result = Router::url(array('controller' => 'posts', 'action' => 'view', 'id' => '1')); $expected = '/posts/view/1'; $this->assertEqual($result, $expected); Router::reload(); + Router::connect('/:controller/:id', array('action' => 'view')); Router::parse('/'); - Router::connect('/:controller/:id', array('action' => 'view', 'id' => '1')); $result = Router::url(array('controller' => 'posts', 'action' => 'view', 'id' => '1')); $expected = '/posts/1'; $this->assertEqual($result, $expected); @@ -408,66 +336,12 @@ class RouterTest extends CakeTestCase { $expected = '/posts/index/0'; $this->assertEqual($result, $expected); - $result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => 'var=test&var2=test2')); - $expected = '/posts/index/0?var=test&var2=test2'; - $this->assertEqual($result, $expected); - - $result = Router::url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2')); - $this->assertEqual($result, $expected); - - $result = Router::url(array('controller' => 'posts', '0', '?' => array('var' => 'test', 'var2' => 'test2'))); - $this->assertEqual($result, $expected); - - $result = Router::url(array('controller' => 'posts', '0', '?' => array('var' => null))); - $this->assertEqual($result, '/posts/index/0'); - - $result = Router::url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2', '#' => 'unencoded string %')); - $expected = '/posts/index/0?var=test&var2=test2#unencoded+string+%25'; - $this->assertEqual($result, $expected); - - Router::connect('/view/*', array('controller' => 'posts', 'action' => 'view')); + Router::connect('/view/*', array('controller' => 'posts', 'action' => 'view')); Router::promote(); $result = Router::url(array('controller' => 'posts', 'action' => 'view', '1')); $expected = '/view/1'; $this->assertEqual($result, $expected); - Configure::write('Routing.admin', 'admin'); - Router::reload(); - Router::setRequestInfo(array( - array( - 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscriptions', - 'admin' => true, 'url' => array('url' => 'admin/subscriptions/index/page:2'), - ), - array( - 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/index/page:2', - 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), - ) - )); - Router::parse('/'); - - $result = Router::url(array('page' => 3)); - $expected = '/magazine/admin/subscriptions/index/page:3'; - $this->assertEqual($result, $expected); - - Configure::write('Routing.admin', 'admin'); - Router::reload(); - Router::connect('/admin/subscriptions/:action/*', array('controller' => 'subscribe', 'admin' => true, 'prefix' => 'admin')); - Router::setRequestInfo(array( - array( - 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscribe', - 'admin' => true, 'url' => array('url' => 'admin/subscriptions/edit/1') - ), - array( - 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/edit/1', - 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2), - ) - )); - Router::parse('/'); - - $result = Router::url(array('action' => 'edit', 1)); - $expected = '/magazine/admin/subscriptions/edit/1'; - $this->assertEqual($result, $expected); - Router::reload(); Router::setRequestInfo(array( array('pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'real_controller_name', 'url' => array('url' => '')), @@ -488,7 +362,83 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); Router::reload(); + Router::parse('/'); + Router::setRequestInfo(array( + array('pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')), + array( + 'base' => '/', 'here' => '/', + 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), + ) + )); + $result = Router::url(array('action' => 'login')); + $expected = '/users/login'; + $this->assertEqual($result, $expected); + + Router::reload(); + Router::connect('/page/*', array('plugin' => null, 'controller' => 'pages', 'action' => 'view')); + Router::parse('/'); + + $result = Router::url(array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'view', 'my-page')); + $expected = '/my_plugin/pages/view/my-page'; + $this->assertEqual($result, $expected); + + Router::reload(); + Router::connect('/contact/:action', array('plugin' => 'contact', 'controller' => 'contact')); + Router::parse('/'); + + $result = Router::url(array('plugin' => 'contact', 'controller' => 'contact', 'action' => 'me')); + + $expected = '/contact/me'; + $this->assertEqual($result, $expected); + + Router::reload(); + Router::setRequestInfo(array( + array( + 'pass' => array(), 'action' => 'index', 'plugin' => 'myplugin', 'controller' => 'mycontroller', + 'admin' => false, 'url' => array('url' => array()) + ), + array( + 'base' => '/', 'here' => '/', + 'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array(), + ) + )); + + $result = Router::url(array('plugin' => null, 'controller' => 'myothercontroller')); + $expected = '/myothercontroller'; + $this->assertEqual($result, $expected); + } + +/** + * Test generation of routes with query string parameters. + * + * @return void + **/ + function testUrlGenerationWithQueryStrings() { + $result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => 'var=test&var2=test2')); + $expected = '/posts/index/0?var=test&var2=test2'; + $this->assertEqual($result, $expected); + + $result = Router::url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2')); + $this->assertEqual($result, $expected); + + $result = Router::url(array('controller' => 'posts', '0', '?' => array('var' => 'test', 'var2' => 'test2'))); + $this->assertEqual($result, $expected); + + $result = Router::url(array('controller' => 'posts', '0', '?' => array('var' => null))); + $this->assertEqual($result, '/posts/index/0'); + + $result = Router::url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2', '#' => 'unencoded string %')); + $expected = '/posts/index/0?var=test&var2=test2#unencoded+string+%25'; + $this->assertEqual($result, $expected); + } + +/** + * test that regex validation of keyed route params is working. + * + * @return void + **/ + function testUrlGenerationWithRegexQualifiedParams() { Router::connect( ':language/galleries', array('controller' => 'galleries', 'action' => 'index'), @@ -519,7 +469,6 @@ class RouterTest extends CakeTestCase { array('controller' => 'pages', 'action' => 'index'), array('language' => '[a-z]{3}') ); - Router::connect('/:language/:controller/:action/*', array(), array('language' => '[a-z]{3}')); $result = Router::url(array('language' => 'eng', 'action' => 'index', 'controller' => 'pages')); @@ -534,64 +483,23 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); Router::reload(); - Router::parse('/'); - Router::setRequestInfo(array( - array('pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')), - array( - 'base' => '/', 'here' => '/', - 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), - ) - )); - - $result = Router::url(array('action' => 'login')); - $expected = '/users/login'; - $this->assertEqual($result, $expected); - - Router::reload(); - Router::parse('/'); - Router::connect('/page/*', array('plugin' => null, 'controller' => 'pages', 'action' => 'view')); - - $result = Router::url(array('plugin' => 'my_plugin', 'controller' => 'pages', 'action' => 'view', 'my-page')); - $expected = '/my_plugin/pages/view/my-page'; - $this->assertEqual($result, $expected); - - Router::reload(); - Router::parse('/'); Router::connect('/forestillinger/:month/:year/*', array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar'), array('month' => '0[1-9]|1[012]', 'year' => '[12][0-9]{3}') ); + Router::parse('/'); $result = Router::url(array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar', 'month' => 10, 'year' => 2007, 'min-forestilling')); $expected = '/forestillinger/10/2007/min-forestilling'; $this->assertEqual($result, $expected); Router::reload(); - Router::parse('/'); - - Router::connect('/contact/:action', array('plugin' => 'contact', 'controller' => 'contact')); - $result = Router::url(array('plugin' => 'contact', 'controller' => 'contact', 'action' => 'me')); - - $expected = '/contact/me'; - $this->assertEqual($result, $expected); - - Configure::write('Routing.admin', 'admin'); - Router::reload(); - Router::parse('/'); - - $result = Router::url(array('admin' => true, 'controller' => 'users', 'action' => 'login')); - $expected = '/admin/users/login'; - $this->assertEqual($result, $expected); - - Router::reload(); - Router::parse('/'); - Router::connect('/kalender/:month/:year/*', array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar'), array('month' => '0[1-9]|1[012]', 'year' => '[12][0-9]{3}') ); - Router::connect('/kalender/*', array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar')); + Router::parse('/'); $result = Router::url(array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar', 'min-forestilling')); $expected = '/kalender/min-forestilling'; @@ -600,139 +508,15 @@ class RouterTest extends CakeTestCase { $result = Router::url(array('plugin' => 'shows', 'controller' => 'shows', 'action' => 'calendar', 'year' => 2007, 'month' => 10, 'min-forestilling')); $expected = '/kalender/10/2007/min-forestilling'; $this->assertEqual($result, $expected); - - Configure::write('Routing.admin', 'admin'); - Router::reload(); - - Router::setRequestInfo(array( - array('pass' => array(), 'admin' => true, 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')), - array( - 'base' => '/', 'here' => '/', - 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), - ) - )); - - Router::connect('/page/*', array('controller' => 'pages', 'action' => 'view', 'admin' => true, 'prefix' => 'admin')); - Router::parse('/'); - - $result = Router::url(array('admin' => true, 'controller' => 'pages', 'action' => 'view', 'my-page')); - $expected = '/page/my-page'; - $this->assertEqual($result, $expected); - - Router::reload(); - - Router::setRequestInfo(array( - array( - 'pass' => array(), 'action' => 'index', 'plugin' => 'myplugin', 'controller' => 'mycontroller', - 'admin' => false, 'url' => array('url' => array()) - ), - array( - 'base' => '/', 'here' => '/', - 'webroot' => '/', 'passedArgs' => array(), 'namedArgs' => array(), - ) - )); - - $result = Router::url(array('plugin' => null, 'controller' => 'myothercontroller')); - $expected = '/myothercontroller/'; - $this->assertEqual($result, $expected); - - Configure::write('Routing.admin', 'admin'); - Router::reload(); - - Router::setRequestInfo(array( - array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')), - array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') - )); - Router::parse('/'); - - $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'add', 'id' => false)); - $expected = '/admin/pages/add'; - $this->assertEqual($result, $expected); - - Router::reload(); - - Router::setRequestInfo(array( - array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')), - array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') - )); - - Router::connect('/admin/:controller/:action/:id', array('admin' => true), array('id' => '[0-9]+')); - Router::parse('/'); - - $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'edit', 'id' => '284')); - $expected = '/admin/pages/edit/284'; - $this->assertEqual($result, $expected); - - Configure::write('Routing.admin', 'admin'); - Router::reload(); - Router::setRequestInfo(array( - array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')), - array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') - )); - - Router::parse('/'); - - $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'add', 'id' => false)); - $expected = '/admin/pages/add'; - $this->assertEqual($result, $expected); - - - Router::reload(); - Router::setRequestInfo(array( - array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')), - array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') - )); - - Router::parse('/'); - - $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'edit', 284)); - $expected = '/admin/pages/edit/284'; - $this->assertEqual($result, $expected); - - Router::reload(); - Router::setRequestInfo(array( - array( - 'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', - 'pass' => array('6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), - 'url' => array('url' => 'admin/shows/show_tickets/edit/6') - ), - array( - 'plugin' => null, 'controller' => null, 'action' => null, 'base' => '', - 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/' - ) - )); - - Router::parse('/'); - - $result = Router::url(array( - 'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 6, - 'admin' => true, 'prefix' => 'admin' - )); - $expected = '/admin/shows/show_tickets/edit/6'; - $this->assertEqual($result, $expected); - - Router::reload(); - - Router::setRequestInfo(array( - array('pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'posts', 'prefix' => 'admin', 'admin' => true, 'url' => array('url' => 'admin/posts')), - array('base' => '', 'here' => '/admin/posts', 'webroot' => '/') - )); - - Router::connect('/admin/posts/*', array('controller' => 'posts', 'action' => 'index', 'admin' => true)); - Router::parse('/'); - - $result = Router::url(array('all')); - $expected = '/admin/posts/all'; - $this->assertEqual($result, $expected); } /** - * testUrlGenerationWithPrefix method + * Test url generation with an admin prefix * * @access public * @return void */ - function testUrlGenerationWithPrefix() { + function testUrlGenerationWithAdminPrefix() { Configure::write('Routing.admin', 'admin'); Router::reload(); @@ -752,6 +536,135 @@ class RouterTest extends CakeTestCase { $result = Router::url(array('page' => 2)); $expected = '/admin/registrations/index/page:2'; $this->assertEqual($result, $expected); + + Router::reload(); + Router::setRequestInfo(array( + array( + 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscriptions', + 'admin' => true, 'url' => array('url' => 'admin/subscriptions/index/page:2'), + ), + array( + 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/index/page:2', + 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), + ) + )); + Router::parse('/'); + + $result = Router::url(array('page' => 3)); + $expected = '/magazine/admin/subscriptions/index/page:3'; + $this->assertEqual($result, $expected); + + Router::reload(); + Router::connect('/admin/subscriptions/:action/*', array('controller' => 'subscribe', 'admin' => true, 'prefix' => 'admin')); + Router::parse('/'); + Router::setRequestInfo(array( + array( + 'pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'subscribe', + 'admin' => true, 'url' => array('url' => 'admin/subscriptions/edit/1') + ), + array( + 'base' => '/magazine', 'here' => '/magazine/admin/subscriptions/edit/1', + 'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2), + ) + )); + + $result = Router::url(array('action' => 'edit', 1)); + $expected = '/magazine/admin/subscriptions/edit/1'; + $this->assertEqual($result, $expected); + + $result = Router::url(array('admin' => true, 'controller' => 'users', 'action' => 'login')); + $expected = '/magazine/admin/users/login'; + $this->assertEqual($result, $expected); + + + Router::reload(); + Router::setRequestInfo(array( + array('pass' => array(), 'admin' => true, 'action' => 'index', 'plugin' => null, 'controller' => 'users', 'url' => array('url' => 'users')), + array( + 'base' => '/', 'here' => '/', + 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array(), + ) + )); + Router::connect('/page/*', array('controller' => 'pages', 'action' => 'view', 'admin' => true, 'prefix' => 'admin')); + Router::parse('/'); + + $result = Router::url(array('admin' => true, 'controller' => 'pages', 'action' => 'view', 'my-page')); + $expected = '/page/my-page'; + $this->assertEqual($result, $expected); + + Configure::write('Routing.admin', 'admin'); + Router::reload(); + + Router::setRequestInfo(array( + array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')), + array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') + )); + Router::parse('/'); + + $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'add', 'id' => false)); + $expected = '/admin/pages/add'; + $this->assertEqual($result, $expected); + + + Router::reload(); + Router::parse('/'); + Router::setRequestInfo(array( + array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')), + array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') + )); + + $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'add', 'id' => false)); + $expected = '/admin/pages/add'; + $this->assertEqual($result, $expected); + + Router::reload(); + Router::connect('/admin/:controller/:action/:id', array('admin' => true), array('id' => '[0-9]+')); + Router::parse('/'); + Router::setRequestInfo(array( + array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')), + array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') + )); + + $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'edit', 'id' => '284')); + $expected = '/admin/pages/edit/284'; + $this->assertEqual($result, $expected); + + + Router::reload(); + Router::parse('/'); + Router::setRequestInfo(array( + array ('plugin' => null, 'controller' => 'pages', 'action' => 'admin_add', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/add')), + array ('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/add', 'webroot' => '/') + )); + + $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'add', 'id' => false)); + $expected = '/admin/pages/add'; + $this->assertEqual($result, $expected); + + + Router::reload(); + Router::parse('/'); + Router::setRequestInfo(array( + array('plugin' => null, 'controller' => 'pages', 'action' => 'admin_edit', 'pass' => array('284'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/pages/edit/284')), + array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/admin/pages/edit/284', 'webroot' => '/') + )); + + $result = Router::url(array('plugin' => null, 'controller' => 'pages', 'action' => 'edit', 284)); + $expected = '/admin/pages/edit/284'; + $this->assertEqual($result, $expected); + + + Router::reload(); + Router::connect('/admin/posts/*', array('controller' => 'posts', 'action' => 'index', 'admin' => true)); + Router::parse('/'); + Router::setRequestInfo(array( + array('pass' => array(), 'action' => 'admin_index', 'plugin' => null, 'controller' => 'posts', 'prefix' => 'admin', 'admin' => true, 'url' => array('url' => 'admin/posts')), + array('base' => '', 'here' => '/admin/posts', 'webroot' => '/') + )); + + $result = Router::url(array('all')); + $expected = '/admin/posts/all'; + $this->assertEqual($result, $expected); } /** @@ -785,7 +698,7 @@ class RouterTest extends CakeTestCase { * @access public * @return void */ - function testPluginUrlGeneration() { + function testUrlGenerationPlugins() { Router::setRequestInfo(array( array( 'controller' => 'controller', 'action' => 'index', 'form' => array(), @@ -800,17 +713,17 @@ class RouterTest extends CakeTestCase { $this->assertEqual(Router::url('read/1'), '/base/test/controller/read/1'); Router::reload(); - - Router::connect('/:lang/:plugin/:controller/*', array(), array('action' => 'index')); + Router::connect('/:lang/:plugin/:controller/*', array('action' => 'index')); Router::setRequestInfo(array( - array( - 'lang' => 'en', - 'plugin' => 'shows', 'controller' => 'shows', 'action' => 'index', 'pass' => - array(), 'form' => array(), 'url' => - array('url' => 'en/shows/')), - array('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', - 'here' => '/en/shows/', 'webroot' => '/'))); + array( + 'lang' => 'en', + 'plugin' => 'shows', 'controller' => 'shows', 'action' => 'index', 'pass' => + array(), 'form' => array(), 'url' => + array('url' => 'en/shows/')), + array('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', + 'here' => '/en/shows/', 'webroot' => '/') + )); Router::parse('/en/shows/'); @@ -822,6 +735,48 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); } +/** + * test that you can leave active plugin routes with plugin = null + * + * @return void + */ + function testCanLeavePlugin() { + Router::reload(); + Router::connect( + '/admin/other/:controller/:action/*', + array( + 'admin' => 1, + 'plugin' => 'aliased', + 'prefix' => 'admin' + ) + ); + Router::setRequestInfo(array( + array( + 'pass' => array(), + 'admin' => true, + 'prefix' => 'admin', + 'plugin' => 'this', + 'action' => 'admin_index', + 'controller' => 'interesting', + 'url' => array('url' => 'admin/this/interesting/index'), + ), + array( + 'base' => '', + 'here' => '/admin/this/interesting/index', + 'webroot' => '/', + 'passedArgs' => array(), + ) + )); + $result = Router::url(array('plugin' => null, 'controller' => 'posts', 'action' => 'index')); + $this->assertEqual($result, '/admin/posts'); + + $result = Router::url(array('controller' => 'posts', 'action' => 'index')); + $this->assertEqual($result, '/admin/this/posts'); + + $result = Router::url(array('plugin' => 'aliased', 'controller' => 'posts', 'action' => 'index')); + $this->assertEqual($result, '/admin/other/posts/index'); + } + /** * testUrlParsing method * @@ -849,7 +804,7 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); $this->router->routes = array(); - Router::connect('/posts/:month/:day/:year//*', array('controller' => 'posts', 'action' => 'view'), array('year' => $Year, 'month' => $Month, 'day' => $Day)); + Router::connect('/posts/:month/:day/:year/*', array('controller' => 'posts', 'action' => 'view'), array('year' => $Year, 'month' => $Month, 'day' => $Day)); $result = Router::parse('/posts/08/01/2007/title-of-post-here'); $expected = array('month' => '08', 'day' => '01', 'year' => '2007', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array('0' => 'title-of-post-here'), 'named' => array()); $this->assertEqual($result, $expected); @@ -893,7 +848,7 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); Router::reload(); - Router::connect('/:controller/:action/*', array(), array('controller' => 'some_controller')); + Router::connect('/:controller/:action/*'); Router::connect('/', array('plugin' => 'pages', 'controller' => 'pages', 'action' => 'display')); $result = Router::parse('/'); $expected = array('pass' => array(), 'named' => array(), 'controller' => 'pages', 'action' => 'display', 'plugin' => 'pages'); @@ -938,13 +893,29 @@ class RouterTest extends CakeTestCase { $result = Router::parse('/posts/view/foo:bar/routing:fun/answer:42'); $expected = array('pass' => array(), 'named' => array('foo' => 'bar', 'routing' => 'fun', 'answer' => '42'), 'plugin' => null, 'controller' => 'posts', 'action' => 'view'); $this->assertEqual($result, $expected); + } +/** + * test that the persist key works. + * + * @return void + */ + function testPersistentParameters() { Router::reload(); - Router::connect('/:lang/:color/posts/view/*', array('controller' => 'posts', 'action' => 'view'), array('persist' => array('lang', 'color'))); - Router::connect('/:lang/:color/posts/index', array('controller' => 'posts', 'action' => 'index'), array('persist' => array('lang'))); - Router::connect('/:lang/:color/posts/edit/*', array('controller' => 'posts', 'action' => 'index')); + Router::connect( + '/:lang/:color/posts/view/*', + array('controller' => 'posts', 'action' => 'view'), + array('persist' => array('lang', 'color') + )); + Router::connect( + '/:lang/:color/posts/index', + array('controller' => 'posts', 'action' => 'index'), + array('persist' => array('lang') + )); + Router::connect('/:lang/:color/posts/edit/*', array('controller' => 'posts', 'action' => 'edit')); Router::connect('/about', array('controller' => 'pages', 'action' => 'view', 'about')); Router::parse('/en/red/posts/view/5'); + Router::setRequestInfo(array( array('controller' => 'posts', 'action' => 'view', 'lang' => 'en', 'color' => 'red', 'form' => array(), 'url' => array(), 'plugin' => null), array('base' => '/', 'here' => '/en/red/posts/view/5', 'webroot' => '/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array()) @@ -957,6 +928,10 @@ class RouterTest extends CakeTestCase { $result = Router::url(array('controller' => 'posts', 'action' => 'index', 'color' => 'blue')); $this->assertEqual($result, $expected); + $expected = '/posts/edit/6'; + $result = Router::url(array('controller' => 'posts', 'action' => 'edit', 6, 'color' => null, 'lang' => null)); + $this->assertEqual($result, $expected); + $expected = '/posts'; $result = Router::url(array('controller' => 'posts', 'action' => 'index')); $this->assertEqual($result, $expected); @@ -1005,11 +980,10 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); $result = Router::parse('/page/this_is_the_slug'); - $expected = array( 'pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'view', 'slug' => 'this_is_the_slug', 'extra' => null); + $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'view', 'slug' => 'this_is_the_slug', 'extra' => null); $this->assertEqual($result, $expected); Router::reload(); - Router::connect( "/:extra/page/:slug/*", array('controller' => 'pages', 'action' => 'view', 'extra' => null), @@ -1134,7 +1108,7 @@ class RouterTest extends CakeTestCase { Router::reload(); Router::setRequestInfo(array( array('admin' => true, 'controller' => 'controller', 'action' => 'action', - 'form' => array(), 'url' => array(), 'plugin' => null), + 'form' => array(), 'url' => array(), 'plugin' => null, 'prefix' => 'admin'), array('base' => '/', 'here' => '/', 'webroot' => '/base/', 'passedArgs' => array(), 'argSeparator' => ':', 'namedArgs' => array()) )); @@ -1144,6 +1118,27 @@ class RouterTest extends CakeTestCase { $expected = '/admin/test_plugin'; $this->assertEqual($result, $expected); + Router::reload(); + Router::parse('/'); + Router::setRequestInfo(array( + array( + 'plugin' => 'test_plugin', 'controller' => 'show_tickets', 'action' => 'admin_edit', + 'pass' => array('6'), 'prefix' => 'admin', 'admin' => true, 'form' => array(), + 'url' => array('url' => 'admin/shows/show_tickets/edit/6') + ), + array( + 'plugin' => null, 'controller' => null, 'action' => null, 'base' => '', + 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/' + ) + )); + + $result = Router::url(array( + 'plugin' => 'test_plugin', 'controller' => 'show_tickets', 'action' => 'edit', 6, + 'admin' => true, 'prefix' => 'admin' + )); + $expected = '/admin/test_plugin/show_tickets/edit/6'; + $this->assertEqual($result, $expected); + App::build(array('plugins' => $paths)); } @@ -1403,10 +1398,8 @@ class RouterTest extends CakeTestCase { function testUrlGenerationWithLegacyPrefixes() { Router::reload(); Router::connect('/protected/:controller/:action/*', array( - 'controller' => 'users', - 'action' => 'index', - 'prefix' => 'protected', - 'protected' => true + 'prefix' => 'protected', + 'protected' => true )); Router::parse('/'); @@ -1415,6 +1408,10 @@ class RouterTest extends CakeTestCase { array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/images/index', 'webroot' => '/') )); + $result = Router::url(array('protected' => true)); + $expected = '/protected/images/index'; + $this->assertEqual($result, $expected); + $result = Router::url(array('controller' => 'images', 'action' => 'add')); $expected = '/images/add'; $this->assertEqual($result, $expected); @@ -1540,7 +1537,7 @@ class RouterTest extends CakeTestCase { /** * test that setting a prefix override the current one - * + * * @return void */ function testPrefixOverride() { @@ -1556,7 +1553,7 @@ class RouterTest extends CakeTestCase { $result = Router::url(array('controller' => 'images', 'action' => 'add', 'admin' => true)); $expected = '/admin/images/add'; $this->assertEqual($result, $expected); - + Router::setRequestInfo(array( array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'prefix' => 'admin', 'admin' => true, 'form' => array(), 'url' => array('url' => 'admin/images/index')), array('base' => '', 'here' => '/admin/images/index', 'webroot' => '/') @@ -1579,11 +1576,11 @@ class RouterTest extends CakeTestCase { )); $result = Router::url(array('controller' => 'my_controller', 'action' => 'my_action')); - $expected = '/base/my_controller/my_action/'; + $expected = '/base/my_controller/my_action'; $this->assertEqual($result, $expected); $result = Router::url(array('controller' => 'my_controller', 'action' => 'my_action', 'base' => false)); - $expected = '/my_controller/my_action/'; + $expected = '/my_controller/my_action'; $this->assertEqual($result, $expected); $result = Router::url(array('controller' => 'my_controller', 'action' => 'my_action', 'base' => true)); @@ -1591,35 +1588,6 @@ class RouterTest extends CakeTestCase { $this->assertEqual($result, $expected); } -/** - * testParamsUrlParsing method - * - * @access public - * @return void - */ - function testParamsUrlParsing() { - Router::connect('/', array('controller' => 'posts', 'action' => 'index')); - Router::connect('/view/:user/*', array('controller' => 'posts', 'action' => 'view'), array('user')); - $result = Router::parse('/view/gwoo/'); - $expected = array('user' => 'gwoo', 'controller' => 'posts', 'action' => 'view', 'plugin' =>'', 'pass' => array(), 'named' => array()); - $this->assertEqual($result, $expected); - - Router::reload(); - Router::connect('/([0-9]+)-p-(.*)/', array('controller' => 'products', 'action' => 'show')); - Router::connect('/(.*)-q-(.*)/', array('controller' => 'products', 'action' => 'show')); - $result = Router::parse('/100-p-500/'); - $expected = array('pass' => array('100', '500'), 'named' => array(), 'controller' => 'products', 'action' => 'show', 'plugin' => null); - $this->assertEqual($result, $expected); - - $result = Router::parse('/bob-q-500/'); - $expected = array('pass' => array('bob', '500'), 'named' => array(), 'controller' => 'products', 'action' => 'show', 'plugin' => null); - $this->assertEqual($result, $expected); - - $result = Router::parse('/bob-p-500/'); - $expected = array('pass' => array(), 'named' => array(), 'controller' => 'bob-p-500', 'plugin' => null, 'action' => 'index'); - $this->assertEqual($result, $expected); - } - /** * testPagesUrlParsing method * @@ -1631,7 +1599,7 @@ class RouterTest extends CakeTestCase { Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); $result = Router::parse('/'); - $expected = array('pass'=>array('home'), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); + $expected = array('pass'=> array('home'), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); $this->assertEqual($result, $expected); $result = Router::parse('/pages/home/'); @@ -1647,18 +1615,9 @@ class RouterTest extends CakeTestCase { Router::reload(); Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); - Router::connect('/pages/*/:event', array('controller' => 'pages', 'action' => 'display'), array('event' => '[a-z0-9_-]+')); $result = Router::parse('/'); - $expected = array('pass'=>array('home'), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); - $this->assertEqual($result, $expected); - - $result = Router::parse('/pages/home'); - $expected = array('pass' => array('home'), 'named' => array(), 'event' => '', 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); - $this->assertEqual($result, $expected); - - $result = Router::parse('/pages/home/'); - $expected = array('pass' => array('home'), 'named' => array(), 'event' => '', 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); + $expected = array('pass' => array('home'), 'named' => array(), 'plugin' => null, 'controller' => 'pages', 'action' => 'display'); $this->assertEqual($result, $expected); $result = Router::parse('/pages/display/home/event:value'); @@ -1774,6 +1733,7 @@ class RouterTest extends CakeTestCase { * @return void */ function testPassedArgsOrder() { + Router::connect('/test-passed/*', array('controller' => 'pages', 'action' => 'display', 'home')); Router::connect('/test2/*', array('controller' => 'pages', 'action' => 'display', 2)); Router::connect('/test/*', array('controller' => 'pages', 'action' => 'display', 1)); Router::parse('/'); @@ -1786,18 +1746,22 @@ class RouterTest extends CakeTestCase { $expected = '/test2/whatever'; $this->assertEqual($result, $expected); - Configure::write('Routing.admin', 'admin'); + $result = Router::url(array('controller' => 'pages', 'action' => 'display', 'home', 'whatever')); + $expected = '/test-passed/whatever'; + $this->assertEqual($result, $expected); + + Configure::write('Routing.prefixes', array('admin')); Router::reload(); Router::setRequestInfo(array( - array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'named' => array(), 'prefix' => 'protected', 'admin' => false, 'form' => array(), 'url' => array ('url' => 'protected/images/index')), + array('plugin' => null, 'controller' => 'images', 'action' => 'index', 'pass' => array(), 'named' => array(), 'prefix' => 'protected', 'protected' => true, 'form' => array(), 'url' => array ('url' => 'protected/images/index')), array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '', 'here' => '/protected/images/index', 'webroot' => '/') )); Router::connect('/protected/:controller/:action/*', array( - 'controller' => 'users', - 'action' => 'index', - 'prefix' => 'protected' + 'controller' => 'users', + 'action' => 'index', + 'prefix' => 'protected' )); Router::parse('/'); @@ -1840,7 +1804,7 @@ class RouterTest extends CakeTestCase { )); $result = Router::url(array('action' => 'test_another_action')); - $expected = '/test/test_another_action/'; + $expected = '/test/test_another_action'; $this->assertEqual($result, $expected); $result = Router::url(array('action' => 'test_another_action', 'locale' => 'eng')); @@ -1871,7 +1835,7 @@ class RouterTest extends CakeTestCase { * testCurentRoute * * This test needs some improvement and actual requestAction() usage - * + * * @return void * @access public */ @@ -1879,8 +1843,8 @@ class RouterTest extends CakeTestCase { $url = array('controller' => 'pages', 'action' => 'display', 'government'); Router::connect('/government', $url); Router::parse('/government'); - $route = Router::currentRoute(); - $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]); + $route =& Router::currentRoute(); + $this->assertEqual(array_merge($url, array('plugin' => false)), $route->defaults); } /** * testRequestRoute @@ -1892,22 +1856,22 @@ class RouterTest extends CakeTestCase { $url = array('controller' => 'products', 'action' => 'display', 5); Router::connect('/government', $url); Router::parse('/government'); - $route = Router::requestRoute(); - $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]); + $route =& Router::requestRoute(); + $this->assertEqual(array_merge($url, array('plugin' => false)), $route->defaults); // test that the first route is matched $newUrl = array('controller' => 'products', 'action' => 'display', 6); Router::connect('/government', $url); Router::parse('/government'); - $route = Router::requestRoute(); - $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]); + $route =& Router::requestRoute(); + $this->assertEqual(array_merge($url, array('plugin' => false)), $route->defaults); // test that an unmatched route does not change the current route $newUrl = array('controller' => 'products', 'action' => 'display', 6); Router::connect('/actor', $url); Router::parse('/government'); - $route = Router::requestRoute(); - $this->assertEqual(array_merge($url, array('plugin' => false)), $route[3]); + $route =& Router::requestRoute(); + $this->assertEqual(array_merge($url, array('plugin' => false)), $route->defaults); } /** * testGetParams @@ -1936,5 +1900,391 @@ class RouterTest extends CakeTestCase { $this->assertEqual(Router::getparams(), $expected); $this->assertEqual(Router::getparams(true), $expected); } + +/** + * test that connectDefaults() can disable default route connection + * + * @return void + */ + function testDefaultsMethod() { + Router::defaults(false); + Router::connect('/test/*', array('controller' => 'pages', 'action' => 'display', 2)); + $result = Router::parse('/posts/edit/5'); + $this->assertFalse(isset($result['controller'])); + $this->assertFalse(isset($result['action'])); + } + +/** + * test using a custom route class for route connection + * + * @return void + */ + function testUsingCustomRouteClass() { + Mock::generate('CakeRoute', 'MockConnectedRoute'); + $routes = Router::connect( + '/:slug', + array('controller' => 'posts', 'action' => 'view'), + array('routeClass' => 'MockConnectedRoute', 'slug' => '[a-z_-]+') + ); + $this->assertTrue(is_a($routes[0], 'MockConnectedRoute'), 'Incorrect class used. %s'); + $expected = array('controller' => 'posts', 'action' => 'view', 'slug' => 'test'); + $routes[0]->setReturnValue('parse', $expected); + $result = Router::parse('/test'); + $this->assertEqual($result, $expected); + } } + +/** + * Test case for CakeRoute + * + * @package cake.tests.cases.libs. + **/ +class CakeRouteTestCase extends CakeTestCase { +/** + * startTest method + * + * @access public + * @return void + */ + function startTest() { + $this->_routing = Configure::read('Routing'); + Configure::write('Routing', array('admin' => null, 'prefixes' => array())); + Router::reload(); + } + +/** + * end the test and reset the environment + * + * @return void + **/ + function endTest() { + Configure::write('Routing', $this->_routing); + } + +/** + * Test the construction of a CakeRoute + * + * @return void + **/ + function testConstruction() { + $route =& new CakeRoute('/:controller/:action/:id', array(), array('id' => '[0-9]+')); + + $this->assertEqual($route->template, '/:controller/:action/:id'); + $this->assertEqual($route->defaults, array()); + $this->assertEqual($route->options, array('id' => '[0-9]+')); + $this->assertFalse($route->compiled()); + } + +/** + * test Route compiling. + * + * @return void + **/ + function testBasicRouteCompiling() { + $route =& new CakeRoute('/', array('controller' => 'pages', 'action' => 'display', 'home')); + $result = $route->compile(); + $expected = '#^/*$#'; + $this->assertEqual($result, $expected); + $this->assertEqual($route->keys, array()); + + $route =& new CakeRoute('/:controller/:action', array('controller' => 'posts')); + $result = $route->compile(); + + $this->assertPattern($result, '/posts/edit'); + $this->assertPattern($result, '/posts/super_delete'); + $this->assertNoPattern($result, '/posts'); + $this->assertNoPattern($result, '/posts/super_delete/1'); + + $route =& new CakeRoute('/posts/foo:id', array('controller' => 'posts', 'action' => 'view')); + $result = $route->compile(); + + $this->assertPattern($result, '/posts/foo:1'); + $this->assertPattern($result, '/posts/foo:param'); + $this->assertNoPattern($result, '/posts'); + $this->assertNoPattern($result, '/posts/'); + + $this->assertEqual($route->keys, array('id')); + + $route =& new CakeRoute('/:plugin/:controller/:action/*', array('plugin' => 'test_plugin', 'action' => 'index')); + $result = $route->compile(); + $this->assertPattern($result, '/test_plugin/posts/index'); + $this->assertPattern($result, '/test_plugin/posts/edit/5'); + $this->assertPattern($result, '/test_plugin/posts/edit/5/name:value/nick:name'); + } + +/** + * test compiling routes with keys that have patterns + * + * @return void + **/ + function testRouteCompilingWithParamPatterns() { + extract(Router::getNamedExpressions()); + + $route = new CakeRoute( + '/:controller/:action/:id', + array(), + array('id' => $ID) + ); + $result = $route->compile(); + $this->assertPattern($result, '/posts/edit/1'); + $this->assertPattern($result, '/posts/view/518098'); + $this->assertNoPattern($result, '/posts/edit/name-of-post'); + $this->assertNoPattern($result, '/posts/edit/4/other:param'); + $this->assertEqual($route->keys, array('controller', 'action', 'id')); + + $route =& new CakeRoute( + '/:lang/:controller/:action/:id', + array('controller' => 'testing4'), + array('id' => $ID, 'lang' => '[a-z]{3}') + ); + $result = $route->compile(); + $this->assertPattern($result, '/eng/posts/edit/1'); + $this->assertPattern($result, '/cze/articles/view/1'); + $this->assertNoPattern($result, '/language/articles/view/2'); + $this->assertNoPattern($result, '/eng/articles/view/name-of-article'); + $this->assertEqual($route->keys, array('lang', 'controller', 'action', 'id')); + + foreach (array(':', '@', ';', '$', '-') as $delim) { + $route =& new CakeRoute('/posts/:id' . $delim . ':title'); + $result = $route->compile(); + + $this->assertPattern($result, '/posts/1' . $delim . 'name-of-article'); + $this->assertPattern($result, '/posts/13244' . $delim . 'name-of_Article[]'); + $this->assertNoPattern($result, '/posts/11!nameofarticle'); + $this->assertNoPattern($result, '/posts/11'); + + $this->assertEqual($route->keys, array('id', 'title')); + } + + $route =& new CakeRoute( + '/posts/:id::title/:year', + array('controller' => 'posts', 'action' => 'view'), + array('id' => $ID, 'year' => $Year, 'title' => '[a-z-_]+') + ); + $result = $route->compile(); + $this->assertPattern($result, '/posts/1:name-of-article/2009/'); + $this->assertPattern($result, '/posts/13244:name-of-article/1999'); + $this->assertNoPattern($result, '/posts/hey_now:nameofarticle'); + $this->assertNoPattern($result, '/posts/:nameofarticle/2009'); + $this->assertNoPattern($result, '/posts/:nameofarticle/01'); + $this->assertEqual($route->keys, array('id', 'title', 'year')); + + $route =& new CakeRoute( + '/posts/:url_title-(uuid::id)', + array('controller' => 'posts', 'action' => 'view'), + array('pass' => array('id', 'url_title'), 'id' => $ID) + ); + $result = $route->compile(); + $this->assertPattern($result, '/posts/some_title_for_article-(uuid:12534)/'); + $this->assertPattern($result, '/posts/some_title_for_article-(uuid:12534)'); + $this->assertNoPattern($result, '/posts/'); + $this->assertNoPattern($result, '/posts/nameofarticle'); + $this->assertNoPattern($result, '/posts/nameofarticle-12347'); + $this->assertEqual($route->keys, array('url_title', 'id')); + } + +/** + * test more complex route compiling & parsing with mid route greedy stars + * and optional routing parameters + * + * @return void + */ + function testComplexRouteCompilingAndParsing() { + extract(Router::getNamedExpressions()); + + $route =& new CakeRoute( + '/posts/:month/:day/:year/*', + array('controller' => 'posts', 'action' => 'view'), + array('year' => $Year, 'month' => $Month, 'day' => $Day) + ); + $result = $route->compile(); + $this->assertPattern($result, '/posts/08/01/2007/title-of-post'); + $result = $route->parse('/posts/08/01/2007/title-of-post'); + + $this->assertEqual(count($result), 8); + $this->assertEqual($result['controller'], 'posts'); + $this->assertEqual($result['action'], 'view'); + $this->assertEqual($result['year'], '2007'); + $this->assertEqual($result['month'], '08'); + $this->assertEqual($result['day'], '01'); + + $route =& new CakeRoute( + "/:extra/page/:slug/*", + array('controller' => 'pages', 'action' => 'view', 'extra' => null), + array("extra" => '[a-z1-9_]*', "slug" => '[a-z1-9_]+', "action" => 'view') + ); + $result = $route->compile(); + + $this->assertPattern($result, '/some_extra/page/this_is_the_slug'); + $this->assertPattern($result, '/page/this_is_the_slug'); + $this->assertEqual($route->keys, array('extra', 'slug')); + $this->assertEqual($route->options, array('extra' => '[a-z1-9_]*', 'slug' => '[a-z1-9_]+', 'action' => 'view')); + $expected = array( + 'controller' => 'pages', + 'action' => 'view', + 'extra' => null, + ); + $this->assertEqual($route->defaults, $expected); + } + +/** + * test that routes match their pattern. + * + * @return void + **/ + function testMatchBasic() { + $route = new CakeRoute('/:controller/:action/:id', array('plugin' => null)); + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null)); + $this->assertFalse($result); + + $result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 0)); + $this->assertFalse($result); + + $result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 1)); + $this->assertEqual($result, '/posts/view/1'); + + $route =& new CakeRoute('/', array('controller' => 'pages', 'action' => 'display', 'home')); + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'home')); + $this->assertEqual($result, '/'); + + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about')); + $this->assertFalse($result); + + + $route =& new CakeRoute('/pages/*', array('controller' => 'pages', 'action' => 'display')); + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'home')); + $this->assertEqual($result, '/pages/home'); + + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 'about')); + $this->assertEqual($result, '/pages/about'); + + + $route =& new CakeRoute('/blog/:action', array('controller' => 'posts')); + $result = $route->match(array('controller' => 'posts', 'action' => 'view')); + $this->assertEqual($result, '/blog/view'); + + $result = $route->match(array('controller' => 'nodes', 'action' => 'view')); + $this->assertFalse($result); + + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 1)); + $this->assertFalse($result); + + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'id' => 2)); + $this->assertFalse($result); + + + $route =& new CakeRoute('/foo/:controller/:action', array('action' => 'index')); + $result = $route->match(array('controller' => 'posts', 'action' => 'view')); + $this->assertEqual($result, '/foo/posts/view'); + + + $route =& new CakeRoute('/:plugin/:id/*', array('controller' => 'posts', 'action' => 'view')); + $result = $route->match(array('plugin' => 'test', 'controller' => 'posts', 'action' => 'view', 'id' => '1')); + $this->assertEqual($result, '/test/1/'); + + $result = $route->match(array('plugin' => 'fo', 'controller' => 'posts', 'action' => 'view', 'id' => '1', '0')); + $this->assertEqual($result, '/fo/1/0'); + + $result = $route->match(array('plugin' => 'fo', 'controller' => 'nodes', 'action' => 'view', 'id' => 1)); + $this->assertFalse($result); + + $result = $route->match(array('plugin' => 'fo', 'controller' => 'posts', 'action' => 'edit', 'id' => 1)); + $this->assertFalse($result); + + + $route =& new CakeRoute('/admin/subscriptions/:action/*', array( + 'controller' => 'subscribe', 'admin' => true, 'prefix' => 'admin' + )); + + $url = array('controller' => 'subscribe', 'admin' => true, 'action' => 'edit', 1); + $result = $route->match($url); + $expected = '/admin/subscriptions/edit/1'; + $this->assertEqual($result, $expected); + } + +/** + * test match() with greedy routes, named parameters and passed args. + * + * @return void + */ + function testMatchWithNamedParametersAndPassedArgs() { + Router::connectNamed(true); + + $route = new CakeRoute('/:controller/:action/*', array('plugin' => null)); + $result = $route->match(array('controller' => 'posts', 'action' => 'index', 'plugin' => null, 'page' => 1)); + $this->assertEqual($result, '/posts/index/page:1'); + + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 5)); + $this->assertEqual($result, '/posts/view/5'); + + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'plugin' => null, 5, 'page' => 1, 'limit' => 20, 'order' => 'title')); + $this->assertEqual($result, '/posts/view/5/page:1/limit:20/order:title'); + + + $route =& new CakeRoute('/test2/*', array('controller' => 'pages', 'action' => 'display', 2)); + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 1)); + $this->assertFalse($result); + + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 2, 'something')); + $this->assertEqual($result, '/test2/something'); + + $result = $route->match(array('controller' => 'pages', 'action' => 'display', 5, 'something')); + $this->assertFalse($result); + } + +/** + * test that match with patterns works. + * + * @return void + */ + function testMatchWithPatterns() { + $route =& new CakeRoute('/:controller/:action/:id', array('plugin' => null), array('id' => '[0-9]+')); + $result = $route->match(array('controller' => 'posts', 'action' => 'view', 'id' => 'foo')); + $this->assertFalse($result); + + $result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => '9')); + $this->assertEqual($result, '/posts/view/9'); + + $result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => '922')); + $this->assertEqual($result, '/posts/view/922'); + + $result = $route->match(array('plugin' => null, 'controller' => 'posts', 'action' => 'view', 'id' => 'a99')); + $this->assertFalse($result); + } + +/** + * test persistParams ability to persist parameters from $params and remove params. + * + * @return void + */ + function testPersistParams() { + $route =& new CakeRoute( + '/:lang/:color/blog/:action', + array('controller' => 'posts'), + array('persist' => array('lang', 'color')) + ); + $url = array('controller' => 'posts', 'action' => 'index'); + $params = array('lang' => 'en', 'color' => 'blue'); + $result = $route->persistParams($url, $params); + $this->assertEqual($result['lang'], $params['lang']); + $this->assertEqual($result['color'], $params['color']); + } + +/** + * test the parse method of CakeRoute. + * + * @return void + */ + function testParse() { + extract(Router::getNamedExpressions()); + $route = new CakeRoute('/:controller/:action/:id', array('controller' => 'testing4', 'id' => null), array('id' => $ID)); + $route->compile(); + $result = $route->parse('/posts/view/1'); + $this->assertEqual($result['controller'], 'posts'); + $this->assertEqual($result['action'], 'view'); + $this->assertEqual($result['id'], '1'); + } +} + + ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/sanitize.test.php b/cake/tests/cases/libs/sanitize.test.php index 5d23c0720..683592ed1 100644 --- a/cake/tests/cases/libs/sanitize.test.php +++ b/cake/tests/cases/libs/sanitize.test.php @@ -2,8 +2,6 @@ /** * SanitizeTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/security.test.php b/cake/tests/cases/libs/security.test.php index 86a9d6401..681bdf45a 100644 --- a/cake/tests/cases/libs/security.test.php +++ b/cake/tests/cases/libs/security.test.php @@ -2,8 +2,6 @@ /** * SecurityTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/set.test.php b/cake/tests/cases/libs/set.test.php index 6e2c1ed50..3050c599f 100644 --- a/cake/tests/cases/libs/set.test.php +++ b/cake/tests/cases/libs/set.test.php @@ -2,8 +2,6 @@ /** * SetTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/string.test.php b/cake/tests/cases/libs/string.test.php index be3172684..1d2a34008 100644 --- a/cake/tests/cases/libs/string.test.php +++ b/cake/tests/cases/libs/string.test.php @@ -2,8 +2,6 @@ /** * StringTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/tests/cases/libs/test_manager.test.php b/cake/tests/cases/libs/test_manager.test.php index 402836bac..5a673f690 100644 --- a/cake/tests/cases/libs/test_manager.test.php +++ b/cake/tests/cases/libs/test_manager.test.php @@ -2,8 +2,6 @@ /** * TestManagerTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index f1af0ce8b..72ceb4861 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -2,8 +2,6 @@ /** * ValidationTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helper.test.php b/cake/tests/cases/libs/view/helper.test.php index fbdabe951..a41f1b045 100644 --- a/cake/tests/cases/libs/view/helper.test.php +++ b/cake/tests/cases/libs/view/helper.test.php @@ -2,8 +2,6 @@ /** * HelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -663,6 +661,44 @@ class HelperTest extends CakeTestCase { $result = $this->Helper->value('My.title'); $this->assertEqual($result,'My Title'); } + + function testWebrootPaths() { + $this->Helper->webroot = '/'; + $result = $this->Helper->webroot('/img/cake.power.gif'); + $expected = '/img/cake.power.gif'; + $this->assertEqual($result, $expected); + + $this->Helper->theme = 'test_theme'; + + App::build(array( + 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) + )); + + $result = $this->Helper->webroot('/img/cake.power.gif'); + $expected = '/theme/test_theme/img/cake.power.gif'; + $this->assertEqual($result, $expected); + + $result = $this->Helper->webroot('/img/test.jpg'); + $expected = '/theme/test_theme/img/test.jpg'; + $this->assertEqual($result, $expected); + + $webRoot = Configure::read('App.www_root'); + Configure::write('App.www_root', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'webroot' . DS); + + $result = $this->Helper->webroot('/img/cake.power.gif'); + $expected = '/theme/test_theme/img/cake.power.gif'; + $this->assertEqual($result, $expected); + + $result = $this->Helper->webroot('/img/test.jpg'); + $expected = '/theme/test_theme/img/test.jpg'; + $this->assertEqual($result, $expected); + + $result = $this->Helper->webroot('/img/cake.icon.gif'); + $expected = '/img/cake.icon.gif'; + $this->assertEqual($result, $expected); + + Configure::write('App.www_root', $webRoot); + } } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/view/helpers/ajax.test.php b/cake/tests/cases/libs/view/helpers/ajax.test.php index 0d82066f7..a2f36f8ea 100644 --- a/cake/tests/cases/libs/view/helpers/ajax.test.php +++ b/cake/tests/cases/libs/view/helpers/ajax.test.php @@ -2,8 +2,6 @@ /** * AjaxHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/cache.test.php b/cake/tests/cases/libs/view/helpers/cache.test.php index 3f380b1be..abcc7c192 100644 --- a/cake/tests/cases/libs/view/helpers/cache.test.php +++ b/cake/tests/cases/libs/view/helpers/cache.test.php @@ -2,8 +2,6 @@ /** * CacheHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index f19c16f85..988bc7f16 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -2,8 +2,6 @@ /** * FormHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -19,9 +17,6 @@ * @since CakePHP(tm) v 1.2.0.4206 * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { - define('CAKEPHP_UNIT_TEST_EXECUTION', 1); -} App::import('Core', array('ClassRegistry', 'Controller', 'View', 'Model', 'Security')); App::import('Helper', 'Html'); App::import('Helper', 'Form'); @@ -727,12 +722,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('Contact', array('url' => '/contacts/add')); $expected = array( 'form' => array('method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding), - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), array('input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST')), array('input' => array( 'type' => 'hidden', 'name' => 'data[_Token][key]', 'value' => 'testKey', 'id' )), - '/fieldset' + '/div' ); $this->assertTags($result, $expected,true); @@ -814,12 +809,12 @@ class FormHelperTest extends CakeTestCase { $expected .= ':' . str_rot13(serialize(array('Model.valid'))); $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => urlencode($expected), 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -878,12 +873,12 @@ class FormHelperTest extends CakeTestCase { $hash .= '.uvqqra%22%3Bv%3A3%3Bf%3A13%3A%22Zbqry.1.inyvq%22%3B%7D'; $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -920,12 +915,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->end(null); $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => 'preg:/.+/', 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -968,12 +963,12 @@ class FormHelperTest extends CakeTestCase { $hash .= '3A%22Nqqerffrf.0.vq%22%3Bv%3A1%3Bf%3A14%3A%22Nqqerffrf.1.vq%22%3B%7D'; $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -1012,12 +1007,12 @@ class FormHelperTest extends CakeTestCase { $hash .= 'frf.0.vq%22%3Bv%3A1%3Bf%3A14%3A%22Nqqerffrf.1.vq%22%3B%7D'; $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -1056,12 +1051,12 @@ class FormHelperTest extends CakeTestCase { $hash = '449b7e889128e8e52c5e81d19df68f5346571492%3An%3A1%3A%'; $hash .= '7Bv%3A0%3Bf%3A12%3A%22Nqqerffrf.vq%22%3B%7D'; $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' ), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -1081,13 +1076,13 @@ class FormHelperTest extends CakeTestCase { $encoding = strtolower(Configure::read('App.encoding')); $expected = array( 'form' => array('method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding), - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), array('input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST')), array('input' => array( 'type' => 'hidden', 'name' => 'data[_Token][key]', 'value' => 'testKey', 'id' => 'preg:/Token\d+/' )), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -1163,12 +1158,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->secure($this->Form->fields); $expected = array( - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), array('input' => array( 'type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id' => 'preg:/TokenFields\d+/' )), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -1279,12 +1274,12 @@ class FormHelperTest extends CakeTestCase { $encoding = strtolower(Configure::read('App.encoding')); $expected = array( 'form' => array( - 'method' => 'post', 'action' => '/user_forms/login/', 'id' => 'UserFormLoginForm', + 'method' => 'post', 'action' => '/user_forms/login', 'id' => 'UserFormLoginForm', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -1323,10 +1318,10 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add')); $encoding = strtolower(Configure::read('App.encoding')); $expected = array( - 'form' => array('method' => 'post', 'action' => '/validate_users/add/', 'id','accept-charset' => $encoding), - 'fieldset' => array('style' => 'display:none;'), + 'form' => array('method' => 'post', 'action' => '/validate_users/add', 'id','accept-charset' => $encoding), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -1367,10 +1362,10 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add')); $encoding = strtolower(Configure::read('App.encoding')); $expected = array( - 'form' => array('method' => 'post', 'action' => '/validate_users/add/', 'id','accept-charset' => $encoding), - 'fieldset' => array('style' => 'display:none;'), + 'form' => array('method' => 'post', 'action' => '/validate_users/add', 'id','accept-charset' => $encoding), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -4568,6 +4563,24 @@ class FormHelperTest extends CakeTestCase { '/select', ); $this->assertTags($result, $expected); + + $this->Form->data = array(); + $this->Form->create('Contact'); + $result = $this->Form->year('published', 2006, 2008, null, array('empty' => false)); + $expected = array( + array('select' => array('name' => 'data[Contact][published][year]', 'id' => 'ContactPublishedYear')), + array('option' => array('value' => '2008')), + '2008', + '/option', + array('option' => array('value' => '2007')), + '2007', + '/option', + array('option' => array('value' => '2006')), + '2006', + '/option', + '/select', + ); + $this->assertTags($result, $expected); } /** @@ -4902,25 +4915,25 @@ class FormHelperTest extends CakeTestCase { $encoding = strtolower(Configure::read('App.encoding')); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); $result = $this->Form->create('Contact', array('type' => 'GET')); $expected = array('form' => array( - 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add', 'accept-charset' => $encoding )); $this->assertTags($result, $expected); $result = $this->Form->create('Contact', array('type' => 'get')); $expected = array('form' => array( - 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add', 'accept-charset' => $encoding )); $this->assertTags($result, $expected); @@ -4928,24 +4941,24 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('Contact', array('type' => 'put')); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'PUT'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); $result = $this->Form->create('Contact', array('type' => 'file')); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding, 'enctype' => 'multipart/form-data' ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -4957,9 +4970,9 @@ class FormHelperTest extends CakeTestCase { 'id' => 'ContactEditForm', 'method' => 'post', 'action' => '/contacts/edit/1', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'PUT'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -4971,9 +4984,9 @@ class FormHelperTest extends CakeTestCase { 'id' => 'ContactEditForm', 'method' => 'post', 'action' => '/contacts/edit/1', 'accept-charset' => $encoding, 'enctype' => 'multipart/form-data' ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'PUT'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -4984,9 +4997,9 @@ class FormHelperTest extends CakeTestCase { 'id' => 'ContactNonStandardPkEditForm', 'method' => 'post', 'action' => '/contact_non_standard_pks/edit/1','accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'PUT'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -4996,9 +5009,9 @@ class FormHelperTest extends CakeTestCase { 'id' => 'TestId', 'method' => 'post', 'action' => '/contacts/edit/1', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'PUT'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -5006,33 +5019,33 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('User', array('url' => array('action' => 'login'))); $expected = array( 'form' => array( - 'id' => 'UserAddForm', 'method' => 'post', 'action' => '/users/login/', + 'id' => 'UserAddForm', 'method' => 'post', 'action' => '/users/login', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); $result = $this->Form->create('User', array('action' => 'login')); $expected = array( 'form' => array( - 'id' => 'UserLoginForm', 'method' => 'post', 'action' => '/users/login/', + 'id' => 'UserLoginForm', 'method' => 'post', 'action' => '/users/login', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); $result = $this->Form->create('User', array('url' => '/users/login')); $expected = array( 'form' => array('method' => 'post', 'action' => '/users/login','accept-charset' => $encoding), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -5041,12 +5054,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('User', array('action' => 'signup')); $expected = array( 'form' => array( - 'id' => 'UserSignupForm', 'method' => 'post', 'action' => '/users/signup/', + 'id' => 'UserSignupForm', 'method' => 'post', 'action' => '/users/signup', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -5059,9 +5072,9 @@ class FormHelperTest extends CakeTestCase { 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param', 'accept-charset' => 'utf-8' ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -5103,12 +5116,12 @@ class FormHelperTest extends CakeTestCase { ); $expected = array( 'form' => array( - 'method' => 'post', 'action' => '/user_forms/login/', 'id' => 'UserFormLoginForm', + 'method' => 'post', 'action' => '/user_forms/login', 'id' => 'UserFormLoginForm', 'accept-charset' => 'iso-8859-1' ), - 'fieldset' => array('style' => 'display:none;'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); } @@ -5132,12 +5145,12 @@ class FormHelperTest extends CakeTestCase { 'form' => array( 'id' => 'ContactAddForm', 'method' => 'post', - 'action' => '/controller/action/?param1=value1&param2=value2', + 'action' => '/controller/action?param1=value1&param2=value2', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected, true); } @@ -5152,7 +5165,7 @@ class FormHelperTest extends CakeTestCase { $encoding = strtolower(Configure::read('App.encoding')); $result = $this->Form->create('Contact', array('type' => 'get')); $this->assertTags($result, array('form' => array( - 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'get', 'action' => '/contacts/add', 'accept-charset' => $encoding ))); @@ -5217,12 +5230,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('Contact'); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -5445,12 +5458,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('Contact'); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); @@ -5507,12 +5520,12 @@ class FormHelperTest extends CakeTestCase { $result = $this->Form->create('Contact'); $expected = array( 'form' => array( - 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add/', + 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/add', 'accept-charset' => $encoding ), - 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'), + 'div' => array('style' => 'display:none;'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), - '/fieldset' + '/div' ); $this->assertTags($result, $expected); diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 23d4d96c7..1f88bab7b 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -2,8 +2,6 @@ /** * HtmlHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -358,6 +356,38 @@ class HtmlHelperTest extends CakeTestCase { ))); $this->Html->webroot = $webroot; } + +/** + * test theme assets in main webroot path + * + * @access public + * @return void + */ + function testThemeAssetsInMainWebrootPath() { + App::build(array( + 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) + )); + $webRoot = Configure::read('App.www_root'); + Configure::write('App.www_root', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'webroot' . DS); + + $webroot = $this->Html->webroot; + $this->Html->theme = 'test_theme'; + $result = $this->Html->css('webroot_test'); + $expected = array( + 'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/webroot_test\.css/') + ); + $this->assertTags($result, $expected); + + $webroot = $this->Html->webroot; + $this->Html->theme = 'test_theme'; + $result = $this->Html->css('theme_webroot'); + $expected = array( + 'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/theme_webroot\.css/') + ); + $this->assertTags($result, $expected); + + Configure::write('App.www_root', $webRoot); + } /** * testStyle method diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php index 378459bfe..e10d18d2a 100644 --- a/cake/tests/cases/libs/view/helpers/javascript.test.php +++ b/cake/tests/cases/libs/view/helpers/javascript.test.php @@ -2,8 +2,6 @@ /** * JavascriptHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/js.test.php b/cake/tests/cases/libs/view/helpers/js.test.php index 6a79960bd..e201e1dc2 100644 --- a/cake/tests/cases/libs/view/helpers/js.test.php +++ b/cake/tests/cases/libs/view/helpers/js.test.php @@ -310,7 +310,7 @@ CODE; $options = array('id' => 'something', 'htmlAttributes' => array('arbitrary' => 'value', 'batman' => 'robin')); $result = $this->Js->link('test link', '/posts/view/1', $options); $expected = array( - 'a' => array('id' => $options['id'], 'href' => '/posts/view/1', 'arbitrary' => 'value', + 'a' => array('id' => $options['id'], 'href' => '/posts/view/1', 'arbitrary' => 'value', 'batman' => 'robin'), 'test link', '/a' @@ -373,7 +373,7 @@ CODE; $this->Js->TestJsEngine->expectAt(2, 'dispatchMethod', array('request', '*')); $params = array( - 'update' => $options['update'], 'data' => 'serialize-code', + 'update' => $options['update'], 'data' => 'serialize-code', 'method' => 'post', 'dataExpression' => true ); $this->Js->TestJsEngine->expectAt(3, 'dispatchMethod', array( @@ -402,13 +402,13 @@ CODE; $this->Js->TestJsEngine->expectAt(6, 'dispatchMethod', array('request', $requestParams)); $params = array( - 'update' => '#content', 'data' => 'serialize-code', + 'update' => '#content', 'data' => 'serialize-code', 'method' => 'post', 'dataExpression' => true ); $this->Js->TestJsEngine->expectAt(7, 'dispatchMethod', array( 'event', array('click', "ajax-code", $params) )); - + $options = array('update' => '#content', 'id' => 'test-submit', 'url' => '/custom/url'); $result = $this->Js->submit('Save', $options); $expected = array( @@ -430,6 +430,18 @@ CODE; $this->assertEqual($result, $expected); } +/** + * Test that inherited Helper::value() is overwritten in JsHelper::value() + * and calls JsBaseEngineHelper::value(). + * + * @return void + */ + function testValuePassThrough() { + $result = $this->Js->value('string "quote"', true); + $expected = '"string \"quote\""'; + $this->assertEqual($result, $expected); + } + /** * test set()'ing variables to the Javascript buffer and controlling the output var name. * @@ -439,16 +451,16 @@ CODE; $this->Js->set('loggedIn', true); $this->Js->set(array('height' => 'tall', 'color' => 'purple')); $result = $this->Js->getBuffer(); - $expected = 'var app = {"loggedIn":true,"height":"tall","color":"purple"};'; + $expected = 'window.app = {"loggedIn":true,"height":"tall","color":"purple"};'; $this->assertEqual($result[0], $expected); $this->Js->set('loggedIn', true); $this->Js->set(array('height' => 'tall', 'color' => 'purple')); $this->Js->setVariable = 'WICKED'; $result = $this->Js->getBuffer(); - $expected = 'var WICKED = {"loggedIn":true,"height":"tall","color":"purple"};'; + $expected = 'window.WICKED = {"loggedIn":true,"height":"tall","color":"purple"};'; $this->assertEqual($result[0], $expected); - + $this->Js->set('loggedIn', true); $this->Js->set(array('height' => 'tall', 'color' => 'purple')); $this->Js->setVariable = 'Application.variables'; diff --git a/cake/tests/cases/libs/view/helpers/number.test.php b/cake/tests/cases/libs/view/helpers/number.test.php index 456ff09ad..86a226e6c 100644 --- a/cake/tests/cases/libs/view/helpers/number.test.php +++ b/cake/tests/cases/libs/view/helpers/number.test.php @@ -2,8 +2,6 @@ /** * NumberHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index e41f65530..19d5853e6 100644 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -2,8 +2,6 @@ /** * PaginatorHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -65,7 +63,7 @@ class PaginatorHelperTest extends CakeTestCase { $this->Paginator->Ajax->Javascript =& new JavascriptHelper(); $this->Paginator->Ajax->Form =& new FormHelper(); - Configure::write('Routing.admin', ''); + Configure::write('Routing.prefixes', array()); Router::reload(); } @@ -387,7 +385,7 @@ class PaginatorHelperTest extends CakeTestCase { * @return void */ function testSortAdminLinks() { - Configure::write('Routing.admin', 'admin'); + Configure::write('Routing.prefixes', array('admin')); Router::reload(); Router::setRequestInfo(array( @@ -747,6 +745,25 @@ class PaginatorHelperTest extends CakeTestCase { '/a', ); $this->assertTags($result, $expected); + + $this->Paginator->params['paging'] = array( + 'Client' => array( + 'page' => 2, 'current' => 1, 'count' => 13, 'prevPage' => true, + 'nextPage' => false, 'pageCount' => 2, + 'defaults' => array(), + 'options' => array( + 'page' => 2, 'limit' => 10, 'order' => array(), 'conditions' => array() + ) + ) + ); + $this->Paginator->options(array('url' => array(12, 'page' => 3))); + $result = $this->Paginator->prev('Prev', array('url' => array(12, 'foo' => 'bar'))); + $expected = array( + 'a' => array('href' => '/index/12/page:1/limit:10/foo:bar', 'class' => 'prev'), + 'Prev', + '/a', + ); + $this->assertTags($result, $expected); } /** diff --git a/cake/tests/cases/libs/view/helpers/rss.test.php b/cake/tests/cases/libs/view/helpers/rss.test.php index fd69bd0ae..28b9e6360 100644 --- a/cake/tests/cases/libs/view/helpers/rss.test.php +++ b/cake/tests/cases/libs/view/helpers/rss.test.php @@ -2,8 +2,6 @@ /** * RssHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/session.test.php b/cake/tests/cases/libs/view/helpers/session.test.php index 45b9b81a6..8766e4080 100644 --- a/cake/tests/cases/libs/view/helpers/session.test.php +++ b/cake/tests/cases/libs/view/helpers/session.test.php @@ -2,8 +2,6 @@ /** * SessionHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/text.test.php b/cake/tests/cases/libs/view/helpers/text.test.php index 84dcbf9e4..d9ec7448e 100644 --- a/cake/tests/cases/libs/view/helpers/text.test.php +++ b/cake/tests/cases/libs/view/helpers/text.test.php @@ -2,8 +2,6 @@ /** * TextHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/time.test.php b/cake/tests/cases/libs/view/helpers/time.test.php index 060a02936..b4f0dd5df 100644 --- a/cake/tests/cases/libs/view/helpers/time.test.php +++ b/cake/tests/cases/libs/view/helpers/time.test.php @@ -2,8 +2,6 @@ /** * TimeHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/helpers/xml.test.php b/cake/tests/cases/libs/view/helpers/xml.test.php index 43b7a8fdd..05e40eac0 100644 --- a/cake/tests/cases/libs/view/helpers/xml.test.php +++ b/cake/tests/cases/libs/view/helpers/xml.test.php @@ -2,8 +2,6 @@ /** * XmlHelperTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/cases/libs/view/theme.test.php b/cake/tests/cases/libs/view/theme.test.php index 83cb4ef8c..cae0b37fb 100644 --- a/cake/tests/cases/libs/view/theme.test.php +++ b/cake/tests/cases/libs/view/theme.test.php @@ -2,8 +2,6 @@ /** * ThemeViewTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -149,11 +147,11 @@ class ThemeViewTest extends CakeTestCase { */ function setUp() { Router::reload(); - $this->Controller = new Controller(); - $this->PostsController = new ThemePostsController(); + $this->Controller =& new Controller(); + $this->PostsController =& new ThemePostsController(); $this->PostsController->viewPath = 'posts'; $this->PostsController->index(); - $this->ThemeView = new ThemeView($this->PostsController); + $this->ThemeView =& new ThemeView($this->PostsController); } /** @@ -166,6 +164,19 @@ class ThemeViewTest extends CakeTestCase { unset($this->ThemeView); unset($this->PostsController); unset($this->Controller); + ClassRegistry::flush(); + } +/** + * test that the theme view can be constructed without going into the registry + * + * @return void + */ + function testConstructionNoRegister() { + ClassRegistry::flush(); + $controller = null; + $Theme =& new ThemeView($controller, false); + $ThemeTwo =& ClassRegistry::getObject('view'); + $this->assertFalse($ThemeTwo); } /** @@ -199,20 +210,24 @@ class ThemeViewTest extends CakeTestCase { * @access public * @return void */ - function testPluginGetTemplate() { + function testPluginThemedGetTemplate() { $this->Controller->plugin = 'test_plugin'; $this->Controller->name = 'TestPlugin'; $this->Controller->viewPath = 'tests'; $this->Controller->action = 'index'; - $this->Controller->theme = 'test_plugin_theme'; + $this->Controller->theme = 'test_theme'; $ThemeView = new TestThemeView($this->Controller); - $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'themed' . DS . 'test_plugin_theme' . DS .'tests' . DS .'index.ctp'; + $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'tests' . DS .'index.ctp'; $result = $ThemeView->getViewFileName('index'); $this->assertEqual($result, $expected); - $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'themed' . DS . 'test_plugin_theme' . DS . 'layouts' . DS .'default.ctp'; - $result = $ThemeView->getLayoutFileName(); + $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'plugins' . DS . 'test_plugin' . DS . 'layouts' . DS .'plugin_default.ctp'; + $result = $ThemeView->getLayoutFileName('plugin_default'); + $this->assertEqual($result, $expected); + + $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS . 'themed' . DS . 'test_theme' . DS . 'layouts' . DS .'default.ctp'; + $result = $ThemeView->getLayoutFileName('default'); $this->assertEqual($result, $expected); } diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index c0b7e99eb..1bca64917 100644 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -2,8 +2,6 @@ /** * ViewTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -445,11 +443,11 @@ class ViewTest extends CakeTestCase { */ function testUUIDGeneration() { $result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index')); - $this->assertEqual($result, 'form0425fe3bad'); + $this->assertEqual($result, 'form5988016017'); $result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index')); - $this->assertEqual($result, 'forma9918342a7'); + $this->assertEqual($result, 'formc3dc6be854'); $result = $this->View->uuid('form', array('controller' => 'posts', 'action' => 'index')); - $this->assertEqual($result, 'form3ecf2e3e96'); + $this->assertEqual($result, 'form28f92cc87f'); } /** @@ -476,6 +474,13 @@ class ViewTest extends CakeTestCase { function testElement() { $result = $this->View->element('test_element'); $this->assertEqual($result, 'this is the test element'); + + $result = $this->View->element('plugin_element', array('plugin' => 'test_plugin')); + $this->assertEqual($result, 'this is the plugin element using params[plugin]'); + + $this->View->plugin = 'test_plugin'; + $result = $this->View->element('test_plugin_element'); + $this->assertEqual($result, 'this is the test set using View::$plugin plugin element'); $result = $this->View->element('non_existant_element'); $this->assertPattern('/Not Found:/', $result); diff --git a/cake/tests/cases/libs/xml.test.php b/cake/tests/cases/libs/xml.test.php index 423a73c03..c4fb1b465 100644 --- a/cake/tests/cases/libs/xml.test.php +++ b/cake/tests/cases/libs/xml.test.php @@ -2,8 +2,6 @@ /** * XmlTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests @@ -113,7 +111,6 @@ class XmlTest extends CakeTestCase { $result =& new Xml($data, array('format' => 'tags')); $expected = '12'; $this->assertIdentical($result->toString(), $expected); - } /** @@ -263,7 +260,7 @@ class XmlTest extends CakeTestCase { * @access public * @return void */ - function testArraySerialization() { + function testSerializationArray() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), @@ -291,7 +288,7 @@ class XmlTest extends CakeTestCase { * @access public * @return void */ - function testNestedArraySerialization() { + function testSerializationNestedArray() { $input = array( array( 'Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), @@ -337,9 +334,9 @@ class XmlTest extends CakeTestCase { */ function testArraySerializationWithRoot() { $input = array( - array('Shirt' => array('id' => 1, 'color' => 'green')), - array('Shirt' => array('id' => 2, 'color' => 'blue')), - ); + array('Shirt' => array('id' => 1, 'color' => 'green')), + array('Shirt' => array('id' => 2, 'color' => 'blue')), + ); $expected = ''; $expected .= ''; @@ -714,6 +711,24 @@ class XmlTest extends CakeTestCase { $this->assertEqual($expected, $result); } +/** + * ensure that normalize does not add _name_ elements that come from Set::map sometimes. + * + * @return void + */ + function testNormalizeNotAdding_name_Element() { + $input = array( + 'output' => array( + 'Vouchers' => array( + array('Voucher' => array('id' => 1)), + array('Voucher' => array('id' => 2)), + ), + ) + ); + $xml = new Xml($input, array('attributes' => false, 'format' => 'tags')); + $this->assertFalse(isset($xml->children[0]->children[0]->children[1]), 'Too many children %s'); + $this->assertEqual($xml->children[0]->children[0]->children[0]->name, 'voucher'); + } /** * testSimpleParsing method * diff --git a/cake/tests/fixtures/account_fixture.php b/cake/tests/fixtures/account_fixture.php index 958a2f471..a73aaca12 100644 --- a/cake/tests/fixtures/account_fixture.php +++ b/cake/tests/fixtures/account_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aco_action_fixture.php b/cake/tests/fixtures/aco_action_fixture.php index b4dccbdd2..5467f3b1a 100644 --- a/cake/tests/fixtures/aco_action_fixture.php +++ b/cake/tests/fixtures/aco_action_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aco_fixture.php b/cake/tests/fixtures/aco_fixture.php index a6fdd830c..66519f976 100644 --- a/cake/tests/fixtures/aco_fixture.php +++ b/cake/tests/fixtures/aco_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aco_two_fixture.php b/cake/tests/fixtures/aco_two_fixture.php index d10ce3b98..71f415b60 100644 --- a/cake/tests/fixtures/aco_two_fixture.php +++ b/cake/tests/fixtures/aco_two_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/advertisement_fixture.php b/cake/tests/fixtures/advertisement_fixture.php index b9381b99a..3a4e69dc6 100644 --- a/cake/tests/fixtures/advertisement_fixture.php +++ b/cake/tests/fixtures/advertisement_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/another_article_fixture.php b/cake/tests/fixtures/another_article_fixture.php index 33099253e..563812feb 100644 --- a/cake/tests/fixtures/another_article_fixture.php +++ b/cake/tests/fixtures/another_article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/apple_fixture.php b/cake/tests/fixtures/apple_fixture.php index 934bf1fc6..22e7c45be 100644 --- a/cake/tests/fixtures/apple_fixture.php +++ b/cake/tests/fixtures/apple_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aro_fixture.php b/cake/tests/fixtures/aro_fixture.php index 983711b37..92e621125 100644 --- a/cake/tests/fixtures/aro_fixture.php +++ b/cake/tests/fixtures/aro_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aro_two_fixture.php b/cake/tests/fixtures/aro_two_fixture.php index 3b7922dcf..7ca0a5490 100644 --- a/cake/tests/fixtures/aro_two_fixture.php +++ b/cake/tests/fixtures/aro_two_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aros_aco_fixture.php b/cake/tests/fixtures/aros_aco_fixture.php index b791efbb2..854c98da5 100644 --- a/cake/tests/fixtures/aros_aco_fixture.php +++ b/cake/tests/fixtures/aros_aco_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/aros_aco_two_fixture.php b/cake/tests/fixtures/aros_aco_two_fixture.php index 37a74c981..c918448a0 100644 --- a/cake/tests/fixtures/aros_aco_two_fixture.php +++ b/cake/tests/fixtures/aros_aco_two_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/article_featured_fixture.php b/cake/tests/fixtures/article_featured_fixture.php index e91cdb0f6..4f7d670b8 100644 --- a/cake/tests/fixtures/article_featured_fixture.php +++ b/cake/tests/fixtures/article_featured_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/article_featureds_tags_fixture.php b/cake/tests/fixtures/article_featureds_tags_fixture.php index c75e47324..c301c562f 100644 --- a/cake/tests/fixtures/article_featureds_tags_fixture.php +++ b/cake/tests/fixtures/article_featureds_tags_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/article_fixture.php b/cake/tests/fixtures/article_fixture.php index 1e902b2cb..d0b4b0ca4 100644 --- a/cake/tests/fixtures/article_fixture.php +++ b/cake/tests/fixtures/article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/articles_tag_fixture.php b/cake/tests/fixtures/articles_tag_fixture.php index 52fce86c2..1a5e673e7 100644 --- a/cake/tests/fixtures/articles_tag_fixture.php +++ b/cake/tests/fixtures/articles_tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/attachment_fixture.php b/cake/tests/fixtures/attachment_fixture.php index ec05af161..8f8f92b60 100644 --- a/cake/tests/fixtures/attachment_fixture.php +++ b/cake/tests/fixtures/attachment_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/auth_user_custom_field_fixture.php b/cake/tests/fixtures/auth_user_custom_field_fixture.php index 9a37ae850..623b0a325 100644 --- a/cake/tests/fixtures/auth_user_custom_field_fixture.php +++ b/cake/tests/fixtures/auth_user_custom_field_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/auth_user_fixture.php b/cake/tests/fixtures/auth_user_fixture.php index fab5cb406..da3035c67 100644 --- a/cake/tests/fixtures/auth_user_fixture.php +++ b/cake/tests/fixtures/auth_user_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/author_fixture.php b/cake/tests/fixtures/author_fixture.php index d16a57ac6..6b844fd30 100644 --- a/cake/tests/fixtures/author_fixture.php +++ b/cake/tests/fixtures/author_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/basket_fixture.php b/cake/tests/fixtures/basket_fixture.php index 97ee679a1..8c589c5b9 100644 --- a/cake/tests/fixtures/basket_fixture.php +++ b/cake/tests/fixtures/basket_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/bid_fixture.php b/cake/tests/fixtures/bid_fixture.php index 867e03891..ad5f41eff 100644 --- a/cake/tests/fixtures/bid_fixture.php +++ b/cake/tests/fixtures/bid_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/binary_test_fixture.php b/cake/tests/fixtures/binary_test_fixture.php index 83b590e62..8430fd310 100644 --- a/cake/tests/fixtures/binary_test_fixture.php +++ b/cake/tests/fixtures/binary_test_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/book_fixture.php b/cake/tests/fixtures/book_fixture.php index 50fdb2731..3cff637dd 100644 --- a/cake/tests/fixtures/book_fixture.php +++ b/cake/tests/fixtures/book_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/cache_test_model_fixture.php b/cake/tests/fixtures/cache_test_model_fixture.php index eaf0bdc78..28acc86c3 100644 --- a/cake/tests/fixtures/cache_test_model_fixture.php +++ b/cake/tests/fixtures/cache_test_model_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/callback_fixture.php b/cake/tests/fixtures/callback_fixture.php index 3198efb01..5ee65cec6 100644 --- a/cake/tests/fixtures/callback_fixture.php +++ b/cake/tests/fixtures/callback_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/category_fixture.php b/cake/tests/fixtures/category_fixture.php index 9bb0e3040..523169ff9 100644 --- a/cake/tests/fixtures/category_fixture.php +++ b/cake/tests/fixtures/category_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/category_thread_fixture.php b/cake/tests/fixtures/category_thread_fixture.php index be6d3fb3b..4a6ff36c9 100644 --- a/cake/tests/fixtures/category_thread_fixture.php +++ b/cake/tests/fixtures/category_thread_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/cd_fixture.php b/cake/tests/fixtures/cd_fixture.php index 2d0d41048..36cd6a51d 100644 --- a/cake/tests/fixtures/cd_fixture.php +++ b/cake/tests/fixtures/cd_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/comment_fixture.php b/cake/tests/fixtures/comment_fixture.php index 28c23e05c..9c1c35675 100644 --- a/cake/tests/fixtures/comment_fixture.php +++ b/cake/tests/fixtures/comment_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/content_account_fixture.php b/cake/tests/fixtures/content_account_fixture.php index af61f60c2..1de959945 100644 --- a/cake/tests/fixtures/content_account_fixture.php +++ b/cake/tests/fixtures/content_account_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/content_fixture.php b/cake/tests/fixtures/content_fixture.php index 33803a313..4f0e5adfc 100644 --- a/cake/tests/fixtures/content_fixture.php +++ b/cake/tests/fixtures/content_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/counter_cache_post_nonstandard_primary_key_fixture.php b/cake/tests/fixtures/counter_cache_post_nonstandard_primary_key_fixture.php index 19a0b8d41..ac6791e26 100644 --- a/cake/tests/fixtures/counter_cache_post_nonstandard_primary_key_fixture.php +++ b/cake/tests/fixtures/counter_cache_post_nonstandard_primary_key_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/counter_cache_user_fixture.php b/cake/tests/fixtures/counter_cache_user_fixture.php index f0078a723..1d0c920d0 100644 --- a/cake/tests/fixtures/counter_cache_user_fixture.php +++ b/cake/tests/fixtures/counter_cache_user_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/counter_cache_user_nonstandard_primary_key_fixture.php b/cake/tests/fixtures/counter_cache_user_nonstandard_primary_key_fixture.php index 8cb3ab082..969669f23 100644 --- a/cake/tests/fixtures/counter_cache_user_nonstandard_primary_key_fixture.php +++ b/cake/tests/fixtures/counter_cache_user_nonstandard_primary_key_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/data_test_fixture.php b/cake/tests/fixtures/data_test_fixture.php index bbb715026..e8da35943 100644 --- a/cake/tests/fixtures/data_test_fixture.php +++ b/cake/tests/fixtures/data_test_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/datatype_fixture.php b/cake/tests/fixtures/datatype_fixture.php index 554f2abb7..ec8b3acf9 100644 --- a/cake/tests/fixtures/datatype_fixture.php +++ b/cake/tests/fixtures/datatype_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) diff --git a/cake/tests/fixtures/dependency_fixture.php b/cake/tests/fixtures/dependency_fixture.php index 09b9d7512..c03893dec 100644 --- a/cake/tests/fixtures/dependency_fixture.php +++ b/cake/tests/fixtures/dependency_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.tests.fixtures * @since CakePHP(tm) v 1.2.0.6879//Correct version number as needed** diff --git a/cake/tests/fixtures/device_fixture.php b/cake/tests/fixtures/device_fixture.php index b04012dff..ef9cf901e 100644 --- a/cake/tests/fixtures/device_fixture.php +++ b/cake/tests/fixtures/device_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/device_type_category_fixture.php b/cake/tests/fixtures/device_type_category_fixture.php index b460af1c9..8e47c827e 100644 --- a/cake/tests/fixtures/device_type_category_fixture.php +++ b/cake/tests/fixtures/device_type_category_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/device_type_fixture.php b/cake/tests/fixtures/device_type_fixture.php index f869eef14..81063b582 100644 --- a/cake/tests/fixtures/device_type_fixture.php +++ b/cake/tests/fixtures/device_type_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/document_directory_fixture.php b/cake/tests/fixtures/document_directory_fixture.php index f31089d39..e9f7ea0dc 100644 --- a/cake/tests/fixtures/document_directory_fixture.php +++ b/cake/tests/fixtures/document_directory_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/document_fixture.php b/cake/tests/fixtures/document_fixture.php index e6c13c45f..da0b4623b 100644 --- a/cake/tests/fixtures/document_fixture.php +++ b/cake/tests/fixtures/document_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/exterior_type_category_fixture.php b/cake/tests/fixtures/exterior_type_category_fixture.php index f1c3148b5..8eef4c886 100644 --- a/cake/tests/fixtures/exterior_type_category_fixture.php +++ b/cake/tests/fixtures/exterior_type_category_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/feature_set_fixture.php b/cake/tests/fixtures/feature_set_fixture.php index f3c6ae83b..6c7d7c9aa 100644 --- a/cake/tests/fixtures/feature_set_fixture.php +++ b/cake/tests/fixtures/feature_set_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/featured_fixture.php b/cake/tests/fixtures/featured_fixture.php index e1ddca0e8..a592e3027 100644 --- a/cake/tests/fixtures/featured_fixture.php +++ b/cake/tests/fixtures/featured_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/film_file_fixture.php b/cake/tests/fixtures/film_file_fixture.php index 9c83b8bdc..b47f080e1 100644 --- a/cake/tests/fixtures/film_file_fixture.php +++ b/cake/tests/fixtures/film_file_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/fruit_fixture.php b/cake/tests/fixtures/fruit_fixture.php index cf7e7eaf7..ad33b5a8f 100644 --- a/cake/tests/fixtures/fruit_fixture.php +++ b/cake/tests/fixtures/fruit_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/fruits_uuid_tag_fixture.php b/cake/tests/fixtures/fruits_uuid_tag_fixture.php index 6ae994386..096af2754 100644 --- a/cake/tests/fixtures/fruits_uuid_tag_fixture.php +++ b/cake/tests/fixtures/fruits_uuid_tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/group_update_all_fixture.php b/cake/tests/fixtures/group_update_all_fixture.php index a4ae26bd2..b3a7be1aa 100644 --- a/cake/tests/fixtures/group_update_all_fixture.php +++ b/cake/tests/fixtures/group_update_all_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/home_fixture.php b/cake/tests/fixtures/home_fixture.php index 482fc081b..8c8f9b900 100644 --- a/cake/tests/fixtures/home_fixture.php +++ b/cake/tests/fixtures/home_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/image_fixture.php b/cake/tests/fixtures/image_fixture.php index 9773d4140..694089b68 100644 --- a/cake/tests/fixtures/image_fixture.php +++ b/cake/tests/fixtures/image_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/item_fixture.php b/cake/tests/fixtures/item_fixture.php index 0d162016f..218dc898f 100644 --- a/cake/tests/fixtures/item_fixture.php +++ b/cake/tests/fixtures/item_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/items_portfolio_fixture.php b/cake/tests/fixtures/items_portfolio_fixture.php index 61227d278..474772d11 100644 --- a/cake/tests/fixtures/items_portfolio_fixture.php +++ b/cake/tests/fixtures/items_portfolio_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_a_b_fixture.php b/cake/tests/fixtures/join_a_b_fixture.php index 4e5bc4443..af630649c 100644 --- a/cake/tests/fixtures/join_a_b_fixture.php +++ b/cake/tests/fixtures/join_a_b_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_a_c_fixture.php b/cake/tests/fixtures/join_a_c_fixture.php index 8780f8da5..64d5b4c25 100644 --- a/cake/tests/fixtures/join_a_c_fixture.php +++ b/cake/tests/fixtures/join_a_c_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_a_fixture.php b/cake/tests/fixtures/join_a_fixture.php index 783e6c206..48613bdf6 100644 --- a/cake/tests/fixtures/join_a_fixture.php +++ b/cake/tests/fixtures/join_a_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_b_fixture.php b/cake/tests/fixtures/join_b_fixture.php index 496ea4f0f..009117841 100644 --- a/cake/tests/fixtures/join_b_fixture.php +++ b/cake/tests/fixtures/join_b_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_c_fixture.php b/cake/tests/fixtures/join_c_fixture.php index 9e27cdd94..453a7824a 100644 --- a/cake/tests/fixtures/join_c_fixture.php +++ b/cake/tests/fixtures/join_c_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/join_thing_fixture.php b/cake/tests/fixtures/join_thing_fixture.php index 653791761..cf16bbd30 100644 --- a/cake/tests/fixtures/join_thing_fixture.php +++ b/cake/tests/fixtures/join_thing_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/message_fixture.php b/cake/tests/fixtures/message_fixture.php index aa5949585..8481a0088 100644 --- a/cake/tests/fixtures/message_fixture.php +++ b/cake/tests/fixtures/message_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/my_categories_my_products_fixture.php b/cake/tests/fixtures/my_categories_my_products_fixture.php index 6aba2cbfa..e2cd85e87 100644 --- a/cake/tests/fixtures/my_categories_my_products_fixture.php +++ b/cake/tests/fixtures/my_categories_my_products_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/my_categories_my_users_fixture.php b/cake/tests/fixtures/my_categories_my_users_fixture.php index 050ce40e5..44eb60c52 100644 --- a/cake/tests/fixtures/my_categories_my_users_fixture.php +++ b/cake/tests/fixtures/my_categories_my_users_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/my_category_fixture.php b/cake/tests/fixtures/my_category_fixture.php index dc9c42d36..e15b66768 100644 --- a/cake/tests/fixtures/my_category_fixture.php +++ b/cake/tests/fixtures/my_category_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/my_product_fixture.php b/cake/tests/fixtures/my_product_fixture.php index b101ba1ec..d85cdd732 100644 --- a/cake/tests/fixtures/my_product_fixture.php +++ b/cake/tests/fixtures/my_product_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/my_user_fixture.php b/cake/tests/fixtures/my_user_fixture.php index f1015038b..46766e12c 100644 --- a/cake/tests/fixtures/my_user_fixture.php +++ b/cake/tests/fixtures/my_user_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/node_fixture.php b/cake/tests/fixtures/node_fixture.php index 0ca7e8e63..ce2a9c7db 100644 --- a/cake/tests/fixtures/node_fixture.php +++ b/cake/tests/fixtures/node_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -23,8 +21,6 @@ /** * Short description for file. * - * Long description for file - * * @package cake * @subpackage cake.tests.fixtures * @since CakePHP(tm) v 1.2.0.6879 //Correct version number as needed** diff --git a/cake/tests/fixtures/numeric_article_fixture.php b/cake/tests/fixtures/numeric_article_fixture.php index 1915316b0..75eb82f5a 100644 --- a/cake/tests/fixtures/numeric_article_fixture.php +++ b/cake/tests/fixtures/numeric_article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/overall_favorite_fixture.php b/cake/tests/fixtures/overall_favorite_fixture.php index 0ed0042f3..d1461f768 100644 --- a/cake/tests/fixtures/overall_favorite_fixture.php +++ b/cake/tests/fixtures/overall_favorite_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/person_fixture.php b/cake/tests/fixtures/person_fixture.php index 74a399c6d..9ba397069 100644 --- a/cake/tests/fixtures/person_fixture.php +++ b/cake/tests/fixtures/person_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/portfolio_fixture.php b/cake/tests/fixtures/portfolio_fixture.php index 1dd0675ba..b2017520b 100644 --- a/cake/tests/fixtures/portfolio_fixture.php +++ b/cake/tests/fixtures/portfolio_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/post_fixture.php b/cake/tests/fixtures/post_fixture.php index eada4e3b1..88876d50d 100644 --- a/cake/tests/fixtures/post_fixture.php +++ b/cake/tests/fixtures/post_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/posts_tag_fixture.php b/cake/tests/fixtures/posts_tag_fixture.php index 5428cc4d9..c2f82d0ff 100644 --- a/cake/tests/fixtures/posts_tag_fixture.php +++ b/cake/tests/fixtures/posts_tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/primary_model_fixture.php b/cake/tests/fixtures/primary_model_fixture.php index 3430d2b43..b304df6df 100644 --- a/cake/tests/fixtures/primary_model_fixture.php +++ b/cake/tests/fixtures/primary_model_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/product_fixture.php b/cake/tests/fixtures/product_fixture.php index bb1a972f6..4e1b0cdd1 100644 --- a/cake/tests/fixtures/product_fixture.php +++ b/cake/tests/fixtures/product_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/product_update_all_fixture.php b/cake/tests/fixtures/product_update_all_fixture.php index 48fc3d5d5..b9e48db82 100644 --- a/cake/tests/fixtures/product_update_all_fixture.php +++ b/cake/tests/fixtures/product_update_all_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/project_fixture.php b/cake/tests/fixtures/project_fixture.php index 2c2f17b92..60363af5c 100644 --- a/cake/tests/fixtures/project_fixture.php +++ b/cake/tests/fixtures/project_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/sample_fixture.php b/cake/tests/fixtures/sample_fixture.php index b4f4aca34..329118656 100644 --- a/cake/tests/fixtures/sample_fixture.php +++ b/cake/tests/fixtures/sample_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/secondary_model_fixture.php b/cake/tests/fixtures/secondary_model_fixture.php index ae561ec20..f14b62716 100644 --- a/cake/tests/fixtures/secondary_model_fixture.php +++ b/cake/tests/fixtures/secondary_model_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/session_fixture.php b/cake/tests/fixtures/session_fixture.php index 18e768622..2d8958b11 100644 --- a/cake/tests/fixtures/session_fixture.php +++ b/cake/tests/fixtures/session_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/something_else_fixture.php b/cake/tests/fixtures/something_else_fixture.php index 925a0769d..ab14636d1 100644 --- a/cake/tests/fixtures/something_else_fixture.php +++ b/cake/tests/fixtures/something_else_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/something_fixture.php b/cake/tests/fixtures/something_fixture.php index 244c501ba..a45d72a61 100644 --- a/cake/tests/fixtures/something_fixture.php +++ b/cake/tests/fixtures/something_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/stories_tag_fixture.php b/cake/tests/fixtures/stories_tag_fixture.php index c4bbb51b6..5548d440f 100644 --- a/cake/tests/fixtures/stories_tag_fixture.php +++ b/cake/tests/fixtures/stories_tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/story_fixture.php b/cake/tests/fixtures/story_fixture.php index 8fa8e61fd..0ab7b183b 100644 --- a/cake/tests/fixtures/story_fixture.php +++ b/cake/tests/fixtures/story_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/syfile_fixture.php b/cake/tests/fixtures/syfile_fixture.php index 56d7b2664..895380b4d 100644 --- a/cake/tests/fixtures/syfile_fixture.php +++ b/cake/tests/fixtures/syfile_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/tag_fixture.php b/cake/tests/fixtures/tag_fixture.php index 1aa7df0c8..40d878b58 100644 --- a/cake/tests/fixtures/tag_fixture.php +++ b/cake/tests/fixtures/tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/test_plugin_article_fixture.php b/cake/tests/fixtures/test_plugin_article_fixture.php index 8c80dcebe..e6089ecbc 100644 --- a/cake/tests/fixtures/test_plugin_article_fixture.php +++ b/cake/tests/fixtures/test_plugin_article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/test_plugin_comment_fixture.php b/cake/tests/fixtures/test_plugin_comment_fixture.php index e10992059..ce9599422 100644 --- a/cake/tests/fixtures/test_plugin_comment_fixture.php +++ b/cake/tests/fixtures/test_plugin_comment_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/the_paper_monkies_fixture.php b/cake/tests/fixtures/the_paper_monkies_fixture.php index cbf790da8..6b56b5c16 100644 --- a/cake/tests/fixtures/the_paper_monkies_fixture.php +++ b/cake/tests/fixtures/the_paper_monkies_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/thread_fixture.php b/cake/tests/fixtures/thread_fixture.php index f3caa3067..8b87e3362 100644 --- a/cake/tests/fixtures/thread_fixture.php +++ b/cake/tests/fixtures/thread_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/translate_article_fixture.php b/cake/tests/fixtures/translate_article_fixture.php index 41f9316b6..036c4f604 100644 --- a/cake/tests/fixtures/translate_article_fixture.php +++ b/cake/tests/fixtures/translate_article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/translate_fixture.php b/cake/tests/fixtures/translate_fixture.php index 5c775675f..ff2d70bda 100644 --- a/cake/tests/fixtures/translate_fixture.php +++ b/cake/tests/fixtures/translate_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/translate_table_fixture.php b/cake/tests/fixtures/translate_table_fixture.php index 34b85c7e5..ce3d3322a 100644 --- a/cake/tests/fixtures/translate_table_fixture.php +++ b/cake/tests/fixtures/translate_table_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/translated_article_fixture.php b/cake/tests/fixtures/translated_article_fixture.php index 8f80f4e67..67613204c 100644 --- a/cake/tests/fixtures/translated_article_fixture.php +++ b/cake/tests/fixtures/translated_article_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/translated_item_fixture.php b/cake/tests/fixtures/translated_item_fixture.php index aa0ae18f9..a00255a11 100644 --- a/cake/tests/fixtures/translated_item_fixture.php +++ b/cake/tests/fixtures/translated_item_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/underscore_field_fixture.php b/cake/tests/fixtures/underscore_field_fixture.php index 3ab57ca23..3f7ef2250 100644 --- a/cake/tests/fixtures/underscore_field_fixture.php +++ b/cake/tests/fixtures/underscore_field_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/user_fixture.php b/cake/tests/fixtures/user_fixture.php index 881f8e579..373fadb74 100644 --- a/cake/tests/fixtures/user_fixture.php +++ b/cake/tests/fixtures/user_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuid_fixture.php b/cake/tests/fixtures/uuid_fixture.php index 3225b7cc0..dae7ed8df 100644 --- a/cake/tests/fixtures/uuid_fixture.php +++ b/cake/tests/fixtures/uuid_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuid_tag_fixture.php b/cake/tests/fixtures/uuid_tag_fixture.php index 27834892c..8e6f9ff1a 100644 --- a/cake/tests/fixtures/uuid_tag_fixture.php +++ b/cake/tests/fixtures/uuid_tag_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuiditem_fixture.php b/cake/tests/fixtures/uuiditem_fixture.php index 787ef0698..606f919e3 100644 --- a/cake/tests/fixtures/uuiditem_fixture.php +++ b/cake/tests/fixtures/uuiditem_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuiditems_uuidportfolio_fixture.php b/cake/tests/fixtures/uuiditems_uuidportfolio_fixture.php index aba63c525..8707cd977 100644 --- a/cake/tests/fixtures/uuiditems_uuidportfolio_fixture.php +++ b/cake/tests/fixtures/uuiditems_uuidportfolio_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuiditems_uuidportfolio_numericid_fixture.php b/cake/tests/fixtures/uuiditems_uuidportfolio_numericid_fixture.php index a98ef7a5a..08f00f39b 100644 --- a/cake/tests/fixtures/uuiditems_uuidportfolio_numericid_fixture.php +++ b/cake/tests/fixtures/uuiditems_uuidportfolio_numericid_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/fixtures/uuidportfolio_fixture.php b/cake/tests/fixtures/uuidportfolio_fixture.php index cc1d9282d..686d9c5bd 100644 --- a/cake/tests/fixtures/uuidportfolio_fixture.php +++ b/cake/tests/fixtures/uuidportfolio_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/acl.group.php b/cake/tests/groups/acl.group.php index ffb8b924f..02232a3c9 100644 --- a/cake/tests/groups/acl.group.php +++ b/cake/tests/groups/acl.group.php @@ -2,8 +2,6 @@ /** * AclAndAuthGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/behaviors.group.php b/cake/tests/groups/behaviors.group.php index 4fe495a9a..f8bb3f508 100644 --- a/cake/tests/groups/behaviors.group.php +++ b/cake/tests/groups/behaviors.group.php @@ -2,8 +2,6 @@ /** * BehaviorsGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/cache.group.php b/cake/tests/groups/cache.group.php index 92a4b76ac..04fdf49cf 100644 --- a/cake/tests/groups/cache.group.php +++ b/cake/tests/groups/cache.group.php @@ -2,8 +2,6 @@ /** * CacheGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/components.group.php b/cake/tests/groups/components.group.php index cb9e3c86c..c953e7bf6 100644 --- a/cake/tests/groups/components.group.php +++ b/cake/tests/groups/components.group.php @@ -2,8 +2,6 @@ /** * ComponentsGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/configure.group.php b/cake/tests/groups/configure.group.php index dc0710ef2..077696ab5 100644 --- a/cake/tests/groups/configure.group.php +++ b/cake/tests/groups/configure.group.php @@ -2,8 +2,6 @@ /** * ConfigureGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/console.group.php b/cake/tests/groups/console.group.php index 4f632fbaf..85e069abb 100644 --- a/cake/tests/groups/console.group.php +++ b/cake/tests/groups/console.group.php @@ -2,8 +2,6 @@ /** * ConsoleGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/controller.group.php b/cake/tests/groups/controller.group.php index 8f1ca2f62..b912b0301 100644 --- a/cake/tests/groups/controller.group.php +++ b/cake/tests/groups/controller.group.php @@ -2,8 +2,6 @@ /** * ControllerGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/database.group.php b/cake/tests/groups/database.group.php index 77ffd3017..138339def 100644 --- a/cake/tests/groups/database.group.php +++ b/cake/tests/groups/database.group.php @@ -2,8 +2,6 @@ /** * DatabaseGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/helpers.group.php b/cake/tests/groups/helpers.group.php index 7450c5d0d..4281ef70d 100644 --- a/cake/tests/groups/helpers.group.php +++ b/cake/tests/groups/helpers.group.php @@ -2,8 +2,6 @@ /** * HelpersGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/i18n.group.php b/cake/tests/groups/i18n.group.php index 6035bff0a..03f7f6518 100644 --- a/cake/tests/groups/i18n.group.php +++ b/cake/tests/groups/i18n.group.php @@ -2,8 +2,6 @@ /** * i18nGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/lib.group.php b/cake/tests/groups/lib.group.php index 246e986fd..451b4618b 100644 --- a/cake/tests/groups/lib.group.php +++ b/cake/tests/groups/lib.group.php @@ -2,8 +2,6 @@ /** * LibGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/model.group.php b/cake/tests/groups/model.group.php index e092f2a2b..3fccbd3f8 100644 --- a/cake/tests/groups/model.group.php +++ b/cake/tests/groups/model.group.php @@ -2,8 +2,6 @@ /** * ModelGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/no_cross_contamination.group.php b/cake/tests/groups/no_cross_contamination.group.php index 88b99142a..c30272eee 100644 --- a/cake/tests/groups/no_cross_contamination.group.php +++ b/cake/tests/groups/no_cross_contamination.group.php @@ -2,8 +2,6 @@ /** * NoCrossContaminationGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/routing_system.group.php b/cake/tests/groups/routing_system.group.php index 81ff4822c..71fae5fb7 100644 --- a/cake/tests/groups/routing_system.group.php +++ b/cake/tests/groups/routing_system.group.php @@ -2,8 +2,6 @@ /** * RoutingSystemGroupTest * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/socket.group.php b/cake/tests/groups/socket.group.php index 9768bb60e..2d4f7fbf7 100644 --- a/cake/tests/groups/socket.group.php +++ b/cake/tests/groups/socket.group.php @@ -2,8 +2,6 @@ /** * Socket and HttpSocket Group tests * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/test_suite.group.php b/cake/tests/groups/test_suite.group.php index a2635165c..38472d917 100644 --- a/cake/tests/groups/test_suite.group.php +++ b/cake/tests/groups/test_suite.group.php @@ -2,8 +2,6 @@ /** * TestSuiteGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/view.group.php b/cake/tests/groups/view.group.php index af621082c..d5aecf47a 100644 --- a/cake/tests/groups/view.group.php +++ b/cake/tests/groups/view.group.php @@ -2,8 +2,6 @@ /** * ViewsGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/groups/xml.group.php b/cake/tests/groups/xml.group.php index a8095dff5..b9c8446f8 100644 --- a/cake/tests/groups/xml.group.php +++ b/cake/tests/groups/xml.group.php @@ -2,8 +2,6 @@ /** * XmlGroupTest file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/cake_reporter.php b/cake/tests/lib/cake_reporter.php index 234e8fc0b..7d396ad44 100644 --- a/cake/tests/lib/cake_reporter.php +++ b/cake/tests/lib/cake_reporter.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index 3983e84e3..9e4c6beed 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -2,8 +2,6 @@ /** * CakeTestCase file * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/cake_test_fixture.php b/cake/tests/lib/cake_test_fixture.php index c323f83cf..0225e722b 100644 --- a/cake/tests/lib/cake_test_fixture.php +++ b/cake/tests/lib/cake_test_fixture.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/cake_test_model.php b/cake/tests/lib/cake_test_model.php index 4a6de13f1..52ffd730f 100644 --- a/cake/tests/lib/cake_test_model.php +++ b/cake/tests/lib/cake_test_model.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/cli_reporter.php b/cake/tests/lib/cli_reporter.php index 557cdf08e..35c6c1df9 100644 --- a/cake/tests/lib/cli_reporter.php +++ b/cake/tests/lib/cli_reporter.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/content.php b/cake/tests/lib/content.php index 8c5fb389f..8fd087474 100644 --- a/cake/tests/lib/content.php +++ b/cake/tests/lib/content.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/footer.php b/cake/tests/lib/footer.php index aafdd3ca8..15cafdbfe 100644 --- a/cake/tests/lib/footer.php +++ b/cake/tests/lib/footer.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/header.php b/cake/tests/lib/header.php index 8b057cf03..ab521a69f 100644 --- a/cake/tests/lib/header.php +++ b/cake/tests/lib/header.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/simpletest.php b/cake/tests/lib/simpletest.php index 5ec71e559..74ef5a75b 100644 --- a/cake/tests/lib/simpletest.php +++ b/cake/tests/lib/simpletest.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index 2e727ef5b..1745469ed 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/lib/xdebug.php b/cake/tests/lib/xdebug.php index a33f69784..688d15f87 100644 --- a/cake/tests/lib/xdebug.php +++ b/cake/tests/lib/xdebug.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/controllers/tests_apps_controller.php b/cake/tests/test_app/controllers/tests_apps_controller.php index 19c77487d..e17949b9e 100644 --- a/cake/tests/test_app/controllers/tests_apps_controller.php +++ b/cake/tests/test_app/controllers/tests_apps_controller.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/controllers/tests_apps_posts_controller.php b/cake/tests/test_app/controllers/tests_apps_posts_controller.php index cc4a0518c..f7f3442b7 100644 --- a/cake/tests/test_app/controllers/tests_apps_posts_controller.php +++ b/cake/tests/test_app/controllers/tests_apps_posts_controller.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/plugin_js/webroot/js/one/plugin_one.js b/cake/tests/test_app/plugins/plugin_js/webroot/js/one/plugin_one.js new file mode 100644 index 000000000..03e21bb19 --- /dev/null +++ b/cake/tests/test_app/plugins/plugin_js/webroot/js/one/plugin_one.js @@ -0,0 +1 @@ +alert('plugin one nested js file'); \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/config/load.php b/cake/tests/test_app/plugins/test_plugin/config/load.php index 75c7e0bb2..6b2c14b53 100644 --- a/cake/tests/test_app/plugins/test_plugin/config/load.php +++ b/cake/tests/test_app/plugins/test_plugin/config/load.php @@ -2,8 +2,6 @@ /** * Test Suite TestPlugin config file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/config/more.load.php b/cake/tests/test_app/plugins/test_plugin/config/more.load.php index fe20ef087..edb955357 100644 --- a/cake/tests/test_app/plugins/test_plugin/config/more.load.php +++ b/cake/tests/test_app/plugins/test_plugin/config/more.load.php @@ -2,8 +2,6 @@ /** * Test Suite TestPlugin config file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php index 57ceada55..2dea34f9f 100644 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php index 90f6c8e7b..75a40537c 100644 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php index f920082ea..451b5c624 100644 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php index 1927a3544..9b1145f9e 100644 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php b/cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php index 7a1e001ac..c52ea02e2 100644 --- a/cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php b/cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php index d8a5114ea..887ed69e0 100644 --- a/cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php +++ b/cake/tests/test_app/plugins/test_plugin/libs/test_plugin_library.php @@ -2,8 +2,6 @@ /** * Test Suite TestPlugin Library * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php b/cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php index 9bf96719e..c77ce6906 100644 --- a/cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php +++ b/cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php @@ -2,8 +2,6 @@ /** * Test Suite TestPlugin AppController * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php b/cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php index a63dac31c..248008477 100644 --- a/cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php +++ b/cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php @@ -2,8 +2,6 @@ /** * Test Suite TestPlugin AppModel * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php b/cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php index 86b1c9376..fa4e10799 100644 --- a/cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php +++ b/cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/vendors/shells/example.php b/cake/tests/test_app/plugins/test_plugin/vendors/shells/example.php index 68757c166..095d6a684 100644 --- a/cake/tests/test_app/plugins/test_plugin/vendors/shells/example.php +++ b/cake/tests/test_app/plugins/test_plugin/vendors/shells/example.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/vendors/welcome.php b/cake/tests/test_app/plugins/test_plugin/vendors/welcome.php index 67ef5cec8..d8bffe821 100644 --- a/cake/tests/test_app/plugins/test_plugin/vendors/welcome.php +++ b/cake/tests/test_app/plugins/test_plugin/vendors/welcome.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/views/elements/plugin_element.ctp b/cake/tests/test_app/plugins/test_plugin/views/elements/plugin_element.ctp new file mode 100644 index 000000000..a05089228 --- /dev/null +++ b/cake/tests/test_app/plugins/test_plugin/views/elements/plugin_element.ctp @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/views/elements/test_plugin_element.ctp b/cake/tests/test_app/plugins/test_plugin/views/elements/test_plugin_element.ctp new file mode 100644 index 000000000..3e65a6789 --- /dev/null +++ b/cake/tests/test_app/plugins/test_plugin/views/elements/test_plugin_element.ctp @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php b/cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php index 7ebf08361..05fea8b66 100644 --- a/cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php +++ b/cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php b/cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php index f9a00ce6e..643fe821a 100644 --- a/cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php +++ b/cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/example.php b/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/example.php index e101094f3..eb0fdd2d4 100644 --- a/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/example.php +++ b/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/example.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/welcome.php b/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/welcome.php index e7c4f7740..34276f23c 100644 --- a/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/welcome.php +++ b/cake/tests/test_app/plugins/test_plugin_two/vendors/shells/welcome.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/Test/MyTest.php b/cake/tests/test_app/vendors/Test/MyTest.php index 0acacade6..e1d97b2e6 100644 --- a/cake/tests/test_app/vendors/Test/MyTest.php +++ b/cake/tests/test_app/vendors/Test/MyTest.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/Test/hello.php b/cake/tests/test_app/vendors/Test/hello.php index 27e5c82c1..1e46fb0fd 100644 --- a/cake/tests/test_app/vendors/Test/hello.php +++ b/cake/tests/test_app/vendors/Test/hello.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php b/cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php index 7ef258189..62634df82 100644 --- a/cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php +++ b/cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/shells/sample.php b/cake/tests/test_app/vendors/shells/sample.php index da4c67e7a..7c774e0a8 100644 --- a/cake/tests/test_app/vendors/shells/sample.php +++ b/cake/tests/test_app/vendors/shells/sample.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/somename/some.name.php b/cake/tests/test_app/vendors/somename/some.name.php index 3504025e5..d8ed18205 100644 --- a/cake/tests/test_app/vendors/somename/some.name.php +++ b/cake/tests/test_app/vendors/somename/some.name.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/vendors/welcome.php b/cake/tests/test_app/vendors/welcome.php index 7ec5f42dd..813ac6a54 100644 --- a/cake/tests/test_app/vendors/welcome.php +++ b/cake/tests/test_app/vendors/welcome.php @@ -2,8 +2,6 @@ /** * Short description for file. * - * Long description for file - * * PHP versions 4 and 5 * * CakePHP(tm) Tests diff --git a/cake/tests/test_app/plugins/test_plugin/views/themed/test_plugin_theme/layouts/default.ctp b/cake/tests/test_app/views/themed/test_theme/plugins/test_plugin/layouts/plugin_default.ctp similarity index 100% rename from cake/tests/test_app/plugins/test_plugin/views/themed/test_plugin_theme/layouts/default.ctp rename to cake/tests/test_app/views/themed/test_theme/plugins/test_plugin/layouts/plugin_default.ctp diff --git a/cake/tests/test_app/plugins/test_plugin/views/themed/test_plugin_theme/tests/index.ctp b/cake/tests/test_app/views/themed/test_theme/plugins/test_plugin/tests/index.ctp similarity index 100% rename from cake/tests/test_app/plugins/test_plugin/views/themed/test_plugin_theme/tests/index.ctp rename to cake/tests/test_app/views/themed/test_theme/plugins/test_plugin/tests/index.ctp diff --git a/cake/tests/test_app/views/themed/test_theme/webroot/css/theme_webroot.css b/cake/tests/test_app/views/themed/test_theme/webroot/css/theme_webroot.css new file mode 100644 index 000000000..12e29a565 --- /dev/null +++ b/cake/tests/test_app/views/themed/test_theme/webroot/css/theme_webroot.css @@ -0,0 +1 @@ +theme webroot css file \ No newline at end of file diff --git a/cake/tests/test_app/views/themed/test_theme/webroot/js/one/theme_one.js b/cake/tests/test_app/views/themed/test_theme/webroot/js/one/theme_one.js new file mode 100644 index 000000000..d29bcbc94 --- /dev/null +++ b/cake/tests/test_app/views/themed/test_theme/webroot/js/one/theme_one.js @@ -0,0 +1 @@ +nested theme js file \ No newline at end of file diff --git a/cake/tests/test_app/views/themed/test_theme/webroot/js/theme.js b/cake/tests/test_app/views/themed/test_theme/webroot/js/theme.js new file mode 100644 index 000000000..ec17940de --- /dev/null +++ b/cake/tests/test_app/views/themed/test_theme/webroot/js/theme.js @@ -0,0 +1 @@ +root theme js file \ No newline at end of file diff --git a/cake/tests/test_app/webroot/theme/test_theme/css/theme_webroot.css b/cake/tests/test_app/webroot/theme/test_theme/css/theme_webroot.css new file mode 100644 index 000000000..f65d3e08a --- /dev/null +++ b/cake/tests/test_app/webroot/theme/test_theme/css/theme_webroot.css @@ -0,0 +1 @@ +override the theme webroot css file \ No newline at end of file diff --git a/cake/tests/test_app/webroot/theme/test_theme/css/webroot_test.css b/cake/tests/test_app/webroot/theme/test_theme/css/webroot_test.css new file mode 100644 index 000000000..83c3bc4d7 --- /dev/null +++ b/cake/tests/test_app/webroot/theme/test_theme/css/webroot_test.css @@ -0,0 +1 @@ +this is the webroot test asset css file \ No newline at end of file diff --git a/cake/tests/test_app/webroot/theme/test_theme/img/cake.power.gif b/cake/tests/test_app/webroot/theme/test_theme/img/cake.power.gif new file mode 100644 index 000000000..8f8d570a2 Binary files /dev/null and b/cake/tests/test_app/webroot/theme/test_theme/img/cake.power.gif differ diff --git a/cake/tests/test_app/webroot/theme/test_theme/img/test.jpg b/cake/tests/test_app/webroot/theme/test_theme/img/test.jpg new file mode 100644 index 000000000..ca5197ae8 Binary files /dev/null and b/cake/tests/test_app/webroot/theme/test_theme/img/test.jpg differ