diff --git a/cake/console/libs/templates/skel/views/layouts/xml/default.ctp b/cake/console/libs/templates/skel/views/layouts/xml/default.ctp
new file mode 100644
index 000000000..566ca2158
--- /dev/null
+++ b/cake/console/libs/templates/skel/views/layouts/xml/default.ctp
@@ -0,0 +1,2 @@
+header(); ?>
+
\ No newline at end of file
diff --git a/cake/libs/cake_session.php b/cake/libs/cake_session.php
index 71e05a1cb..d118ef431 100644
--- a/cake/libs/cake_session.php
+++ b/cake/libs/cake_session.php
@@ -641,15 +641,15 @@ class CakeSession extends Object {
function __regenerateId() {
$oldSessionId = session_id();
if ($oldSessionId) {
- $sessionpath = session_save_path();
- if (empty($sessionpath)) {
- $sessionpath = "/tmp";
- }
- if (session_id() != "" || isset($_COOKIE[session_name()])) {
+ if (session_id() != ''|| isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
}
session_regenerate_id(true);
if (PHP_VERSION < 5.1) {
+ $sessionPath = session_save_path();
+ if (empty($sessionPath)) {
+ $sessionPath = '/tmp';
+ }
$newSessid = session_id();
if (function_exists('session_write_close')) {
@@ -659,7 +659,7 @@ class CakeSession extends Object {
session_id($oldSessionId);
session_start();
session_destroy();
- $file = $sessionpath . DS . "sess_$oldSessionId";
+ $file = $sessionPath . DS . 'sess_' . $oldSessionId;
@unlink($file);
$this->__initSession();
session_id($newSessid);
diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php
index 40ac1fe3f..d22c9d627 100644
--- a/cake/libs/controller/components/auth.php
+++ b/cake/libs/controller/components/auth.php
@@ -450,10 +450,10 @@ class AuthComponent extends Object {
return false;
}
$defaults = array(
- 'loginAction' => Router::normalize(array(
- 'controller'=> Inflector::underscore(Inflector::pluralize($this->userModel)),
+ 'loginAction' => array(
+ 'controller' => Inflector::underscore(Inflector::pluralize($this->userModel)),
'action' => 'login'
- )),
+ ),
'sessionKey' => 'Auth.' . $this->userModel,
'logoutRedirect' => $this->loginAction,
'loginError' => __('Login failed. Invalid username or password.', true),
diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php
index ebad2baa1..bd7b8e69a 100644
--- a/cake/libs/controller/controller.php
+++ b/cake/libs/controller/controller.php
@@ -74,6 +74,9 @@ class Controller extends Object {
*
* Example: var $uses = array('Product', 'Post', 'Comment');
*
+ * Can be set to array() to use no models. Can be set to false to
+ * use no models and prevent the merging of $uses with AppController
+ *
* @var mixed A single name as a string or a list of names as an array.
* @access protected
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php
index 1e4c47ee0..83fb14294 100644
--- a/cake/libs/debugger.php
+++ b/cake/libs/debugger.php
@@ -229,16 +229,8 @@ class Debugger extends Object {
*/
function log($var, $level = LOG_DEBUG) {
$_this = Debugger::getInstance();
- $trace = $_this->trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
- $source = null;
-
- if (is_object($trace[0]['object']) && isset($trace[0]['object']->_reporter->_test_stack)) {
- $stack = $trace[0]['object']->_reporter->_test_stack;
- $source = sprintf('[%1$s, %3$s::%2$s()]' . "\n",
- array_shift($stack), array_pop($stack), array_pop($stack));
- }
-
- CakeLog::write($level, $source . $_this->exportVar($var));
+ $source = $_this->trace(array('start' => 1)) . "\n";
+ CakeLog::write($level, "\n" . $source . $_this->exportVar($var));
}
/**
diff --git a/cake/libs/folder.php b/cake/libs/folder.php
index f36123ec4..69af1434d 100644
--- a/cake/libs/folder.php
+++ b/cake/libs/folder.php
@@ -326,7 +326,7 @@ class Folder extends Object {
* @static
*/
function addPathElement($path, $element) {
- return Folder::slashTerm($path) . $element;
+ return rtrim($path, DS) . DS . $element;
}
/**
diff --git a/cake/libs/http_socket.php b/cake/libs/http_socket.php
index 8367ce6b3..a31b89131 100644
--- a/cake/libs/http_socket.php
+++ b/cake/libs/http_socket.php
@@ -693,7 +693,7 @@ class HttpSocket extends CakeSocket {
foreach ($items as $item) {
if (strpos($item, '=') !== false) {
- list($key, $value) = explode('=', $item);
+ list($key, $value) = explode('=', $item, 2);
} else {
$key = $item;
$value = null;
diff --git a/cake/libs/model/behaviors/tree.php b/cake/libs/model/behaviors/tree.php
index c1d51bb85..0466ff224 100644
--- a/cake/libs/model/behaviors/tree.php
+++ b/cake/libs/model/behaviors/tree.php
@@ -474,7 +474,7 @@ class TreeBehavior extends ModelBehavior {
'fields' => array($Model->primaryKey, $left, $right), 'recursive' => $recursive)
);
if ($nextNode) {
- list($nextNode)= array_values($nextNode);
+ list($nextNode) = array_values($nextNode);
} else {
return false;
}
@@ -657,6 +657,8 @@ class TreeBehavior extends ModelBehavior {
$sort = $field . ' ' . $order;
$nodes = $this->children($Model, $id, true, $fields, $sort, null, null, $recursive);
+ $cacheQueries = $Model->cacheQueries;
+ $Model->cacheQueries = false;
if ($nodes) {
foreach ($nodes as $node) {
$id = $node[$Model->alias][$Model->primaryKey];
@@ -666,6 +668,7 @@ class TreeBehavior extends ModelBehavior {
}
}
}
+ $Model->cacheQueries = $cacheQueries;
return true;
}
diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php
index e94fa50a5..4ada77bff 100644
--- a/cake/libs/model/datasources/datasource.php
+++ b/cake/libs/model/datasources/datasource.php
@@ -320,45 +320,53 @@ class DataSource extends Object {
}
/**
+ * Used to create new records. The "C" CRUD.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $fields
- * @param unknown_type $values
- * @return unknown
+ * @param Model $model The Model to be created.
+ * @param array $fields An Array of fields to be saved.
+ * @param array $values An Array of values to save.
+ * @return boolean success
*/
function create(&$model, $fields = null, $values = null) {
return false;
}
/**
+ * Used to read records from the Datasource. The "R" in CRUD
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $queryData
- * @return unknown
+ * @param Model $model The model being read.
+ * @param array $queryData An array of query data used to find the data you want
+ * @return mixed
*/
function read(&$model, $queryData = array()) {
return false;
}
/**
+ * Update a record(s) in the datasource.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $fields
- * @param unknown_type $values
- * @return unknown
+ * @param Model $model Instance of the model class being updated
+ * @param array $fields Array of fields to be updated
+ * @param array $values Array of values to be update $fields to.
+ * @return boolean Success
*/
function update(&$model, $fields = null, $values = null) {
return false;
}
/**
+ * Delete a record(s) in the datasource.
+ *
* To-be-overridden in subclasses.
*
- * @param unknown_type $model
- * @param unknown_type $id
+ * @param Model $model The model class having record(s) deleted
+ * @param mixed $id Primary key of the model
*/
function delete(&$model, $id = null) {
if ($id == null) {
@@ -396,6 +404,16 @@ class DataSource extends Object {
return false;
}
+/**
+ * Check whether the conditions for the Datasource being available
+ * are satisfied. Often used from connect() to check for support
+ * before establishing a connection.
+ *
+ * @return boolean Whether or not the Datasources conditions for use are met.
+ **/
+ function enabled() {
+ return true;
+ }
/**
* Returns true if the DataSource supports the given interface (method)
*
diff --git a/cake/libs/model/datasources/dbo/dbo_adodb.php b/cake/libs/model/datasources/dbo/dbo_adodb.php
index a43581f8a..8e2931d8e 100644
--- a/cake/libs/model/datasources/dbo/dbo_adodb.php
+++ b/cake/libs/model/datasources/dbo/dbo_adodb.php
@@ -110,7 +110,9 @@ class DboAdodb extends DboSource {
$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);
@@ -123,6 +125,14 @@ class DboAdodb extends DboSource {
return $this->connected;
}
+/**
+ * Check that AdoDB is available.
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return function_exists('NewADOConnection');
+ }
/**
* Disconnects from database.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_db2.php b/cake/libs/model/datasources/dbo/dbo_db2.php
index 873fa8ec0..55b25010e 100644
--- a/cake/libs/model/datasources/dbo/dbo_db2.php
+++ b/cake/libs/model/datasources/dbo/dbo_db2.php
@@ -146,6 +146,14 @@ class DboDb2 extends DboSource {
return $this->connected;
}
+/**
+ * Check that the DB2 extension is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('ibm_db2');
+ }
/**
* Disconnects from database.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_firebird.php b/cake/libs/model/datasources/dbo/dbo_firebird.php
index faab0920d..4243097c8 100644
--- a/cake/libs/model/datasources/dbo/dbo_firebird.php
+++ b/cake/libs/model/datasources/dbo/dbo_firebird.php
@@ -140,10 +140,19 @@ class DboFirebird extends DboSource {
$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.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_mssql.php b/cake/libs/model/datasources/dbo/dbo_mssql.php
index de8db0a60..11c819d52 100644
--- a/cake/libs/model/datasources/dbo/dbo_mssql.php
+++ b/cake/libs/model/datasources/dbo/dbo_mssql.php
@@ -164,6 +164,14 @@ class DboMssql extends DboSource {
return $this->connected;
}
+/**
+ * Check that MsSQL is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('mssql');
+ }
/**
* Disconnects from database.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php
index 316edcc2c..86de93b10 100644
--- a/cake/libs/model/datasources/dbo/dbo_mysql.php
+++ b/cake/libs/model/datasources/dbo/dbo_mysql.php
@@ -118,6 +118,40 @@ class DboMysqlBase extends DboSource {
'boolean' => array('name' => 'tinyint', 'limit' => '1')
);
+/**
+ * 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('DESCRIBE ' . $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'] == 'YES' ? true : false),
+ 'default' => $column[0]['Default'],
+ 'length' => $this->length($column[0]['Type']),
+ );
+ if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
+ $fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
+ }
+ }
+ }
+ $this->__cacheDescription($this->fullTableName($model, false), $fields);
+ return $fields;
+ }
/**
* Generates and executes an SQL UPDATE statement for given model, fields, and values.
*
@@ -498,6 +532,14 @@ class DboMysql extends DboMysqlBase {
return $this->connected;
}
+/**
+ * Check whether the MySQL extension is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('mysql');
+ }
/**
* Disconnects from database.
*
@@ -547,52 +589,6 @@ class DboMysql extends DboMysqlBase {
}
}
-/**
- * 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('SHOW FULL COLUMNS FROM ' . $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'] == 'YES' ? true : false),
- 'default' => $column[0]['Default'],
- 'length' => $this->length($column[0]['Type']),
- );
- if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
- $fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
- }
- foreach ($this->fieldParameters as $name => $value) {
- if (!empty($column[0][$value['column']])) {
- $fields[$column[0]['Field']][$name] = $column[0][$value['column']];
- }
- }
- if (isset($fields[$column[0]['Field']]['collate'])) {
- $charset = $this->getCharsetName($fields[$column[0]['Field']]['collate']);
- if ($charset) {
- $fields[$column[0]['Field']]['charset'] = $charset;
- }
- }
- }
- }
- $this->__cacheDescription($this->fullTableName($model, false), $fields);
- return $fields;
- }
-
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_mysqli.php b/cake/libs/model/datasources/dbo/dbo_mysqli.php
index ec5f05fb3..6777dbca1 100644
--- a/cake/libs/model/datasources/dbo/dbo_mysqli.php
+++ b/cake/libs/model/datasources/dbo/dbo_mysqli.php
@@ -89,6 +89,14 @@ class DboMysqli extends DboMysqlBase {
return $this->connected;
}
+/**
+ * Check that MySQLi is installed/enabled
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('mysqli');
+ }
/**
* Disconnects from database.
*
@@ -159,44 +167,6 @@ class DboMysqli extends DboMysqlBase {
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('DESCRIBE ' . $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'] == 'YES' ? true : false),
- 'default' => $column[0]['Default'],
- 'length' => $this->length($column[0]['Type'])
- );
- if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
- $fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
- }
- }
- }
-
- $this->__cacheDescription($this->fullTableName($model, false), $fields);
- return $fields;
- }
-
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*
@@ -344,26 +314,6 @@ class DboMysqli extends DboMysqlBase {
return 'text';
}
-/**
- * Gets the length of a database-native column description, or null if no length
- *
- * @param string $real Real database-layer column type (i.e. "varchar(255)")
- * @return integer An integer representing the length of the column
- */
- function length($real) {
- $col = str_replace(array(')', 'unsigned'), '', $real);
- $limit = null;
-
- if (strpos($col, '(') !== false) {
- list($col, $limit) = explode('(', $col);
- }
-
- if ($limit != null) {
- return intval($limit);
- }
- return null;
- }
-
/**
* Enter description here...
*
diff --git a/cake/libs/model/datasources/dbo/dbo_odbc.php b/cake/libs/model/datasources/dbo/dbo_odbc.php
index e24daf7ce..9f73dd140 100644
--- a/cake/libs/model/datasources/dbo/dbo_odbc.php
+++ b/cake/libs/model/datasources/dbo/dbo_odbc.php
@@ -112,6 +112,14 @@ class DboOdbc extends DboSource {
return $this->connected;
}
+/**
+ * Check if the ODBC extension is installed/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('odbc');
+ }
/**
* Disconnects from database.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php
index d8787a018..0e6ac7be9 100644
--- a/cake/libs/model/datasources/dbo/dbo_postgres.php
+++ b/cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -129,6 +129,14 @@ class DboPostgres extends DboSource {
return $this->connected;
}
+/**
+ * Check if PostgreSQL is enabled/loaded
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('pgsql');
+ }
/**
* Disconnects from database.
*
@@ -289,6 +297,7 @@ class DboPostgres extends DboSource {
case 'date':
case 'datetime':
case 'timestamp':
+ case 'time':
if ($data === '') {
return $read ? 'NULL' : 'DEFAULT';
}
diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php
index 215542628..552096bec 100644
--- a/cake/libs/model/datasources/dbo/dbo_sqlite.php
+++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php
@@ -143,6 +143,14 @@ class DboSqlite extends DboSource {
return $this->connected;
}
+/**
+ * Check that SQLite is enabled/installed
+ *
+ * @return boolean
+ **/
+ function enabled() {
+ return extension_loaded('sqlite');
+ }
/**
* Disconnects from database.
*
diff --git a/cake/libs/model/datasources/dbo/dbo_sybase.php b/cake/libs/model/datasources/dbo/dbo_sybase.php
index db345ea08..7a56220aa 100644
--- a/cake/libs/model/datasources/dbo/dbo_sybase.php
+++ b/cake/libs/model/datasources/dbo/dbo_sybase.php
@@ -111,6 +111,14 @@ class DboSybase extends DboSource {
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.
*
diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php
index acb433063..46afa587d 100644
--- a/cake/libs/model/datasources/dbo_source.php
+++ b/cake/libs/model/datasources/dbo_source.php
@@ -116,7 +116,9 @@ class DboSource extends DataSource {
}
parent::__construct($config);
$this->fullDebug = Configure::read() > 1;
-
+ if (!$this->enabled()) {
+ return false;
+ }
if ($autoConnect) {
return $this->connect();
} else {
diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php
index 1da01dd44..af1af442d 100644
--- a/cake/libs/view/helpers/cache.php
+++ b/cake/libs/view/helpers/cache.php
@@ -81,15 +81,15 @@ class CacheHelper extends AppHelper {
$cacheTime = 0;
$useCallbacks = false;
if (is_array($this->cacheAction)) {
- $contoller = Inflector::underscore($this->controllerName);
+ $controller = Inflector::underscore($this->controllerName);
$check = str_replace('/', '_', $this->here);
$replace = str_replace('/', '_', $this->base);
$match = str_replace($this->base, '', $this->here);
$match = str_replace('//', '/', $match);
- $match = str_replace('/' . $contoller . '/', '', $match);
+ $match = str_replace('/' . $controller . '/', '', $match);
$match = str_replace('/' . $this->controllerName . '/', '', $match);
$check = str_replace($replace, '', $check);
- $check = str_replace('_' . $contoller . '_', '', $check);
+ $check = str_replace('_' . $controller . '_', '', $check);
$check = str_replace('_' . $this->controllerName . '_', '', $check);
$check = Inflector::slug($check);
$check = preg_replace('/^_+/', '', $check);
@@ -179,7 +179,6 @@ class CacheHelper extends AppHelper {
$outputResult = array_values($outputResult);
}
-
if (!empty($fileResult)) {
$i = 0;
foreach ($fileResult as $cacheBlock) {
@@ -202,24 +201,23 @@ class CacheHelper extends AppHelper {
function __parseOutput($cache) {
$count = 0;
if (!empty($this->__match)) {
-
foreach ($this->__match as $found) {
$original = $cache;
$length = strlen($found);
$position = 0;
- for ($i = 1; $i <= 1; $i++) {
- $position = strpos($cache, $found, $position);
+ for ($i = 1; $i <= 1; $i++) {
+ $position = strpos($cache, $found, $position);
- if ($position !== false) {
- $cache = substr($original, 0, $position);
- $cache .= $this->__replace[$count];
- $cache .= substr($original, $position + $length);
- } else {
- break;
- }
+ if ($position !== false) {
+ $cache = substr($original, 0, $position);
+ $cache .= $this->__replace[$count];
+ $cache .= substr($original, $position + $length);
+ } else {
+ break;
}
- $count++;
+ }
+ $count++;
}
return $cache;
}
@@ -301,5 +299,4 @@ class CacheHelper extends AppHelper {
return cache('views' . DS . $cache, $file, $timestamp);
}
}
-
?>
\ No newline at end of file
diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php
index 9bc47d633..d93f9748b 100755
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -772,9 +772,13 @@ class FormHelper extends AppHelper {
if ($label !== false) {
$labelAttributes = $this->domId(array(), 'for');
- if (in_array($options['type'], array('date', 'datetime'))) {
- $labelAttributes['for'] .= 'Month';
- } else if ($options['type'] === 'time') {
+ if ($options['type'] === 'date' || $options['type'] === 'datetime') {
+ if (isset($options['dateFormat']) && $options['dateFormat'] === 'NONE') {
+ $labelAttributes['for'] .= 'Hour';
+ } else {
+ $labelAttributes['for'] .= 'Month';
+ }
+ } elseif ($options['type'] === 'time') {
$labelAttributes['for'] .= 'Hour';
}
@@ -1816,7 +1820,7 @@ class FormHelper extends AppHelper {
}
if ($name !== null) {
- if ((!$selectedIsEmpty && $selected == $name) || ($selectedIsArray && in_array($name, $selected))) {
+ if ((!$selectedIsEmpty && (string)$selected == (string)$name) || ($selectedIsArray && in_array($name, $selected))) {
if ($attributes['style'] === 'checkbox') {
$htmlOptions['checked'] = true;
} else {
diff --git a/cake/libs/view/helpers/paginator.php b/cake/libs/view/helpers/paginator.php
index 1cc614532..3a71d0a66 100644
--- a/cake/libs/view/helpers/paginator.php
+++ b/cake/libs/view/helpers/paginator.php
@@ -250,11 +250,13 @@ class PaginatorHelper extends AppHelper {
}
/**
- * Generates a sorting link
+ * Generates a sorting link. Sets named parameters for the sort and direction. Handles
+ * direction switching automatically.
*
- * @param string $title Title for the link.
- * @param string $key The name of the key that the recordset should be sorted.
- * @param array $options Options for sorting link. See #options for list of keys.
+ * @param string $title Title for the link.
+ * @param string $key The name of the key that the recordset should be sorted. If $key is null
+ * $title will be used for the key, and a title will be generated by inflection.
+ * @param array $options Options for sorting link. See #options for list of keys.
* @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
* key the returned link will sort by 'desc'.
*/
diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php
index d4c84a0eb..a8cccb151 100644
--- a/cake/tests/cases/console/libs/tasks/model.test.php
+++ b/cake/tests/cases/console/libs/tasks/model.test.php
@@ -1,6 +1,7 @@
_debug = Configure::read('debug');
$this->Case =& new SubjectCakeTestCase();
$reporter =& new MockCakeHtmlReporter();
$this->Case->setReporter($reporter);
@@ -97,6 +98,7 @@ class CakeTestCaseTest extends CakeTestCase {
* @return void
*/
function tearDown() {
+ Configure::write('debug', $this->_debug);
unset($this->Case);
unset($this->Reporter);
}
diff --git a/cake/tests/cases/libs/controller/component.test.php b/cake/tests/cases/libs/controller/component.test.php
index 459ead972..067972e85 100644
--- a/cake/tests/cases/libs/controller/component.test.php
+++ b/cake/tests/cases/libs/controller/component.test.php
@@ -389,6 +389,7 @@ class ComponentTest extends CakeTestCase {
function testNestedComponentLoading() {
$Controller =& new ComponentTestController();
$Controller->components = array('Apple');
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@@ -409,6 +410,7 @@ class ComponentTest extends CakeTestCase {
function testComponentStartup() {
$Controller =& new ComponentTestController();
$Controller->components = array('Apple');
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$Controller->beforeFilter();
@@ -429,6 +431,7 @@ class ComponentTest extends CakeTestCase {
*/
function testMultipleComponentInitialize() {
$Controller =& new ComponentTestController();
+ $Controller->uses = false;
$Controller->components = array('Orange', 'Banana');
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@@ -450,7 +453,7 @@ class ComponentTest extends CakeTestCase {
$Controller =& new ComponentTestController();
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
-
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@@ -482,8 +485,12 @@ class ComponentTest extends CakeTestCase {
* @return void
**/
function testComponentParamsNoDuplication() {
+ if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
+ return;
+ }
$Controller =& new ComponentTestController();
$Controller->components = array('Orange' => array('setting' => array('itemx')));
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@@ -499,6 +506,7 @@ class ComponentTest extends CakeTestCase {
function testMutuallyReferencingComponents() {
$Controller =& new ComponentTestController();
$Controller->components = array('MutuallyReferencingOne');
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@@ -524,6 +532,7 @@ class ComponentTest extends CakeTestCase {
function testSomethingReferencingEmailComponent() {
$Controller =& new ComponentTestController();
$Controller->components = array('SomethingWithEmail');
+ $Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$Controller->beforeFilter();
@@ -550,14 +559,17 @@ class ComponentTest extends CakeTestCase {
* @access public
*/
function testDoubleLoadingOfSessionComponent() {
- $this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController');
+ if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
+ return;
+ }
$Controller =& new ComponentTestController();
- $Controller->uses = array();
+ $Controller->uses = false;
$Controller->components = array('Session');
$Controller->constructClasses();
$this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange')));
}
+
}
?>
\ No newline at end of file
diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php
index 7b2fc0444..965f2235d 100644
--- a/cake/tests/cases/libs/controller/components/security.test.php
+++ b/cake/tests/cases/libs/controller/components/security.test.php
@@ -222,6 +222,7 @@ class SecurityComponentTest extends CakeTestCase {
* @return void
*/
function testRequireSecureFail() {
+ $_SERVER['HTTPS'] = 'off';
$_SERVER['REQUEST_METHOD'] = 'POST';
$this->Controller->action = 'posted';
$this->Controller->Security->requireSecure('posted');
diff --git a/cake/tests/cases/libs/controller/controller_merge_vars.test.php b/cake/tests/cases/libs/controller/controller_merge_vars.test.php
index aec73d884..e7929f4ad 100644
--- a/cake/tests/cases/libs/controller/controller_merge_vars.test.php
+++ b/cake/tests/cases/libs/controller/controller_merge_vars.test.php
@@ -131,7 +131,14 @@ class MergePostsController extends MergeVarPluginAppController {
* @package cake.tests.cases.libs.controller
**/
class ControllerMergeVarsTestCase extends CakeTestCase {
-
+/**
+ * Skips the case if APP_CONTROLLER_EXISTS is defined
+ *
+ * @return void
+ **/
+ function skip() {
+ $this->skipIf(defined('APP_CONTROLLER_EXISTS'), 'APP_CONTROLLER_EXISTS cannot run. %s');
+ }
/**
* end test
*
diff --git a/cake/tests/cases/libs/debugger.test.php b/cake/tests/cases/libs/debugger.test.php
index f9c97e481..9ddcad781 100644
--- a/cake/tests/cases/libs/debugger.test.php
+++ b/cake/tests/cases/libs/debugger.test.php
@@ -286,6 +286,7 @@ class DebuggerTest extends CakeTestCase {
Debugger::log(array('whatever', 'here'));
$result = file_get_contents(TMP . 'logs' . DS . 'debug.log');
$this->assertPattern('/DebuggerTest\:\:testLog/', $result);
+ $this->assertPattern('/\[main\]/', $result);
$this->assertPattern('/array/', $result);
$this->assertPattern('/"whatever",/', $result);
$this->assertPattern('/"here"/', $result);
diff --git a/cake/tests/cases/libs/folder.test.php b/cake/tests/cases/libs/folder.test.php
index b778008cb..97e3ad500 100644
--- a/cake/tests/cases/libs/folder.test.php
+++ b/cake/tests/cases/libs/folder.test.php
@@ -219,6 +219,18 @@ class FolderTest extends CakeTestCase {
$this->assertTrue($result);
}
+/**
+ * test Adding path elements to a path
+ *
+ * @return void
+ **/
+ function testAddPathElement() {
+ $result = Folder::addPathElement(DS . 'some' . DS . 'dir', 'another_path');
+ $this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
+
+ $result = Folder::addPathElement(DS . 'some' . DS . 'dir' . DS, 'another_path');
+ $this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
+ }
/**
* testFolderRead method
*
diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php
index 6389823d4..1f58ab99c 100644
--- a/cake/tests/cases/libs/http_socket.test.php
+++ b/cake/tests/cases/libs/http_socket.test.php
@@ -1026,6 +1026,28 @@ class HttpSocketTest extends CakeTestCase {
'host' => 'www.google.com',
'port' => 8080,
));
+
+ $uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2%3Dvalue3');
+ $this->assertIdentical($uri, array(
+ 'scheme' => 'http',
+ 'host' => 'www.cakephp.org',
+ 'path' => '/',
+ 'query' => array(
+ 'param1' => 'value1',
+ 'param2' => 'value2=value3'
+ )
+ ));
+
+ $uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1¶m2=value2=value3');
+ $this->assertIdentical($uri, array(
+ 'scheme' => 'http',
+ 'host' => 'www.cakephp.org',
+ 'path' => '/',
+ 'query' => array(
+ 'param1' => 'value1',
+ 'param2' => 'value2=value3'
+ )
+ ));
}
/**
diff --git a/cake/tests/cases/libs/i18n.test.php b/cake/tests/cases/libs/i18n.test.php
index 3e849e07a..a32d205b3 100644
--- a/cake/tests/cases/libs/i18n.test.php
+++ b/cake/tests/cases/libs/i18n.test.php
@@ -2603,7 +2603,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
- function __domainCategorySingular($domain = 'test_plugin', $category = LC_MONETARY) {
+ function __domainCategorySingular($domain = 'test_plugin', $category = 3) {
$singular = __dc($domain, 'Plural Rule 1', $category, true);
return $singular;
}
@@ -2614,7 +2614,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
- function __domainCategoryPlural($domain = 'test_plugin', $category = LC_MONETARY) {
+ function __domainCategoryPlural($domain = 'test_plugin', $category = 3) {
$plurals = array();
for ($number = 0; $number <= 25; $number++) {
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category, true), (float)$number);
@@ -2653,7 +2653,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
- function __category($category = LC_MONETARY) {
+ function __category($category = 3) {
$singular = __c('Plural Rule 1', $category, true);
return $singular;
}
diff --git a/cake/tests/cases/libs/model/behaviors/tree.test.php b/cake/tests/cases/libs/model/behaviors/tree.test.php
index 6376e27a4..95322c314 100644
--- a/cake/tests/cases/libs/model/behaviors/tree.test.php
+++ b/cake/tests/cases/libs/model/behaviors/tree.test.php
@@ -1220,6 +1220,25 @@ class NumberTreeTest extends CakeTestCase {
$this->assertIdentical($nodes, $sortedNodes);
}
+/**
+ * test reordering large-ish trees with cacheQueries = true.
+ * This caused infinite loops when moving down elements as stale data is returned
+ * from the memory cache
+ *
+ * @access public
+ * @return void
+ */
+ function testReorderBigTreeWithQueryCaching() {
+ extract($this->settings);
+ $this->Tree =& new $modelClass();
+ $this->Tree->initialize(2, 10);
+
+ $original = $this->Tree->cacheQueries;
+ $this->Tree->cacheQueries = true;
+ $this->Tree->reorder(array('field' => 'name', 'direction' => 'DESC'));
+ $this->assertTrue($this->Tree->cacheQueries, 'cacheQueries was not restored after reorder(). %s');
+ $this->Tree->cacheQueries = $original;
+ }
/**
* testGenerateTreeListWithSelfJoin method
*
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 0159480cb..5b96b9790 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
@@ -161,7 +161,7 @@ class MysqlTestModel extends Model {
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqlTest extends CakeTestCase {
-
+ var $fixtures = array('core.binary_test');
/**
* The Dbo instance to be tested
*
@@ -187,7 +187,6 @@ class DboMysqlTest extends CakeTestCase {
*/
function startTest() {
$db = ConnectionManager::getDataSource('test_suite');
- $this->db = new DboMysqlTestDb($db->config);
$this->model = new MysqlTestModel();
}
@@ -196,8 +195,9 @@ class DboMysqlTest extends CakeTestCase {
*
* @access public
*/
- function endTest() {
- unset($this->db);
+ function tearDown() {
+ unset($this->model);
+ ClassRegistry::flush();
}
/**
@@ -285,11 +285,11 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testTinyintCasting() {
- $this->db->cacheSources = $this->db->testing = false;
+ $this->db->cacheSources = false;
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$this->model = new CakeTestModel(array(
- 'name' => 'Tinyint', 'table' => $this->db->fullTableName('tinyint', false)
+ 'name' => 'Tinyint', 'table' => 'tinyint', 'ds' => 'test_suite'
));
$result = $this->model->schema();
@@ -324,12 +324,12 @@ class DboMysqlTest extends CakeTestCase {
* @access public
*/
function testIndexDetection() {
- $this->db->cacheSources = $this->db->testing = false;
+ $this->db->cacheSources = false;
$name = $this->db->fullTableName('simple');
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$expected = array('PRIMARY' => array('column' => 'id', 'unique' => 1));
- $result = $this->db->index($name, false);
+ $result = $this->db->index('simple', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@@ -339,7 +339,7 @@ class DboMysqlTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
);
- $result = $this->db->index($name, false);
+ $result = $this->db->index('with_a_key', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@@ -350,7 +350,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
);
- $result = $this->db->index($name, false);
+ $result = $this->db->index('with_two_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@@ -362,7 +362,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
);
- $result = $this->db->index($name, false);
+ $result = $this->db->index('with_compound_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@@ -375,7 +375,7 @@ class DboMysqlTest extends CakeTestCase {
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
'other_way' => array('column' => array('small_int', 'bool'), 'unique' => 0),
);
- $result = $this->db->index($name, false);
+ $result = $this->db->index('with_multiple_compound_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
}
@@ -628,6 +628,24 @@ class DboMysqlTest extends CakeTestCase {
$this->db->query($this->db->dropSchema($schema1));
}
+/**
+ * test saving and retrieval of blobs
+ *
+ * @return void
+ **/
+ function testBlobSaving() {
+ $this->db->cacheSources = false;
+ $data = "GIF87ab
+ Ò 4A¿¿¿ˇˇˇ , b
+ ¢îè©ÀÌ#¥⁄ã≥fi:¯Ü‚Héá¶jV∂ÓúÎL≥çÀóËıÎ…>ï ≈ vFE%ÒâLFI<†µw˝±≈£7˘ç^H“≤«>Éâ*∑Ç nÖA•Ù|flêèj£:=ÿ6óUàµ5'∂®àA¬ñ∆ˆGE(gt’≈àÚyÁó«7 ‚VìöÇ√˙Ç™
+ k”:;kÀAõ{*¡€Î˚˚[ ;;";
+
+ $model =& new AppModel(array('name' => 'BinaryTest', 'ds' => 'test_suite'));
+ $model->save(compact('data'));
+
+ $result = $model->find('first');
+ $this->assertEqual($result['BinaryTest']['data'], $data);
+ }
/**
* test altering the table settings with schema.
diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
index eed93c09a..d9f8c0c62 100644
--- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
+++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
@@ -139,7 +139,7 @@ class MysqliTestModel extends Model {
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqliTest extends CakeTestCase {
-
+ var $fixtures = array('core.datatype');
/**
* The Dbo instance to be tested
*
@@ -164,8 +164,6 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function setUp() {
- $db = ConnectionManager::getDataSource('test_suite');
- $this->db = new DboMysqliTestDb($db->config);
$this->model = new MysqliTestModel();
}
@@ -175,7 +173,8 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function tearDown() {
- unset($this->db);
+ unset($this->model);
+ ClassRegistry::flush();
}
/**
@@ -185,7 +184,7 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function testIndexDetection() {
- $this->db->cacheSources = $this->db->testing = false;
+ $this->db->cacheSources = false;
$name = $this->db->fullTableName('simple');
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
@@ -306,6 +305,16 @@ class DboMysqliTest extends CakeTestCase {
$result = $this->db->commit($this->model);
$this->assertTrue($result);
}
+/**
+ * test that float values are correctly identified
+ *
+ * @return void
+ **/
+ function testFloatParsing() {
+ $model =& new Model(array('ds' => 'test_suite', 'table' => 'datatypes', 'name' => 'Datatype'));
+ $result = $this->db->describe($model);
+ $this->assertEqual((string)$result['float_field']['length'], '5,2');
+ }
/**
* test that tableParameters like collation, charset and engine are functioning.
diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
index 936a931e7..e13466ecb 100644
--- a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
+++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -315,11 +315,11 @@ class DboPostgresTest extends CakeTestCase {
}
/**
- * test that date columns do not generate errors with null and nullish values.
+ * test that date and time columns do not generate errors with null and nullish values.
*
* @return void
**/
- function testDateAsNull() {
+ function testDateAndTimeAsNull() {
$this->assertEqual($this->db2->value(null, 'date'), 'NULL');
$this->assertEqual($this->db2->value('', 'date'), 'NULL');
@@ -328,6 +328,9 @@ class DboPostgresTest extends CakeTestCase {
$this->assertEqual($this->db2->value('', 'timestamp'), 'NULL');
$this->assertEqual($this->db2->value(null, 'timestamp'), 'NULL');
+
+ $this->assertEqual($this->db2->value('', 'time'), 'NULL');
+ $this->assertEqual($this->db2->value(null, 'time'), 'NULL');
}
/**
diff --git a/cake/tests/cases/libs/multibyte.test.php b/cake/tests/cases/libs/multibyte.test.php
index 44f59d41b..64a75288a 100644
--- a/cake/tests/cases/libs/multibyte.test.php
+++ b/cake/tests/cases/libs/multibyte.test.php
@@ -4805,6 +4805,10 @@ class MultibyteTest extends CakeTestCase {
* @return void
*/
function testUsingMbStrrpos() {
+ $skip = extension_loaded('mbstring') && version_compare(PHP_VERSION, '5.2.0', '<');
+ if ($this->skipIf($skip, '%s PHP version does not support $offset parameter in mb_strrpos().')) {
+ return;
+ }
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$find = 'F';
$result = mb_strrpos($string, $find);
diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php
index 278c262dd..07edecf57 100644
--- a/cake/tests/cases/libs/validation.test.php
+++ b/cake/tests/cases/libs/validation.test.php
@@ -1641,6 +1641,10 @@ class ValidationTest extends CakeTestCase {
* @return void
*/
function testEmailDeep() {
+ $found = gethostbynamel('example.abcd');
+ if ($this->skipIf($found, 'Your DNS service responds for non-existant domains, skipping deep email checks. %s')) {
+ return;
+ }
$this->assertTrue(Validation::email('abc.efg@cakephp.org', true));
$this->assertFalse(Validation::email('abc.efg@caphpkeinvalid.com', true));
$this->assertFalse(Validation::email('abc@example.abcd', true));
diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php
index 9f022e980..231fee6f7 100644
--- a/cake/tests/cases/libs/view/helpers/form.test.php
+++ b/cake/tests/cases/libs/view/helpers/form.test.php
@@ -1591,50 +1591,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
- $result = $this->Form->input('email', array(
- 'options' => array('è' => 'Firést', 'é' => 'Secoènd'), 'empty' => true)
- );
- $expected = array(
- 'div' => array('class' => 'input select'),
- 'label' => array('for' => 'email'),
- 'Email',
- '/label',
- array('select' => array('name' => 'data[email]', 'id' => 'email')),
- array('option' => array('value' => '')),
- '/option',
- array('option' => array('value' => 'è')),
- 'Firést',
- '/option',
- array('option' => array('value' => 'é')),
- 'Secoènd',
- '/option',
- '/select',
- '/div'
- );
- $this->assertTags($result, $expected);
-
- $result = $this->Form->input('email', array(
- 'options' => array('First', 'Second'), 'empty' => true)
- );
- $expected = array(
- 'div' => array('class' => 'input select'),
- 'label' => array('for' => 'email'),
- 'Email',
- '/label',
- array('select' => array('name' => 'data[email]', 'id' => 'email')),
- array('option' => array('value' => '')),
- '/option',
- array('option' => array('value' => '0')),
- 'First',
- '/option',
- array('option' => array('value' => '1')),
- 'Second',
- '/option',
- '/select',
- '/div'
- );
- $this->assertTags($result, $expected);
-
$result = $this->Form->input('Contact.email', array(
'type' => 'file', 'class' => 'textbox'
));
@@ -1651,84 +1607,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
- $result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
- $result = explode(':', $result);
- $this->assertPattern('/option value="23"/', $result[0]);
- $this->assertNoPattern('/option value="24"/', $result[0]);
-
- $result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
- $result = explode(':', $result);
- $this->assertPattern('/option value="23"/', $result[0]);
- $this->assertNoPattern('/option value="24"/', $result[0]);
-
- $result = $this->Form->input('Model.field', array(
- 'type' => 'time', 'timeFormat' => 24, 'interval' => 15
- ));
- $result = explode(':', $result);
- $this->assertNoPattern('##', $result[1]);
- $this->assertNoPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
-
- $result = $this->Form->input('Model.field', array(
- 'type' => 'time', 'timeFormat' => 12, 'interval' => 15
- ));
- $result = explode(':', $result);
- $this->assertNoPattern('##', $result[1]);
- $this->assertNoPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
-
- $result = $this->Form->input('prueba', array(
- 'type' => 'time', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
- 'maxYear' => date('Y') + 1 ,'interval' => 15
- ));
- $result = explode(':', $result);
- $this->assertNoPattern('##', $result[1]);
- $this->assertNoPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
-
- $result = $this->Form->input('prueba', array(
- 'type' => 'datetime', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
- 'maxYear' => date('Y') + 1 ,'interval' => 15
- ));
- $result = explode(':', $result);
- $this->assertNoPattern('##', $result[1]);
- $this->assertNoPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
- $this->assertPattern('##', $result[1]);
-
- //related to ticket #5013
- $result = $this->Form->input('Contact.date', array(
- 'type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'
- ));
- $this->assertPattern('/class="customClass"/', $result);
- $this->assertPattern('/onChange="function\(\)\{\}"/', $result);
-
- $result = $this->Form->input('Contact.date', array(
- 'type' => 'date', 'id' => 'customId', 'onChange' => 'function(){}'
- ));
- $this->assertPattern('/id="customIdDay"/', $result);
- $this->assertPattern('/id="customIdMonth"/', $result);
- $this->assertPattern('/onChange="function\(\)\{\}"/', $result);
-
- $result = $this->Form->input('Model.field', array(
- 'type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'
- ));
- $this->assertPattern('/id="customIDDay"/', $result);
- $this->assertPattern('/id="customIDHour"/', $result);
- $result = explode('