mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Merge branch '1.3' into 1.3-bake
This commit is contained in:
commit
d61e8736e4
71 changed files with 1067 additions and 415 deletions
|
@ -44,8 +44,8 @@
|
||||||
/**
|
/**
|
||||||
* As of 1.3, additional rules for the inflector are added below
|
* As of 1.3, additional rules for the inflector are added below
|
||||||
*
|
*
|
||||||
* Inflector::rule('singular', array('rules' => array(), irregular' => array(), 'uninflected' => array()));
|
* Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
|
||||||
* Inflector::rule('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
|
* Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
|
@ -89,6 +89,7 @@ if (!function_exists('clone')) {
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @param string $name Filename without the .php part
|
* @param string $name Filename without the .php part
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function uses() {
|
function uses() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/php -q
|
#!/usr/bin/php -q
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command-line code generation utility to automate programmer chores.
|
* Command-line code generation utility to automate programmer chores.
|
||||||
*
|
*
|
||||||
|
@ -26,7 +24,9 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
if (!defined('E_DEPRECATED')) {
|
||||||
|
define('E_DEPRECATED', 8192);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Shell dispatcher
|
* Shell dispatcher
|
||||||
*
|
*
|
||||||
|
|
|
@ -137,52 +137,29 @@ class AclShell extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function create() {
|
function create() {
|
||||||
|
|
||||||
$this->_checkArgs(3, 'create');
|
$this->_checkArgs(3, 'create');
|
||||||
$this->checkNodeType();
|
$this->checkNodeType();
|
||||||
extract($this->__dataVars());
|
extract($this->__dataVars());
|
||||||
|
|
||||||
$class = ucfirst($this->args[0]);
|
$class = ucfirst($this->args[0]);
|
||||||
$object = new $class();
|
$parent = $this->parseIdentifier($this->args[1]);
|
||||||
|
|
||||||
if (preg_match('/^([\w]+)\.(.*)$/', $this->args[1], $matches) && count($matches) == 3) {
|
|
||||||
$parent = array(
|
|
||||||
'model' => $matches[1],
|
|
||||||
'foreign_key' => $matches[2],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$parent = $this->args[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($parent) && $parent != '/' && $parent != 'root') {
|
if (!empty($parent) && $parent != '/' && $parent != 'root') {
|
||||||
@$parent = $object->node($parent);
|
$parent = $this->_getNodeId($class, $parent);
|
||||||
if (empty($parent)) {
|
|
||||||
$this->err(sprintf(__('Could not find parent node using reference "%s"', true), $this->args[1]));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
$parent = Set::extract($parent, "0.{$class}.id");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$parent = null;
|
$parent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^([\w]+)\.(.*)$/', $this->args[2], $matches) && count($matches) == 3) {
|
$data = $this->parseIdentifier($this->args[2]);
|
||||||
$data = array(
|
if (is_string($data) && $data != '/') {
|
||||||
'model' => $matches[1],
|
$data = array('alias' => $data);
|
||||||
'foreign_key' => $matches[2],
|
} elseif (is_string($data)) {
|
||||||
);
|
$this->error(__('/ can not be used as an alias!', true), __("\t/ is the root, please supply a sub alias", true));
|
||||||
} else {
|
|
||||||
if (!($this->args[2] == '/')) {
|
|
||||||
$data = array('alias' => $this->args[2]);
|
|
||||||
} else {
|
|
||||||
$this->error(__('/ can not be used as an alias!', true), __('\t/ is the root, please supply a sub alias', true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['parent_id'] = $parent;
|
$data['parent_id'] = $parent;
|
||||||
$object->create();
|
$this->Acl->{$class}->create();
|
||||||
|
if ($this->Acl->{$class}->save($data)) {
|
||||||
if ($object->save($data)) {
|
|
||||||
$this->out(sprintf(__("New %s '%s' created.\n", true), $class, $this->args[2]), true);
|
$this->out(sprintf(__("New %s '%s' created.\n", true), $class, $this->args[2]), true);
|
||||||
} else {
|
} else {
|
||||||
$this->err(sprintf(__("There was a problem creating a new %s '%s'.", true), $class, $this->args[2]));
|
$this->err(sprintf(__("There was a problem creating a new %s '%s'.", true), $class, $this->args[2]));
|
||||||
|
@ -198,7 +175,11 @@ class AclShell extends Shell {
|
||||||
$this->_checkArgs(2, 'delete');
|
$this->_checkArgs(2, 'delete');
|
||||||
$this->checkNodeType();
|
$this->checkNodeType();
|
||||||
extract($this->__dataVars());
|
extract($this->__dataVars());
|
||||||
if (!$this->Acl->{$class}->delete($this->args[1])) {
|
|
||||||
|
$identifier = $this->parseIdentifier($this->args[1]);
|
||||||
|
$nodeId = $this->_getNodeId($class, $identifier);
|
||||||
|
|
||||||
|
if (!$this->Acl->{$class}->delete($nodeId)) {
|
||||||
$this->error(__("Node Not Deleted", true), sprintf(__("There was an error deleting the %s. Check that the node exists", true), $class) . ".\n");
|
$this->error(__("Node Not Deleted", true), sprintf(__("There was an error deleting the %s. Check that the node exists", true), $class) . ".\n");
|
||||||
}
|
}
|
||||||
$this->out(sprintf(__("%s deleted", true), $class) . ".\n", true);
|
$this->out(sprintf(__("%s deleted", true), $class) . ".\n", true);
|
||||||
|
@ -213,10 +194,13 @@ class AclShell extends Shell {
|
||||||
$this->_checkArgs(3, 'setParent');
|
$this->_checkArgs(3, 'setParent');
|
||||||
$this->checkNodeType();
|
$this->checkNodeType();
|
||||||
extract($this->__dataVars());
|
extract($this->__dataVars());
|
||||||
|
$target = $this->parseIdentifier($this->args[1]);
|
||||||
|
$parent = $this->parseIdentifier($this->args[2]);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
$class => array(
|
$class => array(
|
||||||
'id' => $this->args[1],
|
'id' => $this->_getNodeId($class, $target),
|
||||||
'parent_id' => $this->args[2]
|
'parent_id' => $this->_getNodeId($class, $parent)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->Acl->{$class}->create();
|
$this->Acl->{$class}->create();
|
||||||
|
@ -378,64 +362,81 @@ class AclShell extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function help() {
|
function help() {
|
||||||
$head = __("Usage: cake acl <command> <arg1> <arg2>...", true) . "\n";
|
$head = "-----------------------------------------------\n";
|
||||||
|
$head .= __("Usage: cake acl <command> <arg1> <arg2>...", true) . "\n";
|
||||||
$head .= "-----------------------------------------------\n";
|
$head .= "-----------------------------------------------\n";
|
||||||
$head .= __("Commands:", true) . "\n\n";
|
$head .= __("Commands:", true) . "\n";
|
||||||
|
|
||||||
$commands = array(
|
$commands = array(
|
||||||
'create' => "\tcreate aro|aco <parent> <node>\n" .
|
'create' => "create aro|aco <parent> <node>\n" .
|
||||||
"\t\t" . __("Creates a new ACL object <node> under the parent specified by <parent>, an id/alias.", true) . "\n" .
|
"\t" . __("Creates a new ACL object <node> under the parent", true) . "\n" .
|
||||||
"\t\t" . __("The <parent> and <node> references can be in one of the following formats:", true) . "\n" .
|
"\t" . __("specified by <parent>, an id/alias.", true) . "\n" .
|
||||||
"\t\t\t- " . __("<model>.<id> - The node will be bound to a specific record of the given model", true) . "\n" .
|
"\t" . __("The <parent> and <node> references can be", true) . "\n" .
|
||||||
"\t\t\t- " . __("<alias> - The node will be given a string alias (or path, in the case of <parent>),", true) . "\n" .
|
"\t" . __("in one of the following formats:", true) . "\n\n" .
|
||||||
"\t\t\t " . __("i.e. 'John'. When used with <parent>, this takes the form of an alias path,", true) . "\n" .
|
"\t\t- " . __("<model>.<id> - The node will be bound to a", true) . "\n" .
|
||||||
"\t\t\t " . __("i.e. <group>/<subgroup>/<parent>.", true) . "\n" .
|
"\t\t" . __("specific record of the given model.", true) . "\n\n" .
|
||||||
"\t\t" . __("To add a node at the root level, enter 'root' or '/' as the <parent> parameter.", true) . "\n",
|
"\t\t- " . __("<alias> - The node will be given a string alias,", true) . "\n" .
|
||||||
|
"\t\t" . __(" (or path, in the case of <parent>)", true) . "\n" .
|
||||||
|
"\t\t " . __("i.e. 'John'. When used with <parent>,", true) . "\n" .
|
||||||
|
"\t\t" . __("this takes the form of an alias path,", true) . "\n" .
|
||||||
|
"\t\t " . __("i.e. <group>/<subgroup>/<parent>.", true) . "\n\n" .
|
||||||
|
"\t" . __("To add a node at the root level,", true) . "\n" .
|
||||||
|
"\t" . __("enter 'root' or '/' as the <parent> parameter.", true) . "\n",
|
||||||
|
|
||||||
'delete' => "\tdelete aro|aco <node>\n" .
|
'delete' => "delete aro|aco <node>\n" .
|
||||||
"\t\t" . __("Deletes the ACL object with the given <node> reference (see 'create' for info on node references).", true) . "\n",
|
"\t" . __("Deletes the ACL object with the given <node> reference", true) . "\n" .
|
||||||
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'setparent' => "\tsetParent aro|aco <node> <parent>\n" .
|
'setparent' => "setParent aro|aco <node> <parent>\n" .
|
||||||
"\t\t" . __("Moves the ACL object specified by <node> beneath the parent ACL object specified by <parent>.", true) . "\n" .
|
"\t" . __("Moves the ACL object specified by <node> beneath", true) . "\n" .
|
||||||
"\t\t" . __("To identify the node and parent, use the row id.", true) . "\n",
|
"\t" . __("the parent ACL object specified by <parent>.", true) . "\n" .
|
||||||
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'getpath' => "\tgetPath aro|aco <node>\n" .
|
'getpath' => "getPath aro|aco <node>\n" .
|
||||||
"\t\t" . __("Returns the path to the ACL object specified by <node>. This command", true) . "\n" .
|
"\t" . __("Returns the path to the ACL object specified by <node>. This command", true) . "\n" .
|
||||||
"\t\t" . __("is useful in determining the inhertiance of permissions for a certain", true) . "\n" .
|
"\t" . __("is useful in determining the inhertiance of permissions for a certain", true) . "\n" .
|
||||||
"\t\t" . __("object in the tree.", true) . "\n" .
|
"\t" . __("object in the tree.", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'check' => "\tcheck <aro_id> <aco_id> [<aco_action>] " . __("or", true) . " all\n" .
|
'check' => "check <aro_id> <aco_id> [<aco_action>] " . __("or", true) . " all\n" .
|
||||||
"\t\t" . __("Use this command to check ACL permissions.", true) . "\n" .
|
"\t" . __("Use this command to check ACL permissions.", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'grant' => "\tgrant <aro_id> <aco_id> [<aco_action>] " . __("or", true) . " all\n" .
|
'grant' => "grant <aro_id> <aco_id> [<aco_action>] " . __("or", true) . " all\n" .
|
||||||
"\t\t" . __("Use this command to grant ACL permissions. Once executed, the ARO", true) . "\n" .
|
"\t" . __("Use this command to grant ACL permissions. Once executed, the ARO", true) . "\n" .
|
||||||
"\t\t" . __("specified (and its children, if any) will have ALLOW access to the", true) . "\n" .
|
"\t" . __("specified (and its children, if any) will have ALLOW access to the", true) . "\n" .
|
||||||
"\t\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" .
|
"\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'deny' => "\tdeny <aro_id> <aco_id> [<aco_action>]" . __("or", true) . " all\n" .
|
'deny' => "deny <aro_id> <aco_id> [<aco_action>]" . __("or", true) . " all\n" .
|
||||||
"\t\t" . __("Use this command to deny ACL permissions. Once executed, the ARO", true) . "\n" .
|
"\t" . __("Use this command to deny ACL permissions. Once executed, the ARO", true) . "\n" .
|
||||||
"\t\t" . __("specified (and its children, if any) will have DENY access to the", true) . "\n" .
|
"\t" . __("specified (and its children, if any) will have DENY access to the", true) . "\n" .
|
||||||
"\t\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" .
|
"\t" . __("specified ACO action (and the ACO's children, if any).", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'inherit' => "\tinherit <aro_id> <aco_id> [<aco_action>]" . __("or", true) . " all\n" .
|
'inherit' => "inherit <aro_id> <aco_id> [<aco_action>]" . __("or", true) . " all\n" .
|
||||||
"\t\t" . __("Use this command to force a child ARO object to inherit its", true) . "\n" .
|
"\t" . __("Use this command to force a child ARO object to inherit its", true) . "\n" .
|
||||||
"\t\t" . __("permissions settings from its parent.", true) . "\n" .
|
"\t" . __("permissions settings from its parent.", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'view' => "\tview aro|aco [<node>]\n" .
|
'view' => "view aro|aco [<node>]\n" .
|
||||||
"\t\t" . __("The view command will return the ARO or ACO tree. The optional", true) . "\n" .
|
"\t" . __("The view command will return the ARO or ACO tree.", true) . "\n" .
|
||||||
"\t\t" . __("id/alias parameter allows you to return only a portion of the requested tree.", true) . "\n" .
|
"\t" . __("The optional id/alias parameter allows you to return\n\tonly a portion of the requested tree.", true) . "\n" .
|
||||||
"\t\t" . __("For more detailed parameter usage info, see help for the 'create' command.", true) . "\n",
|
"\t" . __("For more detailed parameter usage info,", true) . "\n" .
|
||||||
|
"\t" . __("see help for the 'create' command.", true),
|
||||||
|
|
||||||
'initdb' => "\tinitdb\n".
|
'initdb' => "initdb\n".
|
||||||
"\t\t" . __("Uses this command : cake schema run create DbAcl", true) . "\n",
|
"\t" . __("Uses this command : cake schema run create DbAcl", true),
|
||||||
|
|
||||||
'help' => "\thelp [<command>]\n" .
|
'help' => "help [<command>]\n" .
|
||||||
"\t\t" . __("Displays this help message, or a message on a specific command.", true) . "\n"
|
"\t" . __("Displays this help message, or a message on a specific command.", true)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->out($head);
|
$this->out($head);
|
||||||
|
@ -443,8 +444,8 @@ class AclShell extends Shell {
|
||||||
foreach ($commands as $cmd) {
|
foreach ($commands as $cmd) {
|
||||||
$this->out("{$cmd}\n\n");
|
$this->out("{$cmd}\n\n");
|
||||||
}
|
}
|
||||||
} elseif (isset($commands[low($this->args[0])])) {
|
} elseif (isset($commands[strtolower($this->args[0])])) {
|
||||||
$this->out($commands[low($this->args[0])] . "\n\n");
|
$this->out($commands[strtolower($this->args[0])] . "\n\n");
|
||||||
} else {
|
} else {
|
||||||
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0]));
|
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0]));
|
||||||
}
|
}
|
||||||
|
@ -477,7 +478,7 @@ class AclShell extends Shell {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
extract($this->__dataVars($this->args[0]));
|
extract($this->__dataVars($this->args[0]));
|
||||||
$key = (ife(is_numeric($this->args[1]), $secondary_id, 'alias'));
|
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
|
||||||
$conditions = array($class . '.' . $key => $this->args[1]);
|
$conditions = array($class . '.' . $key => $this->args[1]);
|
||||||
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
|
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
|
||||||
if (empty($possibility)) {
|
if (empty($possibility)) {
|
||||||
|
@ -486,6 +487,42 @@ class AclShell extends Shell {
|
||||||
return $possibility;
|
return $possibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse an identifier into Model.foriegnKey or an alias.
|
||||||
|
* Takes an identifier determines its type and returns the result as used by other methods.
|
||||||
|
*
|
||||||
|
* @param string $identifier Identifier to parse
|
||||||
|
* @return mixed a string for aliases, and an array for model.foreignKey
|
||||||
|
**/
|
||||||
|
function parseIdentifier($identifier) {
|
||||||
|
if (preg_match('/^([\w]+)\.(.*)$/', $identifier, $matches)) {
|
||||||
|
return array(
|
||||||
|
'model' => $matches[1],
|
||||||
|
'foreign_key' => $matches[2],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the node for a given identifier. $identifier can either be a string alias
|
||||||
|
* or an array of properties to use in AcoNode::node()
|
||||||
|
*
|
||||||
|
* @param string $class Class type you want (Aro/Aco)
|
||||||
|
* @param mixed $identifier A mixed identifier for finding the node.
|
||||||
|
* @return int Integer of NodeId. Will trigger an error if nothing is found.
|
||||||
|
**/
|
||||||
|
function _getNodeId($class, $identifier) {
|
||||||
|
$node = $this->Acl->{$class}->node($identifier);
|
||||||
|
if (empty($node)) {
|
||||||
|
if (is_array($identifier)) {
|
||||||
|
$identifier = var_export($identifier, true);
|
||||||
|
}
|
||||||
|
$this->error(sprintf(__('Could not find node using reference "%s"', true), $identifier));
|
||||||
|
}
|
||||||
|
return Set::extract($node, "0.{$class}.id");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get params for standard Acl methods
|
* get params for standard Acl methods
|
||||||
*
|
*
|
||||||
|
@ -533,7 +570,7 @@ class AclShell extends Shell {
|
||||||
}
|
}
|
||||||
$vars = array();
|
$vars = array();
|
||||||
$class = ucwords($type);
|
$class = ucwords($type);
|
||||||
$vars['secondary_id'] = ife(strtolower($class) == 'aro', 'foreign_key', 'object_id');
|
$vars['secondary_id'] = (strtolower($class) == 'aro') ? 'foreign_key' : 'object_id';
|
||||||
$vars['data_name'] = $type;
|
$vars['data_name'] = $type;
|
||||||
$vars['table_name'] = $type . 's';
|
$vars['table_name'] = $type . 's';
|
||||||
$vars['class'] = $class;
|
$vars['class'] = $class;
|
||||||
|
|
|
@ -475,7 +475,7 @@ class Shell extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
uses('file');
|
require LIBS . 'file.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($File = new File($path, true)) {
|
if ($File = new File($path, true)) {
|
||||||
|
|
|
@ -200,7 +200,7 @@ class ProjectTask extends Shell {
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
|
||||||
if (!class_exists('Security')) {
|
if (!class_exists('Security')) {
|
||||||
uses('Security');
|
require LIBS . 'security.php';
|
||||||
}
|
}
|
||||||
$string = Security::generateAuthKey();
|
$string = Security::generateAuthKey();
|
||||||
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents);
|
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents);
|
||||||
|
|
|
@ -52,7 +52,9 @@ endif;
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if (!empty(\$filePresent)):
|
if (!empty(\$filePresent)):
|
||||||
uses('model' . DS . 'connection_manager');
|
if (!class_exists('ConnectionManager')) {
|
||||||
|
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||||
|
}
|
||||||
\$db = ConnectionManager::getInstance();
|
\$db = ConnectionManager::getInstance();
|
||||||
\$connected = \$db->getDataSource('default');
|
\$connected = \$db->getDataSource('default');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
<?php echo $html->charset(); ?>
|
<?php echo $html->charset(); ?>
|
||||||
<title><?php echo $page_title; ?></title>
|
<title><?php echo $page_title; ?></title>
|
||||||
|
|
||||||
|
|
||||||
<?php if (Configure::read() == 0) { ?>
|
<?php if (Configure::read() == 0) { ?>
|
||||||
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>"/>
|
<meta http-equiv="Refresh" content="<?php echo $pause?>;url=<?php echo $url?>"/>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -34,7 +34,7 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
*/
|
*/
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
uses('file');
|
require LIBS . 'file.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -219,7 +219,7 @@ class DbAcl extends AclBase {
|
||||||
function __construct() {
|
function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
if (!class_exists('AclNode')) {
|
if (!class_exists('AclNode')) {
|
||||||
uses('model' . DS . 'db_acl');
|
require LIBS . 'model' . DS . 'db_acl.php';
|
||||||
}
|
}
|
||||||
$this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
|
$this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
|
||||||
$this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));
|
$this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));
|
||||||
|
|
|
@ -165,7 +165,6 @@ class Debugger extends Object {
|
||||||
$this->_templates['js']['code'] = '<div id="{:id}-code" class="cake-code-dump" ';
|
$this->_templates['js']['code'] = '<div id="{:id}-code" class="cake-code-dump" ';
|
||||||
$this->_templates['js']['code'] .= 'style="display: none;"><pre>{:code}</pre></div>';
|
$this->_templates['js']['code'] .= 'style="display: none;"><pre>{:code}</pre></div>';
|
||||||
|
|
||||||
|
|
||||||
$e = '<pre class="cake-debug"><b>{:error}</b> ({:code}) : {:description} ';
|
$e = '<pre class="cake-debug"><b>{:error}</b> ({:code}) : {:description} ';
|
||||||
$e .= '[<b>{:path}</b>, line <b>{:line}]</b></pre>';
|
$e .= '[<b>{:path}</b>, line <b>{:line}]</b></pre>';
|
||||||
$this->_templates['html']['error'] = $e;
|
$this->_templates['html']['error'] = $e;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!class_exists('Object')) {
|
if (!class_exists('Object')) {
|
||||||
uses('object');
|
require LIBS . 'object.php';
|
||||||
}
|
}
|
||||||
if (!class_exists('Folder')) {
|
if (!class_exists('Folder')) {
|
||||||
require LIBS . 'folder.php';
|
require LIBS . 'folder.php';
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!class_exists('Object')) {
|
if (!class_exists('Object')) {
|
||||||
uses('object');
|
require LIBS . 'object.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -877,9 +877,16 @@ class HttpSocket extends CakeSocket {
|
||||||
|
|
||||||
$cookies = array();
|
$cookies = array();
|
||||||
foreach ((array)$header['Set-Cookie'] as $cookie) {
|
foreach ((array)$header['Set-Cookie'] as $cookie) {
|
||||||
$parts = preg_split('/(?<![^;]");[ \t]*/', $cookie);
|
if (strpos($cookie, '";"') !== false) {
|
||||||
|
$cookie = str_replace('";"', "{__cookie_replace__}", $cookie);
|
||||||
|
$parts = str_replace("{__cookie_replace__}", '";"', preg_split('/\;/', $cookie));
|
||||||
|
} else {
|
||||||
|
$parts = preg_split('/\;[ \t]*/', $cookie);
|
||||||
|
}
|
||||||
|
|
||||||
list($name, $value) = explode('=', array_shift($parts), 2);
|
list($name, $value) = explode('=', array_shift($parts), 2);
|
||||||
$cookies[$name] = compact('value');
|
$cookies[$name] = compact('value');
|
||||||
|
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if (strpos($part, '=') !== false) {
|
if (strpos($part, '=') !== false) {
|
||||||
list($key, $value) = explode('=', $part);
|
list($key, $value) = explode('=', $part);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class Inflector extends Object {
|
||||||
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
|
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
|
||||||
'/([ftw]ax)es/' => '\1',
|
'/([ftw]ax)es/' => '\1',
|
||||||
'/(cris|ax|test)es$/i' => '\1is',
|
'/(cris|ax|test)es$/i' => '\1is',
|
||||||
'/(shoe)s$/i' => '\1',
|
'/(shoe|slave)s$/i' => '\1',
|
||||||
'/(o)es$/i' => '\1',
|
'/(o)es$/i' => '\1',
|
||||||
'/ouses$/' => 'ouse',
|
'/ouses$/' => 'ouse',
|
||||||
'/uses$/' => 'us',
|
'/uses$/' => 'us',
|
||||||
|
|
|
@ -160,8 +160,8 @@ class L10n extends Object {
|
||||||
/* Sami (Lappish) */ 'smi' => 'sz',
|
/* Sami (Lappish) */ 'smi' => 'sz',
|
||||||
/* Serbian */ 'scc' => 'sr',
|
/* Serbian */ 'scc' => 'sr',
|
||||||
/* Serbian */ 'srp' => 'sr',
|
/* Serbian */ 'srp' => 'sr',
|
||||||
/* Slovack */ 'slo' => 'sk',
|
/* Slovak */ 'slo' => 'sk',
|
||||||
/* Slovack */ 'slk' => 'sk',
|
/* Slovak */ 'slk' => 'sk',
|
||||||
/* Slovenian */ 'slv' => 'sl',
|
/* Slovenian */ 'slv' => 'sl',
|
||||||
/* Sorbian */ 'wen' => 'sb',
|
/* Sorbian */ 'wen' => 'sb',
|
||||||
/* Spanish (Spain - Traditional) */ 'spa' => 'es',
|
/* Spanish (Spain - Traditional) */ 'spa' => 'es',
|
||||||
|
@ -301,7 +301,7 @@ class L10n extends Object {
|
||||||
'ro-mo' => array('language' => 'Romanian (Moldavia)', 'locale' => 'ro_mo', 'localeFallback' => 'rum', 'charset' => 'utf-8'),
|
'ro-mo' => array('language' => 'Romanian (Moldavia)', 'locale' => 'ro_mo', 'localeFallback' => 'rum', 'charset' => 'utf-8'),
|
||||||
'ru-mo' => array('language' => 'Russian (Moldavia)', 'locale' => 'ru_mo', 'localeFallback' => 'rus', 'charset' => 'utf-8'),
|
'ru-mo' => array('language' => 'Russian (Moldavia)', 'locale' => 'ru_mo', 'localeFallback' => 'rus', 'charset' => 'utf-8'),
|
||||||
'sb' => array('language' => 'Sorbian', 'locale' => 'wen', 'localeFallback' => 'wen', 'charset' => 'utf-8'),
|
'sb' => array('language' => 'Sorbian', 'locale' => 'wen', 'localeFallback' => 'wen', 'charset' => 'utf-8'),
|
||||||
'sk' => array('language' => 'Slovack', 'locale' => 'slo', 'localeFallback' => 'slo', 'charset' => 'utf-8'),
|
'sk' => array('language' => 'Slovak', 'locale' => 'slo', 'localeFallback' => 'slo', 'charset' => 'utf-8'),
|
||||||
'sl' => array('language' => 'Slovenian', 'locale' => 'slv', 'localeFallback' => 'slv', 'charset' => 'utf-8'),
|
'sl' => array('language' => 'Slovenian', 'locale' => 'slv', 'localeFallback' => 'slv', 'charset' => 'utf-8'),
|
||||||
'sq' => array('language' => 'Albanian', 'locale' => 'alb', 'localeFallback' => 'alb', 'charset' => 'utf-8'),
|
'sq' => array('language' => 'Albanian', 'locale' => 'alb', 'localeFallback' => 'alb', 'charset' => 'utf-8'),
|
||||||
'sr' => array('language' => 'Serbian', 'locale' => 'scc', 'localeFallback' => 'scc', 'charset' => 'utf-8'),
|
'sr' => array('language' => 'Serbian', 'locale' => 'scc', 'localeFallback' => 'scc', 'charset' => 'utf-8'),
|
||||||
|
|
|
@ -23,8 +23,11 @@
|
||||||
* @lastmodified $Date$
|
* @lastmodified $Date$
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
|
if (!class_exists('Object')) {
|
||||||
|
require LIBS . 'object.php';
|
||||||
|
}
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
uses('object', 'file');
|
require LIBS . 'file.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ class AclBehavior extends ModelBehavior {
|
||||||
|
|
||||||
$type = $this->__typeMaps[$this->settings[$model->name]['type']];
|
$type = $this->__typeMaps[$this->settings[$model->name]['type']];
|
||||||
if (!class_exists('AclNode')) {
|
if (!class_exists('AclNode')) {
|
||||||
uses('model' . DS . 'db_acl');
|
require LIBS . 'model' . DS . 'db_acl.php';
|
||||||
}
|
}
|
||||||
$model->{$type} =& ClassRegistry::init($type);
|
$model->{$type} =& ClassRegistry::init($type);
|
||||||
if (!method_exists($model, 'parentNode')) {
|
if (!method_exists($model, 'parentNode')) {
|
||||||
|
|
|
@ -323,7 +323,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
$option = 'conditions';
|
$option = 'conditions';
|
||||||
$val = $Model->{$name}->alias.'.'.$key;
|
$val = $Model->{$name}->alias.'.'.$key;
|
||||||
}
|
}
|
||||||
$children[$option] = isset($children[$option]) ? array_merge((array) $children[$option], (array) $val) : $val;
|
$children[$option] = is_array($val) ? $val : array($val);
|
||||||
$newChildren = null;
|
$newChildren = null;
|
||||||
if (!empty($name) && !empty($children[$key])) {
|
if (!empty($name) && !empty($children[$key])) {
|
||||||
$newChildren = $children[$key];
|
$newChildren = $children[$key];
|
||||||
|
|
|
@ -90,7 +90,7 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($options['path'])) {
|
if (empty($options['path'])) {
|
||||||
$this->path = CONFIGS . 'sql';
|
$this->path = CONFIGS . 'schema';
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array_merge(get_object_vars($this), $options);
|
$options = array_merge(get_object_vars($this), $options);
|
||||||
|
@ -161,6 +161,7 @@ class CakeSchema extends Object {
|
||||||
extract(get_object_vars($this));
|
extract(get_object_vars($this));
|
||||||
|
|
||||||
$class = $name .'Schema';
|
$class = $name .'Schema';
|
||||||
|
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
if (file_exists($path . DS . $file) && is_file($path . DS . $file)) {
|
if (file_exists($path . DS . $file) && is_file($path . DS . $file)) {
|
||||||
require_once($path . DS . $file);
|
require_once($path . DS . $file);
|
||||||
|
@ -366,7 +367,6 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
$out .="}\n";
|
$out .="}\n";
|
||||||
|
|
||||||
|
|
||||||
$File =& new File($path . DS . $file, true);
|
$File =& new File($path . DS . $file, true);
|
||||||
$header = '$Id';
|
$header = '$Id';
|
||||||
$content = "<?php \n/* SVN FILE: {$header}$ */\n/* {$name} schema generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
|
$content = "<?php \n/* SVN FILE: {$header}$ */\n/* {$name} schema generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
|
||||||
|
|
|
@ -102,7 +102,7 @@ class DataSource extends Object {
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_result = null;
|
var $_result = null;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class DataSource extends Object {
|
||||||
* Queries count.
|
* Queries count.
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_queriesCnt = 0;
|
var $_queriesCnt = 0;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class DataSource extends Object {
|
||||||
* Total duration of all queries.
|
* Total duration of all queries.
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_queriesTime = null;
|
var $_queriesTime = null;
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class DataSource extends Object {
|
||||||
* Log of queries executed by this DataSource
|
* Log of queries executed by this DataSource
|
||||||
*
|
*
|
||||||
* @var unknown_type
|
* @var unknown_type
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_queriesLog = array();
|
var $_queriesLog = array();
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class DataSource extends Object {
|
||||||
* >6000 queries on one system.
|
* >6000 queries on one system.
|
||||||
*
|
*
|
||||||
* @var int Maximum number of queries in the queries log.
|
* @var int Maximum number of queries in the queries log.
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_queriesLogMax = 200;
|
var $_queriesLogMax = 200;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class DataSource extends Object {
|
||||||
* Caches serialzed results of executed queries
|
* Caches serialzed results of executed queries
|
||||||
*
|
*
|
||||||
* @var array Maximum number of queries in the queries log.
|
* @var array Maximum number of queries in the queries log.
|
||||||
* @access private
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_queryCache = array();
|
var $_queryCache = array();
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class DataSource extends Object {
|
||||||
* The default configuration of a specific DataSource
|
* The default configuration of a specific DataSource
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $_baseConfig = array();
|
var $_baseConfig = array();
|
||||||
|
|
||||||
|
|
|
@ -226,9 +226,10 @@ class DboMssql extends DboSource {
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = false;
|
$table = $this->fullTableName($model, false);
|
||||||
$cols = $this->fetchAll("SELECT COLUMN_NAME as Field, DATA_TYPE as Type, COL_LENGTH('" . $this->fullTableName($model, false) . "', COLUMN_NAME) as Length, IS_NULLABLE As [Null], COLUMN_DEFAULT as [Default], COLUMNPROPERTY(OBJECT_ID('" . $this->fullTableName($model, false) . "'), COLUMN_NAME, 'IsIdentity') as [Key], NUMERIC_SCALE as Size FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" . $this->fullTableName($model, false) . "'", false);
|
$cols = $this->fetchAll("SELECT COLUMN_NAME as Field, DATA_TYPE as Type, COL_LENGTH('" . $table . "', COLUMN_NAME) as Length, IS_NULLABLE As [Null], COLUMN_DEFAULT as [Default], COLUMNPROPERTY(OBJECT_ID('" . $table . "'), COLUMN_NAME, 'IsIdentity') as [Key], NUMERIC_SCALE as Size FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" . $table . "'", false);
|
||||||
|
|
||||||
|
$fields = false;
|
||||||
foreach ($cols as $column) {
|
foreach ($cols as $column) {
|
||||||
$field = $column[0]['Field'];
|
$field = $column[0]['Field'];
|
||||||
$fields[$field] = array(
|
$fields[$field] = array(
|
||||||
|
@ -312,7 +313,8 @@ class DboMssql extends DboSource {
|
||||||
$fields = parent::fields($model, $alias, $fields, false);
|
$fields = parent::fields($model, $alias, $fields, false);
|
||||||
$count = count($fields);
|
$count = count($fields);
|
||||||
|
|
||||||
if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false) {
|
if ($count >= 1 && strpos($fields[0], 'COUNT(*)') === false) {
|
||||||
|
$result = array();
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$prepend = '';
|
$prepend = '';
|
||||||
|
|
||||||
|
@ -323,6 +325,19 @@ class DboMssql extends DboSource {
|
||||||
$fieldAlias = count($this->__fieldMappings);
|
$fieldAlias = count($this->__fieldMappings);
|
||||||
|
|
||||||
if (!preg_match('/\s+AS\s+/i', $fields[$i])) {
|
if (!preg_match('/\s+AS\s+/i', $fields[$i])) {
|
||||||
|
if (substr($fields[$i], -1) == '*') {
|
||||||
|
if (strpos($fields[$i], '.') !== false && $fields[$i] != $alias . '.*') {
|
||||||
|
$build = explode('.', $fields[$i]);
|
||||||
|
$AssociatedModel = $model->{$build[0]};
|
||||||
|
} else {
|
||||||
|
$AssociatedModel = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
$_fields = $this->fields($AssociatedModel, $AssociatedModel->alias, array_keys($AssociatedModel->schema()));
|
||||||
|
$result = array_merge($result, $_fields);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($fields[$i], '.') === false) {
|
if (strpos($fields[$i], '.') === false) {
|
||||||
$this->__fieldMappings[$alias . '__' . $fieldAlias] = $alias . '.' . $fields[$i];
|
$this->__fieldMappings[$alias . '__' . $fieldAlias] = $alias . '.' . $fields[$i];
|
||||||
$fieldName = $this->name($alias . '.' . $fields[$i]);
|
$fieldName = $this->name($alias . '.' . $fields[$i]);
|
||||||
|
@ -338,11 +353,13 @@ class DboMssql extends DboSource {
|
||||||
}
|
}
|
||||||
$fields[$i] = "{$fieldName} AS {$fieldAlias}";
|
$fields[$i] = "{$fieldName} AS {$fieldAlias}";
|
||||||
}
|
}
|
||||||
$fields[$i] = $prepend . $fields[$i];
|
$result[] = $prepend . $fields[$i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and executes an SQL INSERT statement for given model, fields, and values.
|
* Generates and executes an SQL INSERT statement for given model, fields, and values.
|
||||||
|
@ -392,6 +409,9 @@ class DboMssql extends DboSource {
|
||||||
if (isset($fields[$model->primaryKey])) {
|
if (isset($fields[$model->primaryKey])) {
|
||||||
unset($fields[$model->primaryKey]);
|
unset($fields[$model->primaryKey]);
|
||||||
}
|
}
|
||||||
|
if (empty($fields)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return parent::update($model, array_keys($fields), array_values($fields), $conditions);
|
return parent::update($model, array_keys($fields), array_values($fields), $conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,16 +717,10 @@ class DboMssql extends DboSource {
|
||||||
*/
|
*/
|
||||||
function buildColumn($column) {
|
function buildColumn($column) {
|
||||||
$result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
|
$result = preg_replace('/(int|integer)\([0-9]+\)/i', '$1', parent::buildColumn($column));
|
||||||
$null = (
|
if (strpos($result, 'DEFAULT NULL') !== false) {
|
||||||
(isset($column['null']) && $column['null'] == true) ||
|
$result = str_replace('DEFAULT NULL', 'NULL', $result);
|
||||||
(array_key_exists('default', $column) && $column['default'] === null) ||
|
} else if (array_keys($column) == array('type', 'name')) {
|
||||||
(array_keys($column) == array('type', 'name'))
|
$result .= ' NULL';
|
||||||
);
|
|
||||||
$primaryKey = (isset($column['key']) && $column['key'] == 'primary');
|
|
||||||
$stringKey = ($primaryKey && $column['type'] != 'integer');
|
|
||||||
|
|
||||||
if ($null && !$primaryKey) {
|
|
||||||
$result .= " NULL";
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +772,6 @@ class DboMssql extends DboSource {
|
||||||
return $field;
|
return $field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,7 @@ class DboOracle extends DboSource {
|
||||||
}
|
}
|
||||||
return $this->connected;
|
return $this->connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of the most recent Oracle error
|
* Keeps track of the most recent Oracle error
|
||||||
*
|
*
|
||||||
|
@ -497,11 +498,12 @@ class DboOracle extends DboSource {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function describe(&$model) {
|
function describe(&$model) {
|
||||||
|
$table = $model->fullTableName($model, false);
|
||||||
|
|
||||||
if (!empty($model->sequence)) {
|
if (!empty($model->sequence)) {
|
||||||
$this->_sequenceMap[$model->table] = $model->sequence;
|
$this->_sequenceMap[$table] = $model->sequence;
|
||||||
} elseif (!empty($model->table)) {
|
} elseif (!empty($model->table)) {
|
||||||
$this->_sequenceMap[$model->table] = $model->table . '_seq';
|
$this->_sequenceMap[$table] = $model->table . '_seq';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache = parent::describe($model);
|
$cache = parent::describe($model);
|
||||||
|
@ -509,12 +511,14 @@ class DboOracle extends DboSource {
|
||||||
if ($cache != null) {
|
if ($cache != null) {
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH FROM all_tab_columns WHERE table_name = \'';
|
$sql = 'SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH FROM all_tab_columns WHERE table_name = \'';
|
||||||
$sql .= strtoupper($this->fullTableName($model)) . '\'';
|
$sql .= strtoupper($this->fullTableName($model)) . '\'';
|
||||||
|
|
||||||
if (!$this->execute($sql)) {
|
if (!$this->execute($sql)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = array();
|
$fields = array();
|
||||||
|
|
||||||
for ($i = 0; $row = $this->fetchRow(); $i++) {
|
for ($i = 0; $row = $this->fetchRow(); $i++) {
|
||||||
|
@ -1069,7 +1073,6 @@ class DboOracle extends DboSource {
|
||||||
$q = str_replace('= (', 'IN (', $q);
|
$q = str_replace('= (', 'IN (', $q);
|
||||||
$q = str_replace(' WHERE 1 = 1', '', $q);
|
$q = str_replace(' WHERE 1 = 1', '', $q);
|
||||||
|
|
||||||
|
|
||||||
$q = $this->insertQueryData($q, null, $association, $assocData, $model, $linkModel, $stack);
|
$q = $this->insertQueryData($q, null, $association, $assocData, $model, $linkModel, $stack);
|
||||||
if ($q != false) {
|
if ($q != false) {
|
||||||
$res = $this->fetchAll($q, $model->cacheQueries, $model->alias);
|
$res = $this->fetchAll($q, $model->cacheQueries, $model->alias);
|
||||||
|
@ -1139,6 +1142,7 @@ class DboOracle extends DboSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a "drop table" statement for the given Schema object
|
* Generate a "drop table" statement for the given Schema object
|
||||||
*
|
*
|
||||||
|
|
|
@ -1447,6 +1447,7 @@ class DboSource extends DataSource {
|
||||||
function _prepareUpdateFields(&$model, $fields, $quoteValues = true, $alias = false) {
|
function _prepareUpdateFields(&$model, $fields, $quoteValues = true, $alias = false) {
|
||||||
$quotedAlias = $this->startQuote . $model->alias . $this->endQuote;
|
$quotedAlias = $this->startQuote . $model->alias . $this->endQuote;
|
||||||
|
|
||||||
|
$updates = array();
|
||||||
foreach ($fields as $field => $value) {
|
foreach ($fields as $field => $value) {
|
||||||
if ($alias && strpos($field, '.') === false) {
|
if ($alias && strpos($field, '.') === false) {
|
||||||
$quoted = $model->escapeField($field);
|
$quoted = $model->escapeField($field);
|
||||||
|
@ -2459,6 +2460,7 @@ class DboSource extends DataSource {
|
||||||
if (!empty($value['unique'])) {
|
if (!empty($value['unique'])) {
|
||||||
$out .= 'UNIQUE ';
|
$out .= 'UNIQUE ';
|
||||||
}
|
}
|
||||||
|
$name = $this->startQuote . $name . $this->endQuote;
|
||||||
}
|
}
|
||||||
if (is_array($value['column'])) {
|
if (is_array($value['column'])) {
|
||||||
$out .= 'KEY ' . $name . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
|
$out .= 'KEY ' . $name . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')';
|
||||||
|
|
|
@ -2575,8 +2575,8 @@ class Model extends Overloadable {
|
||||||
* rule (in case of multiple validation for field) that was broken.
|
* rule (in case of multiple validation for field) that was broken.
|
||||||
*
|
*
|
||||||
* @param string $field The name of the field to invalidate
|
* @param string $field The name of the field to invalidate
|
||||||
* @param mixed $value Name of validation rule that was not failed. If no validation key
|
* @param mixed $value Name of validation rule that was not failed, or validation message to
|
||||||
* is provided, defaults to true.
|
* be returned. If no validation key is provided, defaults to true.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function invalidate($field, $value = true) {
|
function invalidate($field, $value = true) {
|
||||||
|
|
|
@ -83,9 +83,10 @@ class Object {
|
||||||
/**
|
/**
|
||||||
* Calls a controller's method from any location.
|
* Calls a controller's method from any location.
|
||||||
*
|
*
|
||||||
* @param string $url URL in the form of Cake URL ("/controller/method/parameter")
|
* @param mixed $url String or array-based url.
|
||||||
* @param array $extra if array includes the key "return" it sets the AutoRender to true.
|
* @param array $extra if array includes the key "return" it sets the AutoRender to true.
|
||||||
* @return mixed Success (true/false) or contents if 'return' is set in $extra
|
* @return mixed Boolean true or false on success/failure, or contents
|
||||||
|
* of rendered action if 'return' is set in $extra.
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function requestAction($url, $extra = array()) {
|
function requestAction($url, $extra = array()) {
|
||||||
|
@ -157,7 +158,7 @@ class Object {
|
||||||
*/
|
*/
|
||||||
function log($msg, $type = LOG_ERROR) {
|
function log($msg, $type = LOG_ERROR) {
|
||||||
if (!class_exists('CakeLog')) {
|
if (!class_exists('CakeLog')) {
|
||||||
uses('cake_log');
|
require LIBS . 'cake_log.php';
|
||||||
}
|
}
|
||||||
if (is_null($this->_log)) {
|
if (is_null($this->_log)) {
|
||||||
$this->_log = new CakeLog();
|
$this->_log = new CakeLog();
|
||||||
|
|
|
@ -508,7 +508,6 @@ class AjaxHelper extends AppHelper {
|
||||||
$options = $this->_optionsToString($options, array('paramName', 'indicator'));
|
$options = $this->_optionsToString($options, array('paramName', 'indicator'));
|
||||||
$options = $this->_buildOptions($options, $this->autoCompleteOptions);
|
$options = $this->_buildOptions($options, $this->autoCompleteOptions);
|
||||||
|
|
||||||
|
|
||||||
$text = $this->Form->text($field, $htmlOptions);
|
$text = $this->Form->text($field, $htmlOptions);
|
||||||
$div = $this->Html->div(null, '', $divOptions);
|
$div = $this->Html->div(null, '', $divOptions);
|
||||||
$script = "{$var}new Ajax.Autocompleter('{$htmlOptions['id']}', '{$divOptions['id']}', '";
|
$script = "{$var}new Ajax.Autocompleter('{$htmlOptions['id']}', '{$divOptions['id']}', '";
|
||||||
|
@ -1018,5 +1017,4 @@ class AjaxHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -598,6 +598,15 @@ class JavascriptHelper extends AppHelper {
|
||||||
* Generates a JavaScript object in JavaScript Object Notation (JSON)
|
* Generates a JavaScript object in JavaScript Object Notation (JSON)
|
||||||
* from an array
|
* from an array
|
||||||
*
|
*
|
||||||
|
* ### Options
|
||||||
|
*
|
||||||
|
* - block - Wraps the return value in a script tag if true. Default is false
|
||||||
|
* - prefix - Prepends the string to the returned data. Default is ''
|
||||||
|
* - 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 "'"
|
||||||
|
*
|
||||||
* @param array $data Data to be converted
|
* @param array $data Data to be converted
|
||||||
* @param array $options Set of options: block, prefix, postfix, stringKeys, quoteKeys, q
|
* @param array $options Set of options: block, prefix, postfix, stringKeys, quoteKeys, q
|
||||||
* @param string $prefix DEPRECATED, use $options['prefix'] instead. Prepends the string to the returned data
|
* @param string $prefix DEPRECATED, use $options['prefix'] instead. Prepends the string to the returned data
|
||||||
|
|
|
@ -67,10 +67,10 @@ class PaginatorHelper extends AppHelper {
|
||||||
var $options = array();
|
var $options = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current page of the in the recordset for the given model
|
* Gets the current paging parameters from the resultset for the given model
|
||||||
*
|
*
|
||||||
* @param string $model Optional model name. Uses the default if none is specified.
|
* @param string $model Optional model name. Uses the default if none is specified.
|
||||||
* @return string The current page number of the paginated resultset.
|
* @return array The array of paging parameters for the paginated resultset.
|
||||||
*/
|
*/
|
||||||
function params($model = null) {
|
function params($model = null) {
|
||||||
if (empty($model)) {
|
if (empty($model)) {
|
||||||
|
|
|
@ -168,5 +168,4 @@ class XmlHelper extends AppHelper {
|
||||||
return $data->toString($options + array('header' => false));
|
return $data->toString($options + array('header' => false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -79,7 +79,9 @@ endif;
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if (isset($filePresent)):
|
if (isset($filePresent)):
|
||||||
uses('model' . DS . 'connection_manager');
|
if (!class_exists('ConnectionManager')) {
|
||||||
|
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||||
|
}
|
||||||
$db = ConnectionManager::getInstance();
|
$db = ConnectionManager::getInstance();
|
||||||
@$connected = $db->getDataSource('default');
|
@$connected = $db->getDataSource('default');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -216,6 +216,7 @@ class XmlNode extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
$tagOpts = $this->__tagOptions($name);
|
$tagOpts = $this->__tagOptions($name);
|
||||||
|
|
||||||
if ($tagOpts === false) {
|
if ($tagOpts === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +237,6 @@ class XmlNode extends Object {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
$children = array();
|
$children = array();
|
||||||
$chldObjs = array();
|
$chldObjs = array();
|
||||||
$document =& $this->document();
|
|
||||||
|
|
||||||
if (is_object($object)) {
|
if (is_object($object)) {
|
||||||
$chldObjs = get_object_vars($object);
|
$chldObjs = get_object_vars($object);
|
||||||
|
@ -254,7 +254,12 @@ class XmlNode extends Object {
|
||||||
$node->createTextNode($chldObjs[$tagOpts['value']]);
|
$node->createTextNode($chldObjs[$tagOpts['value']]);
|
||||||
unset($chldObjs[$tagOpts['value']]);
|
unset($chldObjs[$tagOpts['value']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$n = $name;
|
||||||
|
if (!empty($chldObjs['_name_'])) {
|
||||||
|
$n = null;
|
||||||
unset($chldObjs['_name_']);
|
unset($chldObjs['_name_']);
|
||||||
|
}
|
||||||
$c = 0;
|
$c = 0;
|
||||||
|
|
||||||
foreach ($chldObjs as $key => $val) {
|
foreach ($chldObjs as $key => $val) {
|
||||||
|
@ -262,14 +267,11 @@ class XmlNode extends Object {
|
||||||
$attributes[$key] = $val;
|
$attributes[$key] = $val;
|
||||||
} else {
|
} else {
|
||||||
if (!isset($tagOpts['children']) || $tagOpts['children'] === array() || (is_array($tagOpts['children']) && in_array($key, $tagOpts['children']))) {
|
if (!isset($tagOpts['children']) || $tagOpts['children'] === array() || (is_array($tagOpts['children']) && in_array($key, $tagOpts['children']))) {
|
||||||
|
if (!is_numeric($key)) {
|
||||||
$n = $key;
|
$n = $key;
|
||||||
|
|
||||||
if (is_numeric($n)) {
|
|
||||||
$n = $name;
|
|
||||||
}
|
}
|
||||||
if (is_array($val)) {
|
if (is_array($val)) {
|
||||||
foreach ($val as $i => $obj2) {
|
foreach ($val as $n2 => $obj2) {
|
||||||
$n2 = $i;
|
|
||||||
if (is_numeric($n2)) {
|
if (is_numeric($n2)) {
|
||||||
$n2 = $n;
|
$n2 = $n;
|
||||||
}
|
}
|
||||||
|
@ -277,6 +279,7 @@ class XmlNode extends Object {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_object($val)) {
|
if (is_object($val)) {
|
||||||
|
|
||||||
$node->normalize($val, $n, $options);
|
$node->normalize($val, $n, $options);
|
||||||
} elseif ($options['format'] == 'tags' && $this->__tagOptions($key) !== false) {
|
} elseif ($options['format'] == 'tags' && $this->__tagOptions($key) !== false) {
|
||||||
$tmp =& $node->createElement($key);
|
$tmp =& $node->createElement($key);
|
||||||
|
@ -661,7 +664,6 @@ class XmlNode extends Object {
|
||||||
if ($options['whitespace']) {
|
if ($options['whitespace']) {
|
||||||
$d .= "\n";
|
$d .= "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = count($this->children);
|
$count = count($this->children);
|
||||||
$cDepth = $depth + 1;
|
$cDepth = $depth + 1;
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
|
|
@ -153,6 +153,7 @@ class BasicsTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function testUses() {
|
function testUses() {
|
||||||
$this->skipIf(class_exists('Security') || class_exists('Sanitize'), '%s Security and/or Sanitize class already loaded');
|
$this->skipIf(class_exists('Security') || class_exists('Sanitize'), '%s Security and/or Sanitize class already loaded');
|
||||||
|
@ -587,7 +588,7 @@ class BasicsTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('this-is-a-test');
|
debug('this-is-a-test');
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$pattern = '/.*\>(cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
|
$pattern = '/.*\>(.+?cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
|
||||||
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
|
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
|
||||||
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*this-is-a-test.*/s';
|
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*this-is-a-test.*/s';
|
||||||
$this->assertPattern($pattern, $result);
|
$this->assertPattern($pattern, $result);
|
||||||
|
@ -595,7 +596,7 @@ class BasicsTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', true);
|
debug('<div>this-is-a-test</div>', true);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$pattern = '/.*\>(cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
|
$pattern = '/.*\>(.+?cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
|
||||||
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
|
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
|
||||||
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*<div>this-is-a-test<\/div>.*/s';
|
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*<div>this-is-a-test<\/div>.*/s';
|
||||||
$this->assertPattern($pattern, $result);
|
$this->assertPattern($pattern, $result);
|
||||||
|
|
|
@ -225,7 +225,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array('cake.php');
|
$params = array('cake.php');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'app' => 'app',
|
'app' => 'app',
|
||||||
|
@ -237,7 +236,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'cake.php',
|
'cake.php',
|
||||||
'-app',
|
'-app',
|
||||||
|
@ -253,7 +251,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'./cake.php',
|
'./cake.php',
|
||||||
'bake',
|
'bake',
|
||||||
|
@ -274,7 +271,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'./console/cake.php',
|
'./console/cake.php',
|
||||||
'bake',
|
'bake',
|
||||||
|
@ -293,7 +289,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'./console/cake.php',
|
'./console/cake.php',
|
||||||
'bake',
|
'bake',
|
||||||
|
@ -314,7 +309,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'./console/cake.php',
|
'./console/cake.php',
|
||||||
'-working',
|
'-working',
|
||||||
|
@ -340,11 +334,9 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$expected = array('./console/cake.php', 'schema', 'run', 'create');
|
$expected = array('./console/cake.php', 'schema', 'run', 'create');
|
||||||
$this->assertEqual($expected, $Dispatcher->args);
|
$this->assertEqual($expected, $Dispatcher->args);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'/cake/1.2.x.x/cake/console/cake.php',
|
'/cake/1.2.x.x/cake/console/cake.php',
|
||||||
'-working',
|
'-working',
|
||||||
|
@ -368,7 +360,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$expected = array('/cake/1.2.x.x/cake/console/cake.php', 'schema', 'run', 'create');
|
$expected = array('/cake/1.2.x.x/cake/console/cake.php', 'schema', 'run', 'create');
|
||||||
$this->assertEqual($expected, $Dispatcher->args);
|
$this->assertEqual($expected, $Dispatcher->args);
|
||||||
$params = array(
|
$params = array(
|
||||||
|
@ -386,12 +377,10 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
'root' => 'C:\wamp\www\apps\cake'
|
'root' => 'C:\wamp\www\apps\cake'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'cake.php',
|
'cake.php',
|
||||||
'-working',
|
'-working',
|
||||||
|
@ -410,7 +399,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'cake.php',
|
'cake.php',
|
||||||
'-working',
|
'-working',
|
||||||
|
@ -432,7 +420,6 @@ class ShellDispatcherTest extends CakeTestCase {
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'/home/amelo/dev/cake-common/cake/console/cake.php',
|
'/home/amelo/dev/cake-common/cake/console/cake.php',
|
||||||
'-root',
|
'-root',
|
||||||
|
|
|
@ -46,9 +46,11 @@ Mock::generatePartial(
|
||||||
);
|
);
|
||||||
Mock::generatePartial(
|
Mock::generatePartial(
|
||||||
'AclShell', 'MockAclShell',
|
'AclShell', 'MockAclShell',
|
||||||
array('in', 'out', 'hr', 'createFile')
|
array('in', 'out', 'hr', 'createFile', 'error', 'err')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Mock::generate('AclComponent', 'MockAclShellAclComponent');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AclShellTest class
|
* AclShellTest class
|
||||||
*
|
*
|
||||||
|
@ -82,7 +84,7 @@ class AclShellTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* startTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -92,10 +94,13 @@ class AclShellTest extends CakeTestCase {
|
||||||
$this->Task =& new MockAclShell($this->Dispatcher);
|
$this->Task =& new MockAclShell($this->Dispatcher);
|
||||||
$this->Task->Dispatch = new $this->Dispatcher;
|
$this->Task->Dispatch = new $this->Dispatcher;
|
||||||
$this->Task->params['datasource'] = 'test_suite';
|
$this->Task->params['datasource'] = 'test_suite';
|
||||||
|
$this->Task->Acl =& new AclComponent();
|
||||||
|
$controller = null;
|
||||||
|
$this->Task->Acl->startup($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -128,5 +133,89 @@ class AclShellTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Task->view();
|
$this->Task->view();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* test the method that splits model.foreign key. and that it returns an array.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testParsingModelAndForeignKey() {
|
||||||
|
$result = $this->Task->parseIdentifier('Model.foreignKey');
|
||||||
|
$expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
|
||||||
|
|
||||||
|
$result = $this->Task->parseIdentifier('mySuperUser');
|
||||||
|
$this->assertEqual($result, 'mySuperUser');
|
||||||
|
|
||||||
|
$result = $this->Task->parseIdentifier('111234');
|
||||||
|
$this->assertEqual($result, '111234');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test creating aro/aco nodes
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testCreate() {
|
||||||
|
$this->Task->args = array('aro', 'root', 'User.1');
|
||||||
|
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*'));
|
||||||
|
$this->Task->create();
|
||||||
|
|
||||||
|
$Aro =& ClassRegistry::init('Aro');
|
||||||
|
$Aro->cacheQueries = false;
|
||||||
|
$result = $Aro->read();
|
||||||
|
$this->assertEqual($result['Aro']['model'], 'User');
|
||||||
|
$this->assertEqual($result['Aro']['foreign_key'], 1);
|
||||||
|
$this->assertEqual($result['Aro']['parent_id'], null);
|
||||||
|
$id = $result['Aro']['id'];
|
||||||
|
|
||||||
|
$this->Task->args = array('aro', 'User.1', 'User.3');
|
||||||
|
$this->Task->expectAt(1, 'out', array(new PatternExpectation('/created/'), '*'));
|
||||||
|
$this->Task->create();
|
||||||
|
|
||||||
|
$Aro =& ClassRegistry::init('Aro');
|
||||||
|
$result = $Aro->read();
|
||||||
|
$this->assertEqual($result['Aro']['model'], 'User');
|
||||||
|
$this->assertEqual($result['Aro']['foreign_key'], 3);
|
||||||
|
$this->assertEqual($result['Aro']['parent_id'], $id);
|
||||||
|
|
||||||
|
$this->Task->args = array('aro', 'root', 'somealias');
|
||||||
|
$this->Task->expectAt(2, 'out', array(new PatternExpectation('/created/'), '*'));
|
||||||
|
$this->Task->create();
|
||||||
|
|
||||||
|
$Aro =& ClassRegistry::init('Aro');
|
||||||
|
$result = $Aro->read();
|
||||||
|
$this->assertEqual($result['Aro']['alias'], 'somealias');
|
||||||
|
$this->assertEqual($result['Aro']['model'], null);
|
||||||
|
$this->assertEqual($result['Aro']['foreign_key'], null);
|
||||||
|
$this->assertEqual($result['Aro']['parent_id'], null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test the delete method with different node types.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testDelete() {
|
||||||
|
$this->Task->args = array('aro', 'AuthUser.1');
|
||||||
|
$this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true));
|
||||||
|
$this->Task->delete();
|
||||||
|
|
||||||
|
$Aro =& ClassRegistry::init('Aro');
|
||||||
|
$result = $Aro->read(null, 3);
|
||||||
|
$this->assertFalse($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test setParent method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
function testSetParent() {
|
||||||
|
$this->Task->args = array('aro', 'AuthUser.2', 'root');
|
||||||
|
$this->Task->setParent();
|
||||||
|
|
||||||
|
$Aro =& ClassRegistry::init('Aro');
|
||||||
|
$result = $Aro->read(null, 4);
|
||||||
|
$this->assertEqual($result['Aro']['parent_id'], null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -33,7 +33,6 @@ if (!class_exists('ShellDispatcher')) {
|
||||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'db_config.php';
|
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'db_config.php';
|
||||||
//require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
|
//require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
|
||||||
|
|
||||||
|
|
||||||
Mock::generatePartial(
|
Mock::generatePartial(
|
||||||
'ShellDispatcher', 'TestDbConfigTaskMockShellDispatcher',
|
'ShellDispatcher', 'TestDbConfigTaskMockShellDispatcher',
|
||||||
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
||||||
|
@ -73,6 +72,7 @@ class TEST_DATABASE_CONFIG {
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
*/
|
*/
|
||||||
class DbConfigTaskTest extends CakeTestCase {
|
class DbConfigTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startTest method
|
* startTest method
|
||||||
*
|
*
|
||||||
|
@ -88,6 +88,7 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
$this->Task->params['working'] = rtrim(APP, '/');
|
$this->Task->params['working'] = rtrim(APP, '/');
|
||||||
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
|
$this->Task->databaseClassName = 'TEST_DATABASE_CONFIG';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* endTest method
|
* endTest method
|
||||||
*
|
*
|
||||||
|
@ -98,6 +99,7 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the getConfig method.
|
* Test the getConfig method.
|
||||||
*
|
*
|
||||||
|
@ -108,6 +110,7 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getConfig();
|
$result = $this->Task->getConfig();
|
||||||
$this->assertEqual($result, 'otherOne');
|
$this->assertEqual($result, 'otherOne');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that initialize sets the path up.
|
* test that initialize sets the path up.
|
||||||
*
|
*
|
||||||
|
@ -120,6 +123,7 @@ class DbConfigTaskTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->Task->path, APP . 'config' . DS);
|
$this->assertEqual($this->Task->path, APP . 'config' . DS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute and by extension __interactive
|
* test execute and by extension __interactive
|
||||||
*
|
*
|
||||||
|
|
|
@ -47,6 +47,7 @@ Mock::generatePartial(
|
||||||
'Shell', 'MockFixtureModelTask',
|
'Shell', 'MockFixtureModelTask',
|
||||||
array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll')
|
array('in', 'out', 'err', 'createFile', '_stop', 'getName', 'getTable', 'listAll')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FixtureTaskTest class
|
* FixtureTaskTest class
|
||||||
*
|
*
|
||||||
|
@ -54,12 +55,14 @@ Mock::generatePartial(
|
||||||
* @subpackage cake.tests.cases.console.libs.tasks
|
* @subpackage cake.tests.cases.console.libs.tasks
|
||||||
*/
|
*/
|
||||||
class FixtureTaskTest extends CakeTestCase {
|
class FixtureTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fixtures
|
* fixtures
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
**/
|
**/
|
||||||
var $fixtures = array('core.article', 'core.comment');
|
var $fixtures = array('core.article', 'core.comment');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startTest method
|
* startTest method
|
||||||
*
|
*
|
||||||
|
@ -75,6 +78,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->Dispatch->shellPaths = App::path('shells');
|
$this->Task->Dispatch->shellPaths = App::path('shells');
|
||||||
$this->Task->Template->initialize();
|
$this->Task->Template->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* endTest method
|
* endTest method
|
||||||
*
|
*
|
||||||
|
@ -85,6 +89,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
unset($this->Task, $this->Dispatcher);
|
unset($this->Task, $this->Dispatcher);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that initialize sets the path
|
* test that initialize sets the path
|
||||||
*
|
*
|
||||||
|
@ -97,6 +102,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$expected = '/my/path/tests/fixtures/';
|
$expected = '/my/path/tests/fixtures/';
|
||||||
$this->assertEqual($Task->path, $expected);
|
$this->assertEqual($Task->path, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test import option array generation
|
* test import option array generation
|
||||||
*
|
*
|
||||||
|
@ -125,6 +131,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$expected = array('fromTable' => true);
|
$expected = array('fromTable' => true);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test generating a fixture with database conditions.
|
* test generating a fixture with database conditions.
|
||||||
*
|
*
|
||||||
|
@ -143,6 +150,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern('/Second Article/', $result, 'Missing import data %s');
|
$this->assertPattern('/Second Article/', $result, 'Missing import data %s');
|
||||||
$this->assertPattern('/Third Article/', $result, 'Missing import data %s');
|
$this->assertPattern('/Third Article/', $result, 'Missing import data %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute passes runs bake depending with named model.
|
* test that execute passes runs bake depending with named model.
|
||||||
*
|
*
|
||||||
|
@ -156,6 +164,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that execute runs all() when args[0] = all
|
* test that execute runs all() when args[0] = all
|
||||||
*
|
*
|
||||||
|
@ -175,6 +184,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
|
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/class CommentFixture/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test interactive mode of execute
|
* test interactive mode of execute
|
||||||
*
|
*
|
||||||
|
@ -192,6 +202,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class ArticleFixture/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that bake works
|
* Test that bake works
|
||||||
*
|
*
|
||||||
|
@ -225,6 +236,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->assertNoPattern('/var \$fields/', $result);
|
$this->assertNoPattern('/var \$fields/', $result);
|
||||||
$this->assertNoPattern('/var \$records/', $result);
|
$this->assertNoPattern('/var \$records/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that file generation includes headers and correct path for plugins.
|
* Test that file generation includes headers and correct path for plugins.
|
||||||
*
|
*
|
||||||
|
@ -241,6 +253,7 @@ class FixtureTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/\<\?php(.*)\?\>/ms')));
|
$this->Task->expectAt(1, 'createFile', array($filename, new PatternExpectation('/\<\?php(.*)\?\>/ms')));
|
||||||
$result = $this->Task->generateFixtureFile('Article', array());
|
$result = $this->Task->generateFixtureFile('Article', array());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test generating files into plugins.
|
* test generating files into plugins.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestTaskTest file
|
* TestTaskTest file
|
||||||
*
|
*
|
||||||
|
@ -92,6 +93,7 @@ class TestTaskTag extends Model {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulated Plugin
|
* Simulated Plugin
|
||||||
**/
|
**/
|
||||||
|
@ -123,6 +125,7 @@ class TestTaskCommentsController extends Controller {
|
||||||
class TestTaskTest extends CakeTestCase {
|
class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
var $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startTest method
|
* startTest method
|
||||||
*
|
*
|
||||||
|
@ -136,6 +139,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->Dispatch =& $this->Dispatcher;
|
$this->Task->Dispatch =& $this->Dispatcher;
|
||||||
$this->Task->Template =& new TemplateTask($this->Dispatcher);
|
$this->Task->Template =& new TemplateTask($this->Dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* endTest method
|
* endTest method
|
||||||
*
|
*
|
||||||
|
@ -145,6 +149,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
function endTest() {
|
function endTest() {
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that file path generation doesn't continuously append paths.
|
* Test that file path generation doesn't continuously append paths.
|
||||||
*
|
*
|
||||||
|
@ -168,6 +173,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(2, 'createFile', array($file, '*'));
|
$this->Task->expectAt(2, 'createFile', array($file, '*'));
|
||||||
$this->Task->bake('Controller', 'Comments');
|
$this->Task->bake('Controller', 'Comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that method introspection pulls all relevant non parent class
|
* Test that method introspection pulls all relevant non parent class
|
||||||
* methods into the test case.
|
* methods into the test case.
|
||||||
|
@ -179,6 +185,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = array('doSomething', 'doSomethingElse');
|
$expected = array('doSomething', 'doSomethingElse');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the generation of fixtures works correctly.
|
* test that the generation of fixtures works correctly.
|
||||||
*
|
*
|
||||||
|
@ -192,6 +199,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEqual(sort($result), sort($expected));
|
$this->assertEqual(sort($result), sort($expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that the generation of fixtures works correctly.
|
* test that the generation of fixtures works correctly.
|
||||||
*
|
*
|
||||||
|
@ -205,6 +213,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertEqual(sort($result), sort($expected));
|
$this->assertEqual(sort($result), sort($expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test user interaction to get object type
|
* test user interaction to get object type
|
||||||
*
|
*
|
||||||
|
@ -219,6 +228,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getObjectType();
|
$result = $this->Task->getObjectType();
|
||||||
$this->assertEqual($result, $this->Task->classTypes[1]);
|
$this->assertEqual($result, $this->Task->classTypes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creating test subjects should clear the registry so the registry is always fresh
|
* creating test subjects should clear the registry so the registry is always fresh
|
||||||
*
|
*
|
||||||
|
@ -242,6 +252,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$keys = ClassRegistry::keys();
|
$keys = ClassRegistry::keys();
|
||||||
$this->assertFalse(in_array('random', $keys));
|
$this->assertFalse(in_array('random', $keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that getClassName returns the user choice as a classname.
|
* test that getClassName returns the user choice as a classname.
|
||||||
*
|
*
|
||||||
|
@ -262,6 +273,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$options = Configure::listObjects('model');
|
$options = Configure::listObjects('model');
|
||||||
$this->assertEqual($result, $options[0]);
|
$this->assertEqual($result, $options[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the user interaction for defining additional fixtures.
|
* Test the user interaction for defining additional fixtures.
|
||||||
*
|
*
|
||||||
|
@ -274,6 +286,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
|
$expected = array('app.pizza', 'app.topping', 'app.side_dish');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that resolving classnames works
|
* test that resolving classnames works
|
||||||
*
|
*
|
||||||
|
@ -295,6 +308,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->getRealClassname('Component', 'Auth');
|
$result = $this->Task->getRealClassname('Component', 'Auth');
|
||||||
$this->assertEqual($result, 'AuthComponent');
|
$this->assertEqual($result, 'AuthComponent');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking files.
|
* test baking files.
|
||||||
*
|
*
|
||||||
|
@ -323,6 +337,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
||||||
$this->assertPattern("/'app\.articles_tag'/", $result);
|
$this->assertPattern("/'app\.articles_tag'/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baking controller test files, ensure that the stub class is generated.
|
* test baking controller test files, ensure that the stub class is generated.
|
||||||
*
|
*
|
||||||
|
@ -352,6 +367,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
$this->assertPattern("/'app\.test_task_tag'/", $result);
|
||||||
$this->assertPattern("/'app\.articles_tag'/", $result);
|
$this->assertPattern("/'app\.articles_tag'/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Constructor generation ensure that constructClasses is called for controllers
|
* test Constructor generation ensure that constructClasses is called for controllers
|
||||||
*
|
*
|
||||||
|
@ -370,6 +386,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = "new FormHelper()\n";
|
$expected = "new FormHelper()\n";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that mock class generation works for the appropriate classes
|
* Test that mock class generation works for the appropriate classes
|
||||||
*
|
*
|
||||||
|
@ -379,6 +396,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$result = $this->Task->hasMockClass('controller');
|
$result = $this->Task->hasMockClass('controller');
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test bake() with a -plugin param
|
* test bake() with a -plugin param
|
||||||
*
|
*
|
||||||
|
@ -391,6 +409,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array($path, '*'));
|
$this->Task->expectAt(0, 'createFile', array($path, '*'));
|
||||||
$this->Task->bake('Helper', 'Form');
|
$this->Task->bake('Helper', 'Form');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test filename generation for each type + plugins
|
* Test filename generation for each type + plugins
|
||||||
*
|
*
|
||||||
|
@ -424,6 +443,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
|
$expected = APP . 'plugins' . DS . 'test_test' . DS . 'tests' . DS . 'cases' . DS . 'models' . DS . 'post.test.php';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute with a type defined
|
* test execute with a type defined
|
||||||
*
|
*
|
||||||
|
@ -436,6 +456,7 @@ class TestTaskTest extends CakeTestCase {
|
||||||
$this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/')));
|
$this->Task->expectAt(0, 'createFile', array('*', new PatternExpectation('/class TestTaskTagTestCase extends CakeTestCase/')));
|
||||||
$this->Task->execute();
|
$this->Task->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test execute with type and class name defined
|
* test execute with type and class name defined
|
||||||
*
|
*
|
||||||
|
|
|
@ -66,9 +66,9 @@ class CakeTestFixtureTestFixture extends CakeTestFixture {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $records = array(
|
var $records = array(
|
||||||
array('name' => 'Gandalf'),
|
array('name' => 'Gandalf', 'created' => '2009-04-28 19:20:00'),
|
||||||
array('name' => 'Captain Picard'),
|
array('name' => 'Captain Picard', 'created' => '2009-04-28 19:20:00'),
|
||||||
array('name' => 'Chewbacca')
|
array('name' => 'Chewbacca', 'created' => '2009-04-28 19:20:00')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
App::import('Controller', array('Component', 'Controller'), false);
|
App::import('Controller', array('Component', 'Controller'), false);
|
||||||
App::import('Component', 'Cookie');
|
App::import('Component', 'Cookie');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CookieComponentTestController class
|
* CookieComponentTestController class
|
||||||
*
|
*
|
||||||
|
|
|
@ -105,6 +105,7 @@ class InflectorTest extends CakeTestCase {
|
||||||
$this->assertEqual(Inflector::singularize('lives'), 'life');
|
$this->assertEqual(Inflector::singularize('lives'), 'life');
|
||||||
$this->assertEqual(Inflector::singularize('knives'), 'knife');
|
$this->assertEqual(Inflector::singularize('knives'), 'knife');
|
||||||
$this->assertEqual(Inflector::singularize('wolves'), 'wolf');
|
$this->assertEqual(Inflector::singularize('wolves'), 'wolf');
|
||||||
|
$this->assertEqual(Inflector::singularize('slaves'), 'slave');
|
||||||
$this->assertEqual(Inflector::singularize('shelves'), 'shelf');
|
$this->assertEqual(Inflector::singularize('shelves'), 'shelf');
|
||||||
$this->assertEqual(Inflector::singularize('taxis'), 'taxi');
|
$this->assertEqual(Inflector::singularize('taxis'), 'taxi');
|
||||||
$this->assertEqual(Inflector::singularize('taxes'), 'tax');
|
$this->assertEqual(Inflector::singularize('taxes'), 'tax');
|
||||||
|
|
|
@ -854,7 +854,7 @@ class L10nTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $l10n->catalog(array('sk'));
|
$result = $l10n->catalog(array('sk'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'sk' => array('language' => 'Slovack', 'locale' => 'slo', 'localeFallback' => 'slo', 'charset' => 'utf-8')
|
'sk' => array('language' => 'Slovak', 'locale' => 'slo', 'localeFallback' => 'slo', 'charset' => 'utf-8')
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1999,9 +1999,14 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$orders = array(
|
||||||
|
'title DESC', 'title DESC, published DESC',
|
||||||
|
array('title' => 'DESC'), array('title' => 'DESC', 'published' => 'DESC'),
|
||||||
|
);
|
||||||
|
foreach ($orders as $order) {
|
||||||
$result = $this->User->find('all', array('contain' => array(
|
$result = $this->User->find('all', array('contain' => array(
|
||||||
'ArticleFeatured' => array(
|
'ArticleFeatured' => array(
|
||||||
'title', 'order' => 'title DESC',
|
'title', 'order' => $order,
|
||||||
'Featured' => array(
|
'Featured' => array(
|
||||||
'category_id',
|
'category_id',
|
||||||
'Category' => 'name'
|
'Category' => 'name'
|
||||||
|
@ -2064,6 +2069,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindThirdLevelNonReset method
|
* testFindThirdLevelNonReset method
|
||||||
|
@ -3249,7 +3255,6 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'Comment.comment !=' => 'Crazy',
|
|
||||||
'Comment.published' => 'Y',
|
'Comment.published' => 'Y',
|
||||||
),
|
),
|
||||||
'contain' => 'User',
|
'contain' => 'User',
|
||||||
|
@ -3260,7 +3265,6 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$dummyResult = $this->Article->Comment->find('all', array(
|
$dummyResult = $this->Article->Comment->find('all', array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'Comment.comment !=' => 'Silly',
|
|
||||||
'User.user' => 'mariano'
|
'User.user' => 'mariano'
|
||||||
),
|
),
|
||||||
'fields' => array('User.password'),
|
'fields' => array('User.password'),
|
||||||
|
@ -3345,7 +3349,6 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$initialOptions = array(
|
$initialOptions = array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'Comment.comment' => '!= Crazy',
|
|
||||||
'Comment.published' => 'Y',
|
'Comment.published' => 'Y',
|
||||||
),
|
),
|
||||||
'contain' => 'User',
|
'contain' => 'User',
|
||||||
|
@ -3356,7 +3359,6 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$findOptions = array(
|
$findOptions = array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'Comment.comment !=' => 'Silly',
|
|
||||||
'User.user' => 'mariano',
|
'User.user' => 'mariano',
|
||||||
),
|
),
|
||||||
'fields' => array('User.password'),
|
'fields' => array('User.password'),
|
||||||
|
@ -3436,7 +3438,8 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'joinTable' => 'articles_tags',
|
'joinTable' => 'articles_tags',
|
||||||
'foreignKey' => 'article_id',
|
'foreignKey' => 'article_id',
|
||||||
'associationForeignKey' => 'tag_id',
|
'associationForeignKey' => 'tag_id',
|
||||||
'conditions' => 'LENGTH(ShortTag.tag) <= 3'
|
// LENGHT function mysql-only, using LIKE does almost the same
|
||||||
|
'conditions' => 'ShortTag.tag LIKE "???"'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -441,6 +441,8 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
$expected = array(1 => 'Titel #1', 2 => 'Titel #2', 3 => 'Titel #3');
|
$expected = array(1 => 'Titel #1', 2 => 'Titel #2', 3 => 'Titel #3');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
// MSSQL trigger an error and stops the page even if the debug = 0
|
||||||
|
if ($this->db->config['driver'] != 'mssql') {
|
||||||
$debug = Configure::read('debug');
|
$debug = Configure::read('debug');
|
||||||
Configure::write('debug', 0);
|
Configure::write('debug', 0);
|
||||||
|
|
||||||
|
@ -450,6 +452,7 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'after'));
|
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'after'));
|
||||||
$this->assertEqual($result, array());
|
$this->assertEqual($result, array());
|
||||||
Configure::write('debug', $debug);
|
Configure::write('debug', $debug);
|
||||||
|
}
|
||||||
|
|
||||||
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'before'));
|
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'before'));
|
||||||
$expected = array(1 => null, 2 => null, 3 => null);
|
$expected = array(1 => null, 2 => null, 3 => null);
|
||||||
|
|
|
@ -47,6 +47,20 @@ class DboMssqlTestDb extends DboMssql {
|
||||||
*/
|
*/
|
||||||
var $simulated = array();
|
var $simulated = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* simalate property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $simulate = true;
|
||||||
|
/**
|
||||||
|
* simalate property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $simulate = true;
|
||||||
/**
|
/**
|
||||||
* fetchAllResultsStack
|
* fetchAllResultsStack
|
||||||
*
|
*
|
||||||
|
@ -63,8 +77,12 @@ class DboMssqlTestDb extends DboMssql {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _execute($sql) {
|
function _execute($sql) {
|
||||||
|
if ($this->simulate) {
|
||||||
$this->simulated[] = $sql;
|
$this->simulated[] = $sql;
|
||||||
return null;
|
return null;
|
||||||
|
} else {
|
||||||
|
return parent::_execute($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,6 +131,15 @@ class DboMssqlTestDb extends DboMssql {
|
||||||
function getPrimaryKey($model) {
|
function getPrimaryKey($model) {
|
||||||
return parent::_getPrimaryKey($model);
|
return parent::_getPrimaryKey($model);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* clearFieldMappings method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function clearFieldMappings() {
|
||||||
|
$this->__fieldMappings = array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,6 +193,28 @@ class MssqlTestModel extends Model {
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* belongsTo property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $belongsTo = array(
|
||||||
|
'MssqlClientTestModel' => array(
|
||||||
|
'foreignKey' => 'client_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* belongsTo property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $belongsTo = array(
|
||||||
|
'MssqlClientTestModel' => array(
|
||||||
|
'foreignKey' => 'client_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* find method
|
* find method
|
||||||
*
|
*
|
||||||
|
@ -206,6 +255,76 @@ class MssqlTestModel extends Model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MssqlClientTestModel class
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.tests.cases.libs.model.datasources
|
||||||
|
*/
|
||||||
|
class MssqlClientTestModel extends Model {
|
||||||
|
/**
|
||||||
|
* name property
|
||||||
|
*
|
||||||
|
* @var string 'MssqlAssociatedTestModel'
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $name = 'MssqlClientTestModel';
|
||||||
|
/**
|
||||||
|
* useTable property
|
||||||
|
*
|
||||||
|
* @var bool false
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $useTable = false;
|
||||||
|
/**
|
||||||
|
* _schema property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
var $_schema = array(
|
||||||
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
||||||
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
|
'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* MssqlClientTestModel class
|
||||||
|
*
|
||||||
|
* @package cake
|
||||||
|
* @subpackage cake.tests.cases.libs.model.datasources
|
||||||
|
*/
|
||||||
|
class MssqlClientTestModel extends Model {
|
||||||
|
/**
|
||||||
|
* name property
|
||||||
|
*
|
||||||
|
* @var string 'MssqlAssociatedTestModel'
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $name = 'MssqlClientTestModel';
|
||||||
|
/**
|
||||||
|
* useTable property
|
||||||
|
*
|
||||||
|
* @var bool false
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $useTable = false;
|
||||||
|
/**
|
||||||
|
* _schema property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
var $_schema = array(
|
||||||
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
||||||
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
|
'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
|
);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* DboMssqlTest class
|
* DboMssqlTest class
|
||||||
*
|
*
|
||||||
|
@ -222,6 +341,34 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
var $db = null;
|
var $db = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* autoFixtures property
|
||||||
|
*
|
||||||
|
* @var bool false
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $autoFixtures = false;
|
||||||
|
/**
|
||||||
|
* fixtures property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $fixtures = array('core.category');
|
||||||
|
/**
|
||||||
|
* autoFixtures property
|
||||||
|
*
|
||||||
|
* @var bool false
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $autoFixtures = false;
|
||||||
|
/**
|
||||||
|
* fixtures property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $fixtures = array('core.category');
|
||||||
/**
|
/**
|
||||||
* Skip if cannot connect to mssql
|
* Skip if cannot connect to mssql
|
||||||
*
|
*
|
||||||
|
@ -232,6 +379,46 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
$this->skipUnless($this->db->config['driver'] == 'mssql', '%s SQL Server connection not available');
|
$this->skipUnless($this->db->config['driver'] == 'mssql', '%s SQL Server connection not available');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure all fixtures tables are being created
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function start() {
|
||||||
|
$this->db->simulate = false;
|
||||||
|
parent::start();
|
||||||
|
$this->db->simulate = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Make sure all fixtures tables are being dropped
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function end() {
|
||||||
|
$this->db->simulate = false;
|
||||||
|
parent::end();
|
||||||
|
$this->db->simulate = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Make sure all fixtures tables are being created
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function start() {
|
||||||
|
$this->db->simulate = false;
|
||||||
|
parent::start();
|
||||||
|
$this->db->simulate = true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Make sure all fixtures tables are being dropped
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function end() {
|
||||||
|
$this->db->simulate = false;
|
||||||
|
parent::end();
|
||||||
|
$this->db->simulate = true;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Sets up a Dbo class instance for testing
|
* Sets up a Dbo class instance for testing
|
||||||
*
|
*
|
||||||
|
@ -260,8 +447,22 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testQuoting() {
|
function testQuoting() {
|
||||||
$result = $this->db->fields($this->model);
|
$expected = "1.2";
|
||||||
$expected = array(
|
$result = $this->db->value(1.2, 'float');
|
||||||
|
$this->assertIdentical($expected, $result);
|
||||||
|
|
||||||
|
$expected = "'1,2'";
|
||||||
|
$result = $this->db->value('1,2', 'float');
|
||||||
|
$this->assertIdentical($expected, $result);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* testFields method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testFields() {
|
||||||
|
$fields = array(
|
||||||
'[MssqlTestModel].[id] AS [MssqlTestModel__0]',
|
'[MssqlTestModel].[id] AS [MssqlTestModel__0]',
|
||||||
'[MssqlTestModel].[client_id] AS [MssqlTestModel__1]',
|
'[MssqlTestModel].[client_id] AS [MssqlTestModel__1]',
|
||||||
'[MssqlTestModel].[name] AS [MssqlTestModel__2]',
|
'[MssqlTestModel].[name] AS [MssqlTestModel__2]',
|
||||||
|
@ -281,15 +482,32 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
'[MssqlTestModel].[created] AS [MssqlTestModel__16]',
|
'[MssqlTestModel].[created] AS [MssqlTestModel__16]',
|
||||||
'CONVERT(VARCHAR(20), [MssqlTestModel].[updated], 20) AS [MssqlTestModel__17]'
|
'CONVERT(VARCHAR(20), [MssqlTestModel].[updated], 20) AS [MssqlTestModel__17]'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$result = $this->db->fields($this->model);
|
||||||
|
$expected = $fields;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$expected = "1.2";
|
$this->db->clearFieldMappings();
|
||||||
$result = $this->db->value(1.2, 'float');
|
$result = $this->db->fields($this->model, null, 'MssqlTestModel.*');
|
||||||
$this->assertIdentical($expected, $result);
|
$expected = $fields;
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$expected = "'1,2'";
|
$this->db->clearFieldMappings();
|
||||||
$result = $this->db->value('1,2', 'float');
|
$result = $this->db->fields($this->model, null, array('*', 'AnotherModel.id', 'AnotherModel.name'));
|
||||||
$this->assertIdentical($expected, $result);
|
$expected = array_merge($fields, array(
|
||||||
|
'[AnotherModel].[id] AS [AnotherModel__18]',
|
||||||
|
'[AnotherModel].[name] AS [AnotherModel__19]'));
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$this->db->clearFieldMappings();
|
||||||
|
$result = $this->db->fields($this->model, null, array('*', 'MssqlClientTestModel.*'));
|
||||||
|
$expected = array_merge($fields, array(
|
||||||
|
'[MssqlClientTestModel].[id] AS [MssqlClientTestModel__18]',
|
||||||
|
'[MssqlClientTestModel].[name] AS [MssqlClientTestModel__19]',
|
||||||
|
'[MssqlClientTestModel].[email] AS [MssqlClientTestModel__20]',
|
||||||
|
'CONVERT(VARCHAR(20), [MssqlClientTestModel].[created], 20) AS [MssqlClientTestModel__21]',
|
||||||
|
'CONVERT(VARCHAR(20), [MssqlClientTestModel].[updated], 20) AS [MssqlClientTestModel__22]'));
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,6 +574,122 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testBuildColumn
|
||||||
|
*
|
||||||
|
* @return unknown_type
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function testBuildColumn() {
|
||||||
|
$column = array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[id] int IDENTITY (1, 1) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int DEFAULT 0 NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => true);
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
// 'name' => 'type' format for columns
|
||||||
|
$column = array('type' => 'integer', 'name' => 'client_id');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('type' => 'string', 'name' => 'name');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) DEFAULT \'\' NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => null, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) DEFAULT \'\'';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* testBuildColumn
|
||||||
|
*
|
||||||
|
* @return unknown_type
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function testBuildColumn() {
|
||||||
|
$column = array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[id] int IDENTITY (1, 1) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int DEFAULT 0 NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'client_id', 'type' => 'integer', 'null' => true);
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
// 'name' => 'type' format for columns
|
||||||
|
$column = array('type' => 'integer', 'name' => 'client_id');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[client_id] int NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('type' => 'string', 'name' => 'name');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) DEFAULT \'\' NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => false, 'default' => null, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NOT NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => null, 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) NULL';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$column = array('name' => 'name', 'type' => 'string', 'null' => true, 'default' => '', 'length' => '255');
|
||||||
|
$result = $this->db->buildColumn($column);
|
||||||
|
$expected = '[name] varchar(255) DEFAULT \'\'';
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* testUpdateAllSyntax method
|
* testUpdateAllSyntax method
|
||||||
*
|
*
|
||||||
|
@ -380,6 +714,7 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function testGetPrimaryKey() {
|
function testGetPrimaryKey() {
|
||||||
|
// When param is a model
|
||||||
$result = $this->db->getPrimaryKey($this->model);
|
$result = $this->db->getPrimaryKey($this->model);
|
||||||
$this->assertEqual($result, 'id');
|
$this->assertEqual($result, 'id');
|
||||||
|
|
||||||
|
@ -388,6 +723,12 @@ class DboMssqlTest extends CakeTestCase {
|
||||||
$this->model->setSchema($schema);
|
$this->model->setSchema($schema);
|
||||||
$result = $this->db->getPrimaryKey($this->model);
|
$result = $this->db->getPrimaryKey($this->model);
|
||||||
$this->assertNull($result);
|
$this->assertNull($result);
|
||||||
|
|
||||||
|
// When param is a table name
|
||||||
|
$this->db->simulate = false;
|
||||||
|
$this->loadFixtures('Category');
|
||||||
|
$result = $this->db->getPrimaryKey('categories');
|
||||||
|
$this->assertEqual($result, 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1332,6 +1332,8 @@ class DboSourceTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->testDb =& new DboTest($this->__config);
|
$this->testDb =& new DboTest($this->__config);
|
||||||
$this->testDb->cacheSources = false;
|
$this->testDb->cacheSources = false;
|
||||||
|
$this->testDb->startQuote = '`';
|
||||||
|
$this->testDb->endQuote = '`';
|
||||||
Configure::write('debug', 1);
|
Configure::write('debug', 1);
|
||||||
$this->debug = Configure::read('debug');
|
$this->debug = Configure::read('debug');
|
||||||
$this->Model =& new TestModel();
|
$this->Model =& new TestModel();
|
||||||
|
@ -1358,6 +1360,7 @@ class DboSourceTest extends CakeTestCase {
|
||||||
function testFieldDoubleEscaping() {
|
function testFieldDoubleEscaping() {
|
||||||
$config = array_merge($this->__config, array('driver' => 'test'));
|
$config = array_merge($this->__config, array('driver' => 'test'));
|
||||||
$test =& ConnectionManager::create('quoteTest', $config);
|
$test =& ConnectionManager::create('quoteTest', $config);
|
||||||
|
$test->simulated = array();
|
||||||
|
|
||||||
$this->Model =& new Article2(array('alias' => 'Article', 'ds' => 'quoteTest'));
|
$this->Model =& new Article2(array('alias' => 'Article', 'ds' => 'quoteTest'));
|
||||||
$this->Model->setDataSource('quoteTest');
|
$this->Model->setDataSource('quoteTest');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelDeleteTest file
|
* ModelDeleteTest file
|
||||||
*
|
*
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
require_once dirname(__FILE__) . DS . 'model.test.php';
|
require_once dirname(__FILE__) . DS . 'model.test.php';
|
||||||
require_once dirname(__FILE__) . DS . 'model_delete.test.php';
|
require_once dirname(__FILE__) . DS . 'model_delete.test.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelDeleteTest
|
* ModelDeleteTest
|
||||||
*
|
*
|
||||||
|
@ -33,6 +35,7 @@ require_once dirname(__FILE__) . DS . 'model_delete.test.php';
|
||||||
* @subpackage cake.tests.cases.libs.model.operations
|
* @subpackage cake.tests.cases.libs.model.operations
|
||||||
*/
|
*/
|
||||||
class ModelDeleteTest extends BaseModelTest {
|
class ModelDeleteTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeleteHabtmReferenceWithConditions method
|
* testDeleteHabtmReferenceWithConditions method
|
||||||
*
|
*
|
||||||
|
@ -123,6 +126,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeleteArticleBLinks method
|
* testDeleteArticleBLinks method
|
||||||
*
|
*
|
||||||
|
@ -151,6 +155,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeleteDependentWithConditions method
|
* testDeleteDependentWithConditions method
|
||||||
*
|
*
|
||||||
|
@ -179,6 +184,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$this->assertTrue(is_array($result));
|
$this->assertTrue(is_array($result));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDel method
|
* testDel method
|
||||||
*
|
*
|
||||||
|
@ -228,7 +234,6 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
// make sure deleting a non-existent record doesn't break save()
|
// make sure deleting a non-existent record doesn't break save()
|
||||||
// ticket #6293
|
// ticket #6293
|
||||||
$this->loadFixtures('Uuid');
|
$this->loadFixtures('Uuid');
|
||||||
|
@ -258,6 +263,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
'id' => 'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3')));
|
'id' => 'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3')));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeleteAll method
|
* testDeleteAll method
|
||||||
*
|
*
|
||||||
|
@ -399,6 +405,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
||||||
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRecursiveDel method
|
* testRecursiveDel method
|
||||||
*
|
*
|
||||||
|
@ -434,6 +441,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$result = $TestModel->Comment->Attachment->find('count');
|
$result = $TestModel->Comment->Attachment->find('count');
|
||||||
$this->assertEqual($result, 0);
|
$this->assertEqual($result, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDependentExclusiveDelete method
|
* testDependentExclusiveDelete method
|
||||||
*
|
*
|
||||||
|
@ -452,6 +460,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$TestModel->delete(1);
|
$TestModel->delete(1);
|
||||||
$this->assertEqual($TestModel->Comment->find('count'), 2);
|
$this->assertEqual($TestModel->Comment->find('count'), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeleteLinks method
|
* testDeleteLinks method
|
||||||
*
|
*
|
||||||
|
@ -499,6 +508,7 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
|
||||||
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable method
|
* testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelDeleteTest file
|
* ModelDeleteTest file
|
||||||
*
|
*
|
||||||
|
@ -34,6 +35,7 @@ require_once dirname(__FILE__) . DS . 'model_integration.test.php';
|
||||||
* @subpackage cake.tests.cases.libs.model.operations
|
* @subpackage cake.tests.cases.libs.model.operations
|
||||||
*/
|
*/
|
||||||
class ModelIntegrationTest extends BaseModelTest {
|
class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPkInHAbtmLinkModelArticleB
|
* testPkInHAbtmLinkModelArticleB
|
||||||
*
|
*
|
||||||
|
@ -45,6 +47,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel2 =& new ArticleB();
|
$TestModel2 =& new ArticleB();
|
||||||
$this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id');
|
$this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that $cacheSources can only be disabled in the db using model settings, not enabled
|
* Tests that $cacheSources can only be disabled in the db using model settings, not enabled
|
||||||
*
|
*
|
||||||
|
@ -64,6 +67,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel->setSource('join_as');
|
$TestModel->setSource('join_as');
|
||||||
$this->assertFalse($this->db->cacheSources);
|
$this->assertFalse($this->db->cacheSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPkInHabtmLinkModel method
|
* testPkInHabtmLinkModel method
|
||||||
*
|
*
|
||||||
|
@ -92,6 +96,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($TestModel4->JoinAsJoinB->primaryKey, 'id');
|
$this->assertEqual($TestModel4->JoinAsJoinB->primaryKey, 'id');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDynamicBehaviorAttachment method
|
* testDynamicBehaviorAttachment method
|
||||||
*
|
*
|
||||||
|
@ -128,6 +133,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($TestModel->Behaviors->attached(), array());
|
$this->assertEqual($TestModel->Behaviors->attached(), array());
|
||||||
$this->assertFalse(isset($TestModel->Behaviors->Tree));
|
$this->assertFalse(isset($TestModel->Behaviors->Tree));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests cross database joins. Requires $test and $test2 to both be set in DATABASE_CONFIG
|
* Tests cross database joins. Requires $test and $test2 to both be set in DATABASE_CONFIG
|
||||||
* NOTE: When testing on MySQL, you must set 'persistent' => false on *both* database connections,
|
* NOTE: When testing on MySQL, you must set 'persistent' => false on *both* database connections,
|
||||||
|
@ -490,6 +496,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->_fixtures[$this->_fixtureClassMap[$class]]->drop($db2);
|
$this->_fixtures[$this->_fixtureClassMap[$class]]->drop($db2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDisplayField method
|
* testDisplayField method
|
||||||
*
|
*
|
||||||
|
@ -506,6 +513,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($Person->displayField, 'name');
|
$this->assertEqual($Person->displayField, 'name');
|
||||||
$this->assertEqual($Comment->displayField, 'id');
|
$this->assertEqual($Comment->displayField, 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSchema method
|
* testSchema method
|
||||||
*
|
*
|
||||||
|
@ -528,6 +536,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($Post->getColumnTypes(), array_combine($columns, $types));
|
$this->assertEqual($Post->getColumnTypes(), array_combine($columns, $types));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test deconstruct() with time fields.
|
* test deconstruct() with time fields.
|
||||||
*
|
*
|
||||||
|
@ -613,6 +622,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$this->assertEqual($TestModel->data, $data);
|
$this->assertEqual($TestModel->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDeconstructFields with datetime, timestamp, and date fields
|
* testDeconstructFields with datetime, timestamp, and date fields
|
||||||
*
|
*
|
||||||
|
@ -789,6 +799,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$this->assertEqual($TestModel->data, $data);
|
$this->assertEqual($TestModel->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testTablePrefixSwitching method
|
* testTablePrefixSwitching method
|
||||||
*
|
*
|
||||||
|
@ -842,6 +853,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($db2->fullTableName($TestModel, false), 'apples');
|
$this->assertEqual($db2->fullTableName($TestModel, false), 'apples');
|
||||||
$this->assertEqual($db1->fullTableName($TestModel, false), 'apples');
|
$this->assertEqual($db1->fullTableName($TestModel, false), 'apples');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests validation parameter order in custom validation methods
|
* Tests validation parameter order in custom validation methods
|
||||||
*
|
*
|
||||||
|
@ -852,6 +864,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel =& new ValidationTest1();
|
$TestModel =& new ValidationTest1();
|
||||||
$this->assertNull($TestModel->getAssociated('Foo'));
|
$this->assertNull($TestModel->getAssociated('Foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testLoadModelSecondIteration method
|
* testLoadModelSecondIteration method
|
||||||
*
|
*
|
||||||
|
@ -868,6 +881,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertIsA($model->ModelC, 'ModelC');
|
$this->assertIsA($model->ModelC, 'ModelC');
|
||||||
$this->assertIsA($model->ModelC->ModelD, 'ModelD');
|
$this->assertIsA($model->ModelC->ModelD, 'ModelD');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ensure that __exists is reset on create
|
* ensure that __exists is reset on create
|
||||||
*
|
*
|
||||||
|
@ -889,6 +903,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$result = $Article->read(null, 2);
|
$result = $Article->read(null, 2);
|
||||||
$this->assertEqual($result['Article']['title'], 'Staying alive');
|
$this->assertEqual($result['Article']['title'], 'Staying alive');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPluginAssociations method
|
* testPluginAssociations method
|
||||||
*
|
*
|
||||||
|
@ -1013,6 +1028,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests getAssociated method
|
* Tests getAssociated method
|
||||||
*
|
*
|
||||||
|
@ -1161,6 +1177,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($TestModel->Tag->name, 'Tag');
|
$this->assertEqual($TestModel->Tag->name, 'Tag');
|
||||||
$this->assertEqual($TestFakeModel->Tag->name, 'Tag');
|
$this->assertEqual($TestFakeModel->Tag->name, 'Tag');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Model::__construct
|
* test Model::__construct
|
||||||
*
|
*
|
||||||
|
@ -1181,6 +1198,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($TestModel->actsAs, $expected);
|
$this->assertEqual($TestModel->actsAs, $expected);
|
||||||
$this->assertTrue(isset($TestModel->Behaviors->Containable));
|
$this->assertTrue(isset($TestModel->Behaviors->Containable));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Model::__construct
|
* test Model::__construct
|
||||||
*
|
*
|
||||||
|
@ -1198,6 +1216,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$NewVoid =& new TheVoid(null, false, 'other');
|
$NewVoid =& new TheVoid(null, false, 'other');
|
||||||
$this->assertEqual('other', $NewVoid->useDbConfig);
|
$this->assertEqual('other', $NewVoid->useDbConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testColumnTypeFetching method
|
* testColumnTypeFetching method
|
||||||
*
|
*
|
||||||
|
@ -1216,6 +1235,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEqual($model->getColumnType('Tag.id'), 'integer');
|
$this->assertEqual($model->getColumnType('Tag.id'), 'integer');
|
||||||
$this->assertEqual($model->getColumnType('Article.id'), 'integer');
|
$this->assertEqual($model->getColumnType('Article.id'), 'integer');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmUniqueKey method
|
* testHabtmUniqueKey method
|
||||||
*
|
*
|
||||||
|
@ -1226,6 +1246,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$model =& new Item();
|
$model =& new Item();
|
||||||
$this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']);
|
$this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testIdentity method
|
* testIdentity method
|
||||||
*
|
*
|
||||||
|
@ -1248,6 +1269,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$expected = 'AnotherTest';
|
$expected = 'AnotherTest';
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testWithAssociation method
|
* testWithAssociation method
|
||||||
*
|
*
|
||||||
|
@ -1499,6 +1521,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindSelfAssociations method
|
* testFindSelfAssociations method
|
||||||
*
|
*
|
||||||
|
@ -1608,6 +1631,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDynamicAssociations method
|
* testDynamicAssociations method
|
||||||
*
|
*
|
||||||
|
@ -1715,6 +1739,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreation method
|
* testCreation method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelReadTest file
|
* ModelReadTest file
|
||||||
*
|
*
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
require_once dirname(__FILE__) . DS . 'model.test.php';
|
require_once dirname(__FILE__) . DS . 'model.test.php';
|
||||||
require_once dirname(__FILE__) . DS . 'model_read.test.php';
|
require_once dirname(__FILE__) . DS . 'model_read.test.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelReadTest
|
* ModelReadTest
|
||||||
*
|
*
|
||||||
|
@ -33,6 +35,7 @@ require_once dirname(__FILE__) . DS . 'model_read.test.php';
|
||||||
* @subpackage cake.tests.cases.libs.model.operations
|
* @subpackage cake.tests.cases.libs.model.operations
|
||||||
*/
|
*/
|
||||||
class ModelReadTest extends BaseModelTest {
|
class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFetchingNonUniqueFKJoinTableRecords()
|
* testFetchingNonUniqueFKJoinTableRecords()
|
||||||
*
|
*
|
||||||
|
@ -70,6 +73,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertEqual($result['SomethingElse'][0]['JoinThing']['doomed'], 1);
|
$this->assertEqual($result['SomethingElse'][0]['JoinThing']['doomed'], 1);
|
||||||
$this->assertEqual($result['SomethingElse'][1]['JoinThing']['doomed'], 0);
|
$this->assertEqual($result['SomethingElse'][1]['JoinThing']['doomed'], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testGroupBy method
|
* testGroupBy method
|
||||||
*
|
*
|
||||||
|
@ -196,28 +200,24 @@ class ModelReadTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$result = $Thread->find('all', array(
|
$result = $Thread->find('all', array(
|
||||||
'conditions' => array('Thread.project_id' => 1),
|
'conditions' => array('Thread.project_id' => 1),
|
||||||
'group' => array('project_id')
|
'group' => array('project_id')
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$result = $Thread->find('all', array(
|
$result = $Thread->find('all', array(
|
||||||
'conditions' => array('Thread.project_id' => 1),
|
'conditions' => array('Thread.project_id' => 1),
|
||||||
'group' => array('project_id', 'Project.id')
|
'group' => array('project_id', 'Project.id')
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$result = $Thread->find('all', array(
|
$result = $Thread->find('all', array(
|
||||||
'conditions' => array('Thread.project_id' => 1),
|
'conditions' => array('Thread.project_id' => 1),
|
||||||
'group' => array('Thread.project_id', 'Project.id')
|
'group' => array('Thread.project_id', 'Project.id')
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Product' => array('type' => 'Clothing'), array('price' => 32)),
|
array('Product' => array('type' => 'Clothing'), array('price' => 32)),
|
||||||
array('Product' => array('type' => 'Food'), array('price' => 9)),
|
array('Product' => array('type' => 'Food'), array('price' => 9)),
|
||||||
|
@ -237,6 +237,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'order' => 'Product.type ASC'));
|
'order' => 'Product.type ASC'));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testOldQuery method
|
* testOldQuery method
|
||||||
*
|
*
|
||||||
|
@ -272,6 +273,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertTrue(isset($this->db->_queryCache[$query]));
|
$this->assertTrue(isset($this->db->_queryCache[$query]));
|
||||||
$this->assertTrue(is_array($results));
|
$this->assertTrue(is_array($results));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPreparedQuery method
|
* testPreparedQuery method
|
||||||
*
|
*
|
||||||
|
@ -353,6 +355,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertTrue(isset($this->db->_queryCache[$expected]));
|
$this->assertTrue(isset($this->db->_queryCache[$expected]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testParameterMismatch method
|
* testParameterMismatch method
|
||||||
*
|
*
|
||||||
|
@ -374,6 +377,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEqual($result, null);
|
$this->assertEqual($result, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testVeryStrangeUseCase method
|
* testVeryStrangeUseCase method
|
||||||
*
|
*
|
||||||
|
@ -403,6 +407,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $Article->query($query, $param);
|
$result = $Article->query($query, $param);
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRecursiveUnbind method
|
* testRecursiveUnbind method
|
||||||
*
|
*
|
||||||
|
@ -2997,6 +3002,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSelfAssociationAfterFind method
|
* testSelfAssociationAfterFind method
|
||||||
*
|
*
|
||||||
|
@ -3024,6 +3030,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
}
|
}
|
||||||
$this->assertEqual($afterFindData, $noAfterFindData);
|
$this->assertEqual($afterFindData, $noAfterFindData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindAllThreaded method
|
* testFindAllThreaded method
|
||||||
*
|
*
|
||||||
|
@ -3500,6 +3507,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test find('neighbors')
|
* test find('neighbors')
|
||||||
*
|
*
|
||||||
|
@ -3933,6 +3941,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveEmpty method
|
* testSaveEmpty method
|
||||||
*
|
*
|
||||||
|
@ -4045,7 +4054,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$conditions = array('id' => array('1', 2, '3.0'));
|
$conditions = array('id' => array('1', 2, '3.0'));
|
||||||
$order = 'Article.id ASC';
|
$order = 'Article.id ASC';
|
||||||
$result = $TestModel->find('all', compact('recursive', 'conditions', 'order'));
|
$result = $TestModel->find('all', compact('recursive', 'conditions', 'order'));
|
||||||
|
@ -4086,6 +4094,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBindUnbind method
|
* testBindUnbind method
|
||||||
*
|
*
|
||||||
|
@ -4545,6 +4554,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertEqual($TestModel2->hasMany['NewFeatureSet'], $expected);
|
$this->assertEqual($TestModel2->hasMany['NewFeatureSet'], $expected);
|
||||||
$this->assertTrue(is_object($TestModel2->NewFeatureSet));
|
$this->assertTrue(is_object($TestModel2->NewFeatureSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBindMultipleTimes method
|
* testBindMultipleTimes method
|
||||||
*
|
*
|
||||||
|
@ -4825,6 +4835,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result[0]['Post'][0]['Comment'][0], $expected);
|
$this->assertEqual($result[0]['Post'][0]['Comment'][0], $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that callbacks can be properly disabled
|
* Tests that callbacks can be properly disabled
|
||||||
*
|
*
|
||||||
|
@ -4851,6 +4862,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$expected = array('mariano', 'nate', 'larry', 'garrett');
|
$expected = array('mariano', 'nate', 'larry', 'garrett');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testMultipleBelongsToWithSameClass method
|
* testMultipleBelongsToWithSameClass method
|
||||||
*
|
*
|
||||||
|
@ -4949,6 +4961,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmRecursiveBelongsTo method
|
* testHabtmRecursiveBelongsTo method
|
||||||
*
|
*
|
||||||
|
@ -5007,6 +5020,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmFinderQuery method
|
* testHabtmFinderQuery method
|
||||||
*
|
*
|
||||||
|
@ -5055,6 +5069,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result['Tag'], $expected);
|
$this->assertEqual($result['Tag'], $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmLimitOptimization method
|
* testHabtmLimitOptimization method
|
||||||
*
|
*
|
||||||
|
@ -5125,6 +5140,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHasManyLimitOptimization method
|
* testHasManyLimitOptimization method
|
||||||
*
|
*
|
||||||
|
@ -5239,6 +5255,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindAllRecursiveSelfJoin method
|
* testFindAllRecursiveSelfJoin method
|
||||||
*
|
*
|
||||||
|
@ -5344,10 +5361,8 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)))));
|
)))));
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindAllRecursiveWithHabtm method
|
* testFindAllRecursiveWithHabtm method
|
||||||
*
|
*
|
||||||
|
@ -5416,6 +5431,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertIdentical($result, $expected);
|
$this->assertIdentical($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testReadFakeThread method
|
* testReadFakeThread method
|
||||||
*
|
*
|
||||||
|
@ -5480,6 +5496,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->db->fullDebug = $fullDebug;
|
$this->db->fullDebug = $fullDebug;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindFakeThread method
|
* testFindFakeThread method
|
||||||
*
|
*
|
||||||
|
@ -5544,6 +5561,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->db->fullDebug = $fullDebug;
|
$this->db->fullDebug = $fullDebug;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindAllFakeThread method
|
* testFindAllFakeThread method
|
||||||
*
|
*
|
||||||
|
@ -5764,6 +5782,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->db->fullDebug = $fullDebug;
|
$this->db->fullDebug = $fullDebug;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testConditionalNumerics method
|
* testConditionalNumerics method
|
||||||
*
|
*
|
||||||
|
@ -6011,6 +6030,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test find('list') method
|
* test find('list') method
|
||||||
*
|
*
|
||||||
|
@ -6274,6 +6294,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindField method
|
* testFindField method
|
||||||
*
|
*
|
||||||
|
@ -6303,6 +6324,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->field('COUNT(*)', true);
|
$result = $TestModel->field('COUNT(*)', true);
|
||||||
$this->assertEqual($result, 4);
|
$this->assertEqual($result, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindUnique method
|
* testFindUnique method
|
||||||
*
|
*
|
||||||
|
@ -6325,6 +6347,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'password' => '5f4dcc3b5aa765d61d8327deb882cf99'
|
'password' => '5f4dcc3b5aa765d61d8327deb882cf99'
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test find('count') method
|
* test find('count') method
|
||||||
*
|
*
|
||||||
|
@ -6371,6 +6394,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->find('count', array('fields' => 'DISTINCT name'));
|
$result = $TestModel->find('count', array('fields' => 'DISTINCT name'));
|
||||||
$this->assertEqual($result, 4);
|
$this->assertEqual($result, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test find(count) with Db::expression
|
* Test find(count) with Db::expression
|
||||||
*
|
*
|
||||||
|
@ -6395,6 +6419,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, 1);
|
$this->assertEqual($result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFindMagic method
|
* testFindMagic method
|
||||||
*
|
*
|
||||||
|
@ -6426,6 +6451,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRead method
|
* testRead method
|
||||||
*
|
*
|
||||||
|
@ -6506,6 +6532,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRecursiveRead method
|
* testRecursiveRead method
|
||||||
*
|
*
|
||||||
|
@ -6932,6 +6959,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRecursiveFindAllWithLimit method
|
* testRecursiveFindAllWithLimit method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelValidationTest file
|
* ModelValidationTest file
|
||||||
*
|
*
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
require_once dirname(__FILE__) . DS . 'model.test.php';
|
require_once dirname(__FILE__) . DS . 'model.test.php';
|
||||||
require_once dirname(__FILE__) . DS . 'model_validation.test.php';
|
require_once dirname(__FILE__) . DS . 'model_validation.test.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelValidationTest
|
* ModelValidationTest
|
||||||
*
|
*
|
||||||
|
@ -33,6 +35,7 @@ require_once dirname(__FILE__) . DS . 'model_validation.test.php';
|
||||||
* @subpackage cake.tests.cases.libs.model.operations
|
* @subpackage cake.tests.cases.libs.model.operations
|
||||||
*/
|
*/
|
||||||
class ModelValidationTest extends BaseModelTest {
|
class ModelValidationTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests validation parameter order in custom validation methods
|
* Tests validation parameter order in custom validation methods
|
||||||
*
|
*
|
||||||
|
@ -74,6 +77,7 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($TestModel->invalidFields(), $expected);
|
$this->assertEqual($TestModel->invalidFields(), $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests validation parameter fieldList in invalidFields
|
* Tests validation parameter fieldList in invalidFields
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
/* SVN FILE: $Id: model.test.php 8225 2009-07-08 03:25:30Z mark_story $ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelWriteTest file
|
* ModelWriteTest file
|
||||||
*
|
*
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
require_once dirname(__FILE__) . DS . 'model.test.php';
|
require_once dirname(__FILE__) . DS . 'model.test.php';
|
||||||
require_once dirname(__FILE__) . DS . 'model_write.test.php';
|
require_once dirname(__FILE__) . DS . 'model_write.test.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelWriteTest
|
* ModelWriteTest
|
||||||
*
|
*
|
||||||
|
@ -33,6 +35,7 @@ require_once dirname(__FILE__) . DS . 'model_write.test.php';
|
||||||
* @subpackage cake.tests.cases.libs.model.operations
|
* @subpackage cake.tests.cases.libs.model.operations
|
||||||
*/
|
*/
|
||||||
class ModelWriteTest extends BaseModelTest {
|
class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testInsertAnotherHabtmRecordWithSameForeignKey method
|
* testInsertAnotherHabtmRecordWithSameForeignKey method
|
||||||
*
|
*
|
||||||
|
@ -87,6 +90,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->JoinAsJoinB->findById(1);
|
$result = $TestModel->JoinAsJoinB->findById(1);
|
||||||
$this->assertEqual($result['JoinAsJoinB']['other'], $updatedValue);
|
$this->assertEqual($result['JoinAsJoinB']['other'], $updatedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveDateAsFirstEntry method
|
* testSaveDateAsFirstEntry method
|
||||||
*
|
*
|
||||||
|
@ -117,6 +121,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual($testResult['Article']['created'], '2008-01-01 00:00:00');
|
$this->assertEqual($testResult['Article']['created'], '2008-01-01 00:00:00');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUnderscoreFieldSave method
|
* testUnderscoreFieldSave method
|
||||||
*
|
*
|
||||||
|
@ -142,6 +147,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$currentCount = $UnderscoreField->find('count');
|
$currentCount = $UnderscoreField->find('count');
|
||||||
$this->assertEqual($currentCount, 4);
|
$this->assertEqual($currentCount, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAutoSaveUuid method
|
* testAutoSaveUuid method
|
||||||
*
|
*
|
||||||
|
@ -149,12 +155,8 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testAutoSaveUuid() {
|
function testAutoSaveUuid() {
|
||||||
// SQLite does not support non-integer primary keys, and SQL Server
|
// SQLite does not support non-integer primary keys
|
||||||
// is still having problems with custom PK's
|
$this->skipIf($this->db->config['driver'] == 'sqlite');
|
||||||
$this->skipIf(
|
|
||||||
$this->db->config['driver'] == 'sqlite'
|
|
||||||
|| $this->db->config['driver'] == 'mssql'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->loadFixtures('Uuid');
|
$this->loadFixtures('Uuid');
|
||||||
$TestModel =& new Uuid();
|
$TestModel =& new Uuid();
|
||||||
|
@ -167,6 +169,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual(strlen($result['Uuid']['id']), 36);
|
$this->assertEqual(strlen($result['Uuid']['id']), 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testZeroDefaultFieldValue method
|
* testZeroDefaultFieldValue method
|
||||||
*
|
*
|
||||||
|
@ -187,6 +190,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertIdentical($result['DataTest']['count'], '0');
|
$this->assertIdentical($result['DataTest']['count'], '0');
|
||||||
$this->assertIdentical($result['DataTest']['float'], '0');
|
$this->assertIdentical($result['DataTest']['float'], '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testNonNumericHabtmJoinKey method
|
* testNonNumericHabtmJoinKey method
|
||||||
*
|
*
|
||||||
|
@ -285,6 +289,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests validation parameter order in custom validation methods
|
* Tests validation parameter order in custom validation methods
|
||||||
*
|
*
|
||||||
|
@ -305,6 +310,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($TestModel->data, $expected);
|
$this->assertEqual($TestModel->data, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that Caches are getting cleared on save().
|
* test that Caches are getting cleared on save().
|
||||||
* ensure that both inflections of controller names are getting cleared
|
* ensure that both inflections of controller names are getting cleared
|
||||||
|
@ -342,6 +348,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
Configure::write('Cache.check', $_back['check']);
|
Configure::write('Cache.check', $_back['check']);
|
||||||
Configure::write('Cache.disable', $_back['disable']);
|
Configure::write('Cache.disable', $_back['disable']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveWithCounterCache method
|
* testSaveWithCounterCache method
|
||||||
*
|
*
|
||||||
|
@ -378,6 +385,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->findById(2);
|
$result = $TestModel->findById(2);
|
||||||
$this->assertIdentical($result['Syfile']['item_count'], '0');
|
$this->assertIdentical($result['Syfile']['item_count'], '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that counter caches are updated when records are added
|
* Tests that counter caches are updated when records are added
|
||||||
*
|
*
|
||||||
|
@ -403,6 +411,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$expected = 3;
|
$expected = 3;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that counter caches are updated when records are deleted
|
* Tests that counter caches are updated when records are deleted
|
||||||
*
|
*
|
||||||
|
@ -424,6 +433,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$expected = 1;
|
$expected = 1;
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that counter caches are updated when foreign keys of counted records change
|
* Tests that counter caches are updated when foreign keys of counted records change
|
||||||
*
|
*
|
||||||
|
@ -446,6 +456,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual($users[0]['User']['post_count'], 1);
|
$this->assertEqual($users[0]['User']['post_count'], 1);
|
||||||
$this->assertEqual($users[1]['User']['post_count'], 2);
|
$this->assertEqual($users[1]['User']['post_count'], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test counter cache with models that use a non-standard (i.e. not using 'id')
|
* Test counter cache with models that use a non-standard (i.e. not using 'id')
|
||||||
* as their primary key.
|
* as their primary key.
|
||||||
|
@ -502,6 +513,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$expected = array_fill(0, 1, 1);
|
$expected = array_fill(0, 1, 1);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveWithCounterCacheScope method
|
* testSaveWithCounterCacheScope method
|
||||||
*
|
*
|
||||||
|
@ -541,6 +553,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->findById(1);
|
$result = $TestModel->findById(1);
|
||||||
$this->assertIdentical($result['Syfile']['item_count'], '1');
|
$this->assertIdentical($result['Syfile']['item_count'], '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testValidatesBackwards method
|
* testValidatesBackwards method
|
||||||
*
|
*
|
||||||
|
@ -606,6 +619,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->validates();
|
$result = $TestModel->validates();
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testValidates method
|
* testValidates method
|
||||||
*
|
*
|
||||||
|
@ -958,6 +972,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveField method
|
* testSaveField method
|
||||||
*
|
*
|
||||||
|
@ -1026,6 +1041,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $Node->read();
|
$result = $Node->read();
|
||||||
$this->assertEqual(Set::extract('/ParentNode/name', $result), array('Second'));
|
$this->assertEqual(Set::extract('/ParentNode/name', $result), array('Second'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveWithCreate method
|
* testSaveWithCreate method
|
||||||
*
|
*
|
||||||
|
@ -1247,6 +1263,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveWithSet method
|
* testSaveWithSet method
|
||||||
*
|
*
|
||||||
|
@ -1374,6 +1391,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveWithNonExistentFields method
|
* testSaveWithNonExistentFields method
|
||||||
*
|
*
|
||||||
|
@ -1425,6 +1443,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->read(array('id', 'user_id', 'title', 'body', 'published'), 5);
|
$result = $TestModel->read(array('id', 'user_id', 'title', 'body', 'published'), 5);
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveFromXml method
|
* testSaveFromXml method
|
||||||
*
|
*
|
||||||
|
@ -1442,6 +1461,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$results = $Article->find(array('Article.title' => 'test xml'));
|
$results = $Article->find(array('Article.title' => 'test xml'));
|
||||||
$this->assertTrue($results);
|
$this->assertTrue($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveHabtm method
|
* testSaveHabtm method
|
||||||
*
|
*
|
||||||
|
@ -1913,6 +1933,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$expected = array('new record', 'new record');
|
$expected = array('new record', 'new record');
|
||||||
$this->assertEqual(Set::extract('/JoinC/JoinAsJoinC/other', $result), $expected);
|
$this->assertEqual(Set::extract('/JoinC/JoinAsJoinC/other', $result), $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveHabtmCustomKeys method
|
* testSaveHabtmCustomKeys method
|
||||||
*
|
*
|
||||||
|
@ -1963,6 +1984,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmSaveKeyResolution method
|
* testHabtmSaveKeyResolution method
|
||||||
*
|
*
|
||||||
|
@ -2052,6 +2074,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEqual($result['Monkey'], $expected);
|
$this->assertEqual($result['Monkey'], $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreationOfEmptyRecord method
|
* testCreationOfEmptyRecord method
|
||||||
*
|
*
|
||||||
|
@ -2071,6 +2094,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertTrue(isset($result['Author']['updated']));
|
$this->assertTrue(isset($result['Author']['updated']));
|
||||||
$this->assertEqual($TestModel->find('count'), 1);
|
$this->assertEqual($TestModel->find('count'), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreateWithPKFiltering method
|
* testCreateWithPKFiltering method
|
||||||
*
|
*
|
||||||
|
@ -2167,6 +2191,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
$this->assertFalse($TestModel->id);
|
$this->assertFalse($TestModel->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreationWithMultipleData method
|
* testCreationWithMultipleData method
|
||||||
*
|
*
|
||||||
|
@ -2338,6 +2363,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
))));
|
))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreationWithMultipleDataSameModel method
|
* testCreationWithMultipleDataSameModel method
|
||||||
*
|
*
|
||||||
|
@ -2396,6 +2422,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
'title' => 'Brand New Article'
|
'title' => 'Brand New Article'
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testCreationWithMultipleDataSameModelManualInstances method
|
* testCreationWithMultipleDataSameModelManualInstances method
|
||||||
*
|
*
|
||||||
|
@ -2434,6 +2461,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $Primary->find('count');
|
$result = $Primary->find('count');
|
||||||
$this->assertEqual($result, 2);
|
$this->assertEqual($result, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRecordExists method
|
* testRecordExists method
|
||||||
*
|
*
|
||||||
|
@ -2457,6 +2485,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$TestModel->id = 5;
|
$TestModel->id = 5;
|
||||||
$this->assertFalse($TestModel->exists());
|
$this->assertFalse($TestModel->exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUpdateExisting method
|
* testUpdateExisting method
|
||||||
*
|
*
|
||||||
|
@ -2504,6 +2533,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $Comment->save($data);
|
$result = $Comment->save($data);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUpdateMultiple method
|
* testUpdateMultiple method
|
||||||
*
|
*
|
||||||
|
@ -2537,6 +2567,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$expected = array_fill(0, 2, 'Updated today');
|
$expected = array_fill(0, 2, 'Updated today');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHabtmUuidWithUuidId method
|
* testHabtmUuidWithUuidId method
|
||||||
*
|
*
|
||||||
|
@ -2556,6 +2587,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual(1, count($result['Uuiditem']));
|
$this->assertEqual(1, count($result['Uuiditem']));
|
||||||
$this->assertEqual(strlen($result['Uuiditem'][0]['UuiditemsUuidportfolio']['id']), 36);
|
$this->assertEqual(strlen($result['Uuiditem'][0]['UuiditemsUuidportfolio']['id']), 36);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test HABTM saving when join table has no primary key and only 2 columns.
|
* test HABTM saving when join table has no primary key and only 2 columns.
|
||||||
*
|
*
|
||||||
|
@ -2579,6 +2611,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertTrue($Fruit->save($data));
|
$this->assertTrue($Fruit->save($data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test HABTM saving when join table has no primary key and only 2 columns, no with model is used.
|
* test HABTM saving when join table has no primary key and only 2 columns, no with model is used.
|
||||||
*
|
*
|
||||||
|
@ -2621,6 +2654,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->read(null, $id);
|
$result = $TestModel->read(null, $id);
|
||||||
$this->assertEqual(1, count($result['Uuidportfolio']));
|
$this->assertEqual(1, count($result['Uuidportfolio']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveMultipleHabtm method
|
* testSaveMultipleHabtm method
|
||||||
*
|
*
|
||||||
|
@ -2739,6 +2773,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAll method
|
* testSaveAll method
|
||||||
*
|
*
|
||||||
|
@ -2878,6 +2913,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result[6]['Attachment'], $expected);
|
$this->assertEqual($result[6]['Attachment'], $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test SaveAll with Habtm relations
|
* Test SaveAll with Habtm relations
|
||||||
*
|
*
|
||||||
|
@ -2909,6 +2945,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual(count($result['Comment']), 1);
|
$this->assertEqual(count($result['Comment']), 1);
|
||||||
$this->assertEqual(count($result['Comment'][0]['comment']['Article comment']), 1);
|
$this->assertEqual(count($result['Comment'][0]['comment']['Article comment']), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test SaveAll with Habtm relations and extra join table fields
|
* Test SaveAll with Habtm relations and extra join table fields
|
||||||
*
|
*
|
||||||
|
@ -2952,6 +2989,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[something_else_id=3]', $result));
|
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[something_else_id=3]', $result));
|
||||||
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[doomed=1]', $result));
|
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[doomed=1]', $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllHasOne method
|
* testSaveAllHasOne method
|
||||||
*
|
*
|
||||||
|
@ -2991,6 +3029,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllBelongsTo method
|
* testSaveAllBelongsTo method
|
||||||
*
|
*
|
||||||
|
@ -3030,6 +3069,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllHasOneValidation method
|
* testSaveAllHasOneValidation method
|
||||||
*
|
*
|
||||||
|
@ -3076,6 +3116,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEqual($model->validationErrors, $expected['Comment']);
|
$this->assertEqual($model->validationErrors, $expected['Comment']);
|
||||||
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
|
$this->assertEqual($model->Attachment->validationErrors, $expected['Attachment']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllAtomic method
|
* testSaveAllAtomic method
|
||||||
*
|
*
|
||||||
|
@ -3149,6 +3190,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
), array('atomic' => false));
|
), array('atomic' => false));
|
||||||
$this->assertIdentical($result, array('Article' => true, 'Comment' => array(true, true)));
|
$this->assertIdentical($result, array('Article' => true, 'Comment' => array(true, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllHasMany method
|
* testSaveAllHasMany method
|
||||||
*
|
*
|
||||||
|
@ -3225,6 +3267,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual(Set::extract($result['Comment'], '{n}.comment'), $expected);
|
$this->assertEqual(Set::extract($result['Comment'], '{n}.comment'), $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllHasManyValidation method
|
* testSaveAllHasManyValidation method
|
||||||
*
|
*
|
||||||
|
@ -3265,6 +3308,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
))
|
))
|
||||||
), array('validate' => 'only'));
|
), array('validate' => 'only'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllTransaction method
|
* testSaveAllTransaction method
|
||||||
*
|
*
|
||||||
|
@ -3654,6 +3698,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->validate['body'] = 'notEmpty';
|
$TestModel->validate['body'] = 'notEmpty';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllValidationOnly method
|
* testSaveAllValidationOnly method
|
||||||
*
|
*
|
||||||
|
@ -3706,6 +3751,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($TestModel->validationErrors, $expected);
|
$this->assertEqual($TestModel->validationErrors, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllValidateFirst method
|
* testSaveAllValidateFirst method
|
||||||
*
|
*
|
||||||
|
@ -3784,6 +3830,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
$this->assertEqual($result[0]['Comment'][0]['comment'], 'Only new comment');
|
$this->assertEqual($result[0]['Comment'][0]['comment'], 'Only new comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUpdateWithCalculation method
|
* testUpdateWithCalculation method
|
||||||
*
|
*
|
||||||
|
@ -3812,6 +3859,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = Set::extract('/DataTest/count', $model->find('all', array('fields' => 'count')));
|
$result = Set::extract('/DataTest/count', $model->find('all', array('fields' => 'count')));
|
||||||
$this->assertEqual($result, array(6, 4, 5, 2));
|
$this->assertEqual($result, array(6, 4, 5, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAllHasManyValidationOnly method
|
* testSaveAllHasManyValidationOnly method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1777,7 +1777,6 @@ class SetTest extends CakeTestCase {
|
||||||
$result = Set::reverse($class);
|
$result = Set::reverse($class);
|
||||||
$this->assertIdentical($result, $expected);
|
$this->assertIdentical($result, $expected);
|
||||||
|
|
||||||
uses('model'.DS.'model');
|
|
||||||
$model = new Model(array('id' => false, 'name' => 'Model', 'table' => false));
|
$model = new Model(array('id' => false, 'name' => 'Model', 'table' => false));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Behaviors' => array('modelName' => 'Model', '_attached' => array(), '_disabled' => array(), '__methods' => array(), '__mappedMethods' => array(), '_log' => null),
|
'Behaviors' => array('modelName' => 'Model', '_attached' => array(), '_disabled' => array(), '__methods' => array(), '__mappedMethods' => array(), '_log' => null),
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AjaxHelperTest file
|
* AjaxHelperTest file
|
||||||
*
|
*
|
||||||
|
@ -28,17 +27,7 @@
|
||||||
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
||||||
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
||||||
}
|
}
|
||||||
uses(
|
App::import('Helper', array('Html', 'Form', 'Javascript', 'Ajax'));
|
||||||
'view' . DS . 'helpers' . DS . 'app_helper',
|
|
||||||
'controller' . DS . 'controller',
|
|
||||||
'model' . DS . 'model',
|
|
||||||
'view' . DS . 'helper',
|
|
||||||
'view' . DS . 'helpers'.DS.'ajax',
|
|
||||||
'view' . DS . 'helpers' . DS . 'html',
|
|
||||||
'view' . DS . 'helpers' . DS . 'form',
|
|
||||||
'view' . DS . 'helpers' . DS . 'javascript'
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AjaxTestController class
|
* AjaxTestController class
|
||||||
*
|
*
|
||||||
|
@ -46,7 +35,6 @@ uses(
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class AjaxTestController extends Controller {
|
class AjaxTestController extends Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
|
@ -54,7 +42,6 @@ class AjaxTestController extends Controller {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $name = 'AjaxTest';
|
var $name = 'AjaxTest';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uses property
|
* uses property
|
||||||
*
|
*
|
||||||
|
@ -63,7 +50,6 @@ class AjaxTestController extends Controller {
|
||||||
*/
|
*/
|
||||||
var $uses = null;
|
var $uses = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PostAjaxTest class
|
* PostAjaxTest class
|
||||||
*
|
*
|
||||||
|
@ -71,7 +57,6 @@ class AjaxTestController extends Controller {
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class PostAjaxTest extends Model {
|
class PostAjaxTest extends Model {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* primaryKey property
|
* primaryKey property
|
||||||
*
|
*
|
||||||
|
@ -79,7 +64,6 @@ class PostAjaxTest extends Model {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $primaryKey = 'id';
|
var $primaryKey = 'id';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* useTable property
|
* useTable property
|
||||||
*
|
*
|
||||||
|
@ -87,7 +71,6 @@ class PostAjaxTest extends Model {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $useTable = false;
|
var $useTable = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schema method
|
* schema method
|
||||||
*
|
*
|
||||||
|
@ -103,7 +86,6 @@ class PostAjaxTest extends Model {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestAjaxHelper class
|
* TestAjaxHelper class
|
||||||
*
|
*
|
||||||
|
@ -111,7 +93,6 @@ class PostAjaxTest extends Model {
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class TestAjaxHelper extends AjaxHelper {
|
class TestAjaxHelper extends AjaxHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stop method
|
* stop method
|
||||||
*
|
*
|
||||||
|
@ -121,7 +102,6 @@ class TestAjaxHelper extends AjaxHelper {
|
||||||
function _stop() {
|
function _stop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TestJavascriptHelper class
|
* TestJavascriptHelper class
|
||||||
*
|
*
|
||||||
|
@ -129,7 +109,6 @@ class TestAjaxHelper extends AjaxHelper {
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class TestJavascriptHelper extends JavascriptHelper {
|
class TestJavascriptHelper extends JavascriptHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* codeBlocks property
|
* codeBlocks property
|
||||||
*
|
*
|
||||||
|
@ -137,7 +116,6 @@ class TestJavascriptHelper extends JavascriptHelper {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $codeBlocks;
|
var $codeBlocks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* codeBlock method
|
* codeBlock method
|
||||||
*
|
*
|
||||||
|
@ -152,7 +130,6 @@ class TestJavascriptHelper extends JavascriptHelper {
|
||||||
$this->codeBlocks[] = $parameter;
|
$this->codeBlocks[] = $parameter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AjaxTest class
|
* AjaxTest class
|
||||||
*
|
*
|
||||||
|
@ -160,21 +137,18 @@ class TestJavascriptHelper extends JavascriptHelper {
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class AjaxHelperTest extends CakeTestCase {
|
class AjaxHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regexp for CDATA start block
|
* Regexp for CDATA start block
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $cDataStart = 'preg:/^\/\/<!\[CDATA\[[\n\r]*/';
|
var $cDataStart = 'preg:/^\/\/<!\[CDATA\[[\n\r]*/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regexp for CDATA end block
|
* Regexp for CDATA end block
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $cDataEnd = 'preg:/[^\]]*\]\]\>[\s\r\n]*/';
|
var $cDataEnd = 'preg:/[^\]]*\]\]\>[\s\r\n]*/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
|
@ -192,7 +166,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
ClassRegistry::addObject('view', $view);
|
ClassRegistry::addObject('view', $view);
|
||||||
ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest());
|
ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
|
@ -203,7 +176,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
unset($this->Ajax);
|
unset($this->Ajax);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testEvalScripts method
|
* testEvalScripts method
|
||||||
*
|
*
|
||||||
|
@ -237,7 +209,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAutoComplete method
|
* testAutoComplete method
|
||||||
*
|
*
|
||||||
|
@ -284,7 +255,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/{parameters:\'key=value&key2=value2\'}/', $result);
|
$this->assertPattern('/{parameters:\'key=value&key2=value2\'}/', $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAsynchronous method
|
* testAsynchronous method
|
||||||
*
|
*
|
||||||
|
@ -305,7 +275,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDraggable method
|
* testDraggable method
|
||||||
*
|
*
|
||||||
|
@ -327,7 +296,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/onDrag:doDrag/', $result);
|
$this->assertPattern('/onDrag:doDrag/', $result);
|
||||||
$this->assertPattern('/onEnd:doEnd/', $result);
|
$this->assertPattern('/onEnd:doEnd/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDroppable method
|
* testDroppable method
|
||||||
*
|
*
|
||||||
|
@ -375,7 +343,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testForm method
|
* testForm method
|
||||||
*
|
*
|
||||||
|
@ -390,7 +357,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/id="MyFormID"/', $result);
|
$this->assertPattern('/id="MyFormID"/', $result);
|
||||||
$this->assertPattern('/name="SomeFormName"/', $result);
|
$this->assertPattern('/name="SomeFormName"/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSortable method
|
* testSortable method
|
||||||
*
|
*
|
||||||
|
@ -464,7 +430,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$expected = "Sortable.create('div', {scroll:$('someElement')});";
|
$expected = "Sortable.create('div', {scroll:$('someElement')});";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSubmitWithIndicator method
|
* testSubmitWithIndicator method
|
||||||
*
|
*
|
||||||
|
@ -476,7 +441,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/onLoading:function\(request\) {doSomething\(\);\s+Element.show\(\'loading\'\);}/', $result);
|
$this->assertPattern('/onLoading:function\(request\) {doSomething\(\);\s+Element.show\(\'loading\'\);}/', $result);
|
||||||
$this->assertPattern('/onComplete:function\(request, json\) {doSomethingElse\(\) ;\s+Element.hide\(\'loading\'\);}/', $result);
|
$this->assertPattern('/onComplete:function\(request, json\) {doSomethingElse\(\) ;\s+Element.hide\(\'loading\'\);}/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testLink method
|
* testLink method
|
||||||
*
|
*
|
||||||
|
@ -586,7 +550,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertNoPattern('/^<a[^<>]+complete="test"[^<>]*>Ajax Link<\/a>/', $result);
|
$this->assertNoPattern('/^<a[^<>]+complete="test"[^<>]*>Ajax Link<\/a>/', $result);
|
||||||
$this->assertNoPattern('/^<a\s+[^<>]*url="[^"]*"[^<>]*>/', $result);
|
$this->assertNoPattern('/^<a\s+[^<>]*url="[^"]*"[^<>]*>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRemoteTimer method
|
* testRemoteTimer method
|
||||||
*
|
*
|
||||||
|
@ -642,7 +605,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*new PeriodicalExecuter\(function\(\) {.+}, 10\)\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*new PeriodicalExecuter\(function\(\) {.+}, 10\)\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||||
$this->assertPattern('/' . str_replace('/', '\\/', preg_quote('new Ajax.Request(\'http://www.cakephp.org\', {asynchronous:true, evalScripts:true, postBody:\'var1=value1\'})')) . '/', $result);
|
$this->assertPattern('/' . str_replace('/', '\\/', preg_quote('new Ajax.Request(\'http://www.cakephp.org\', {asynchronous:true, evalScripts:true, postBody:\'var1=value1\'})')) . '/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testObserveField method
|
* testObserveField method
|
||||||
*
|
*
|
||||||
|
@ -674,7 +636,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*new Form.Element.EventObserver\(\'field\', function\(element, value\) {.+}\)\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*new Form.Element.EventObserver\(\'field\', function\(element, value\) {.+}\)\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
|
||||||
$this->assertPattern('/' . str_replace('/', '\\/', preg_quote('new Ajax.Updater(\'divId\',\'http://www.cakephp.org\', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize(\'otherField\'), requestHeaders:[\'X-Update\', \'divId\']})')) . '/', $result);
|
$this->assertPattern('/' . str_replace('/', '\\/', preg_quote('new Ajax.Updater(\'divId\',\'http://www.cakephp.org\', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize(\'otherField\'), requestHeaders:[\'X-Update\', \'divId\']})')) . '/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testObserveForm method
|
* testObserveForm method
|
||||||
*
|
*
|
||||||
|
@ -722,7 +683,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSlider method
|
* testSlider method
|
||||||
*
|
*
|
||||||
|
@ -800,7 +760,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRemoteFunction method
|
* testRemoteFunction method
|
||||||
*
|
*
|
||||||
|
@ -824,7 +783,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
$expected = "if (confirm('Are you sure?')) { new Ajax.Updater('myDiv','/', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'myDiv']}); } else { event.returnValue = false; return false; }";
|
$expected = "if (confirm('Are you sure?')) { new Ajax.Updater('myDiv','/', {asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'myDiv']}); } else { event.returnValue = false; return false; }";
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDiv method
|
* testDiv method
|
||||||
*
|
*
|
||||||
|
@ -857,7 +815,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAfterRender method
|
* testAfterRender method
|
||||||
*
|
*
|
||||||
|
@ -885,7 +842,6 @@ class AjaxHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
$_SERVER['HTTP_X_UPDATE'] = $oldXUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testEditor method
|
* testEditor method
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
/* SVN FILE: $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JsHelperTest file
|
* JsHelperTest file
|
||||||
*
|
*
|
||||||
|
@ -28,14 +27,6 @@
|
||||||
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
||||||
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
|
||||||
}
|
}
|
||||||
uses(
|
|
||||||
'view' . DS . 'helpers' . DS . 'app_helper',
|
|
||||||
'controller' . DS . 'controller',
|
|
||||||
'model' . DS . 'model',
|
|
||||||
'view' . DS . 'helper',
|
|
||||||
'view' . DS . 'helpers' . DS . 'js'
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JsHelperTest class
|
* JsHelperTest class
|
||||||
*
|
*
|
||||||
|
@ -43,7 +34,6 @@ uses(
|
||||||
* @subpackage cake.tests.cases.libs.view.helpers
|
* @subpackage cake.tests.cases.libs.view.helpers
|
||||||
*/
|
*/
|
||||||
class JsHelperTest extends UnitTestCase {
|
class JsHelperTest extends UnitTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* skip method
|
* skip method
|
||||||
*
|
*
|
||||||
|
@ -53,7 +43,6 @@ class JsHelperTest extends UnitTestCase {
|
||||||
function skip() {
|
function skip() {
|
||||||
$this->skipIf(true, '%s JsHelper test not implemented');
|
$this->skipIf(true, '%s JsHelper test not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
|
@ -63,7 +52,6 @@ class JsHelperTest extends UnitTestCase {
|
||||||
function setUp() {
|
function setUp() {
|
||||||
$this->Js = new JsHelper();
|
$this->Js = new JsHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* tearDown method
|
||||||
*
|
*
|
||||||
|
|
|
@ -224,6 +224,42 @@ class XmlHelperTest extends CakeTestCase {
|
||||||
$this->assertIdentical($result, $expected);
|
$this->assertIdentical($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSerializeOnMultiDimensionalArray method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSerializeOnMultiDimensionalArray() {
|
||||||
|
$data = array(
|
||||||
|
'Statuses' => array(
|
||||||
|
array('Status' => array('id' => 1)),
|
||||||
|
array('Status' => array('id' => 2))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = $this->Xml->serialize($data, array('format' => 'tags'));
|
||||||
|
$expected = '<statuses><status><id>1</id></status><status><id>2</id></status></statuses>';
|
||||||
|
$this->assertIdentical($result, $expected);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* testSerializeOnMultiDimensionalArray method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSerializeOnMultiDimensionalArray() {
|
||||||
|
$data = array(
|
||||||
|
'Statuses' => array(
|
||||||
|
array('Status' => array('id' => 1)),
|
||||||
|
array('Status' => array('id' => 2))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = $this->Xml->serialize($data, array('format' => 'tags'));
|
||||||
|
$expected = '<statuses><status><id>1</id></status><status><id>2</id></status></statuses>';
|
||||||
|
$this->assertIdentical($result, $expected);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* testHeader method
|
* testHeader method
|
||||||
*
|
*
|
||||||
|
|
|
@ -103,6 +103,25 @@ class XmlTest extends CakeTestCase {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSerializeOnMultiDimensionalArray method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testSerializeOnMultiDimensionalArray() {
|
||||||
|
$data = array(
|
||||||
|
'Statuses' => array(
|
||||||
|
array('Status' => array('id' => 1)),
|
||||||
|
array('Status' => array('id' => 2))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result =& new Xml($data, array('format' => 'tags'));
|
||||||
|
$expected = '<statuses><status><id>1</id></status><status><id>2</id></status></statuses>';
|
||||||
|
$this->assertIdentical($result->toString(), $expected);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test serialization of boolean and null values. false = 0, true = 1, null = ''
|
* test serialization of boolean and null values. false = 0, true = 1, null = ''
|
||||||
*
|
*
|
||||||
|
|
2
cake/tests/fixtures/uuid_tree_fixture.php
vendored
2
cake/tests/fixtures/uuid_tree_fixture.php
vendored
|
@ -50,7 +50,7 @@ class UuidTreeFixture extends CakeTestFixture {
|
||||||
var $fields = array(
|
var $fields = array(
|
||||||
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string','null' => false),
|
'name' => array('type' => 'string','null' => false),
|
||||||
'parent_id' => array('type' => 'string', 'length' => 36),
|
'parent_id' => array('type' => 'string', 'length' => 36, 'null' => true),
|
||||||
'lft' => array('type' => 'integer','null' => false),
|
'lft' => array('type' => 'integer','null' => false),
|
||||||
'rght' => array('type' => 'integer','null' => false)
|
'rght' => array('type' => 'integer','null' => false)
|
||||||
);
|
);
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CakeTestFixture extends Object {
|
||||||
* @var string
|
* @var string
|
||||||
**/
|
**/
|
||||||
var $name = null;
|
var $name = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cake's DBO driver (e.g: DboMysql).
|
* Cake's DBO driver (e.g: DboMysql).
|
||||||
*
|
*
|
||||||
|
@ -53,6 +54,7 @@ class CakeTestFixture extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $table = null;
|
var $table = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate the fixture.
|
* Instantiate the fixture.
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,4 +36,3 @@
|
||||||
<?php echo $variable; ?>
|
<?php echo $variable; ?>
|
||||||
</cake:nocache>
|
</cake:nocache>
|
||||||
<p>Additional regular text.</p>
|
<p>Additional regular text.</p>
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,9 @@ endif;
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($filePresent)):
|
if (!empty($filePresent)):
|
||||||
uses('model' . DS . 'connection_manager');
|
if (!class_exists('ConnectionManager')) {
|
||||||
|
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||||
|
}
|
||||||
$db = ConnectionManager::getInstance();
|
$db = ConnectionManager::getInstance();
|
||||||
$connected = $db->getDataSource('default');
|
$connected = $db->getDataSource('default');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -82,7 +82,9 @@
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if (!empty($filePresent)):
|
if (!empty($filePresent)):
|
||||||
uses('model' . DS . 'connection_manager');
|
if (!class_exists('ConnectionManager')) {
|
||||||
|
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||||
|
}
|
||||||
$db = ConnectionManager::getInstance();
|
$db = ConnectionManager::getInstance();
|
||||||
$connected = $db->getDataSource('default');
|
$connected = $db->getDataSource('default');
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue