mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing coding standards violations in core, and adding misc tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7222 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
66ea6be098
commit
df75a06756
75 changed files with 1142 additions and 928 deletions
|
@ -386,4 +386,5 @@ class ViewTask extends Shell {
|
|||
return $associations;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -192,7 +192,7 @@ class TestSuiteShell extends Shell {
|
|||
* @return bool true if it's a valid test file, false otherwise
|
||||
* @access private
|
||||
*/
|
||||
function __canRun(){
|
||||
function __canRun() {
|
||||
$isNeitherAppNorCore = !in_array($this->category, array('app', 'core'));
|
||||
$isPlugin = in_array(Inflector::underscore($this->category), $this->plugins);
|
||||
|
||||
|
|
|
@ -228,4 +228,5 @@ class Component extends Object {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -294,7 +294,7 @@ class SessionComponent extends CakeSession {
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function __start(){
|
||||
function __start() {
|
||||
if ($this->__started === false) {
|
||||
if (!$this->id() && parent::start()) {
|
||||
$this->__started = true;
|
||||
|
@ -306,4 +306,5 @@ class SessionComponent extends CakeSession {
|
|||
return $this->__started;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -466,6 +466,7 @@ class Scaffold extends Object {
|
|||
return $associations;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scaffold View.
|
||||
*
|
||||
|
|
|
@ -265,18 +265,25 @@ class TreeBehavior extends ModelBehavior {
|
|||
$conditions = array($scope, $model->escapeField($parent) => $id);
|
||||
return $model->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
|
||||
}
|
||||
|
||||
if (!$id) {
|
||||
$constraint = $scope;
|
||||
} else {
|
||||
$result = array_values($model->find('first', array('conditions' => array($scope, $model->escapeField() => $id), 'fields' => array($left, $right), 'recursive' => $recursive)));
|
||||
if (!empty($result) && isset($result[0])) {
|
||||
$item = $result[0];
|
||||
$conditions = $scope;
|
||||
} else {
|
||||
$result = array_values($model->find('first', array(
|
||||
'conditions' => array($scope, $model->escapeField() => $id),
|
||||
'fields' => array($left, $right),
|
||||
'recursive' => $recursive
|
||||
)));
|
||||
|
||||
if (empty($result) || !isset($result[0])) {
|
||||
return array();
|
||||
}
|
||||
$constraint = array($scope, $model->escapeField($right) . ' <' => $item[$right], $model->escapeField($left) . ' >' => $item[$left]);
|
||||
$conditions = array($scope,
|
||||
$model->escapeField($right) . ' <' => $result[0][$right],
|
||||
$model->escapeField($left) . ' >' => $result[0][$left]
|
||||
);
|
||||
}
|
||||
return $model->find('all', array('conditions' => $constraint, 'fields' => $fields, 'order' => $order, 'limit' => $limit, 'page' => $page, 'recursive' => $recursive));
|
||||
return $model->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
|
||||
}
|
||||
/**
|
||||
* A convenience method for returning a hierarchical array used for HTML select boxes
|
||||
|
@ -450,6 +457,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$this->__sync($model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
|
||||
$this->__sync($model, $nextNode[$left] - $node[$left], '-', 'BETWEEN ' . $nextNode[$left] . ' AND ' . $nextNode[$right]);
|
||||
$this->__sync($model, $edge - $node[$left] - ($nextNode[$right] - $nextNode[$left]), '-', '> ' . $edge);
|
||||
|
||||
if (is_int($number)) {
|
||||
$number--;
|
||||
}
|
||||
|
@ -570,7 +578,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$model->{$model->primaryKey} = $array[$model->alias][$model->primaryKey];
|
||||
$lft = $count++;
|
||||
$rght = $count++;
|
||||
$model->save(array($left => $lft,$right => $rght));
|
||||
$model->save(array($left => $lft, $right => $rght), array('callbacks' => false));
|
||||
}
|
||||
foreach ($model->find('all', array('conditions' => $scope, 'fields' => array($model->primaryKey, $parent), 'order' => $left)) as $array) {
|
||||
$model->create();
|
||||
|
@ -613,6 +621,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$fields = array($model->primaryKey, $field, $left, $right);
|
||||
$sort = $field . ' ' . $order;
|
||||
$nodes = $model->children($id, true, $fields, $sort, null, null, $recursive);
|
||||
|
||||
if ($nodes) {
|
||||
foreach ($nodes as $node) {
|
||||
$id = $node[$model->alias][$model->primaryKey];
|
||||
|
@ -685,7 +694,10 @@ class TreeBehavior extends ModelBehavior {
|
|||
$edge = $edge - 2;
|
||||
}
|
||||
$model->id = $id;
|
||||
return $model->save(array($left => $edge + 1, $right => $edge + 2, $parent => null));
|
||||
return $model->save(
|
||||
array($left => $edge + 1, $right => $edge + 2, $parent => null),
|
||||
array('callbacks' => false)
|
||||
);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -697,13 +709,19 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @param mixed $parentId The ID to set as the parent of the current node.
|
||||
* @return true on success
|
||||
* @access public
|
||||
* @deprecated
|
||||
*/
|
||||
function setparent(&$model, $parentId = null , $created = null) {
|
||||
trigger_error(
|
||||
__('(TreeBehavior::setParent) Deprecated - save the record with a parent ID instead', true),
|
||||
E_USER_ERROR
|
||||
);
|
||||
extract($this->settings[$model->alias]);
|
||||
|
||||
if ($created === false && $parentId == $model->field($parent)) {
|
||||
return true;
|
||||
}
|
||||
return $model->saveField($parent, $parentId);
|
||||
return $model->saveField($parent, $parentId, array('callbacks' => false));
|
||||
}
|
||||
/**
|
||||
* Check if the current tree is valid.
|
||||
|
@ -787,16 +805,22 @@ class TreeBehavior extends ModelBehavior {
|
|||
*/
|
||||
function _setParent(&$model, $parentId = null, $created = false) {
|
||||
extract($this->settings[$model->alias]);
|
||||
list($node) = array_values($model->find('first', array('conditions' => array($scope, $model->escapeField() => $model->id),
|
||||
'fields' => array($model->primaryKey, $parent, $left, $right), 'recursive' => $recursive)));
|
||||
list($node) = array_values($model->find('first', array(
|
||||
'conditions' => array($scope, $model->escapeField() => $model->id),
|
||||
'fields' => array($model->primaryKey, $parent, $left, $right),
|
||||
'recursive' => $recursive
|
||||
)));
|
||||
$edge = $this->__getMax($model, $scope, $right, $recursive, $created);
|
||||
|
||||
if (empty ($parentId)) {
|
||||
$this->__sync($model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$this->__sync($model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
|
||||
} else {
|
||||
$parentNode = array_values($model->find('first', array('conditions' => array($scope, $model->escapeField() => $parentId),
|
||||
'fields' => array($model->primaryKey, $left, $right), 'recursive' => $recursive)));
|
||||
$parentNode = array_values($model->find('first', array(
|
||||
'conditions' => array($scope, $model->escapeField() => $parentId),
|
||||
'fields' => array($model->primaryKey, $left, $right),
|
||||
'recursive' => $recursive
|
||||
)));
|
||||
|
||||
if (empty($parentNode) || empty($parentNode[0])) {
|
||||
return false;
|
||||
|
@ -811,7 +835,10 @@ class TreeBehavior extends ModelBehavior {
|
|||
}
|
||||
if (empty ($node[$left]) && empty ($node[$right])) {
|
||||
$this->__sync($model, 2, '+', '>= ' . $parentNode[$right], $created);
|
||||
$model->save(array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId), false);
|
||||
$model->save(
|
||||
array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId),
|
||||
array('validate' => false, 'callbacks' => false)
|
||||
);
|
||||
} else {
|
||||
$this->__sync($model, $edge - $node[$left] +1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$diff = $node[$right] - $node[$left] + 1;
|
||||
|
|
|
@ -48,7 +48,6 @@ class DboAdodb extends DboSource {
|
|||
* @var string
|
||||
*/
|
||||
var $description = "ADOdb DBO Driver";
|
||||
|
||||
/**
|
||||
* ADOConnection object with which we connect.
|
||||
*
|
||||
|
@ -56,7 +55,6 @@ class DboAdodb extends DboSource {
|
|||
* @access private
|
||||
*/
|
||||
var $_adodb = null;
|
||||
|
||||
/**
|
||||
* Array translating ADOdb column MetaTypes to cake-supported metatypes
|
||||
*
|
||||
|
@ -84,7 +82,7 @@ class DboAdodb extends DboSource {
|
|||
'primary_key' => array('name' => 'R', 'limit' => 11),
|
||||
'string' => array('name' => 'C', 'limit' => '255'),
|
||||
'text' => array('name' => 'X'),
|
||||
'integer' => array('name' => 'I', 'limit' => '11', 'formatter' => 'intval',),
|
||||
'integer' => array('name' => 'I', 'limit' => '11', 'formatter' => 'intval'),
|
||||
'float' => array('name' => 'N', 'formatter' => 'floatval'),
|
||||
'timestamp' => array('name' => 'T', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
|
||||
'time' => array('name' => 'T', 'format' => 'H:i:s', 'formatter' => 'date'),
|
||||
|
@ -223,7 +221,6 @@ class DboAdodb extends DboSource {
|
|||
trigger_error(ERROR_NO_TABLE_LIST, E_USER_NOTICE);
|
||||
exit;
|
||||
}
|
||||
|
||||
return $tables;
|
||||
}
|
||||
/**
|
||||
|
@ -292,7 +289,6 @@ class DboAdodb extends DboSource {
|
|||
function lastInsertId() {
|
||||
return $this->_adodb->Insert_ID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a LIMIT statement in the correct format for the particular database.
|
||||
*
|
||||
|
@ -319,7 +315,6 @@ class DboAdodb extends DboSource {
|
|||
// please change to whatever select your database accepts
|
||||
// adodb doesn't allow us to get the correct limit string out of it
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts database-layer column types to basic types
|
||||
*
|
||||
|
|
|
@ -387,7 +387,7 @@ class DboMssql extends DboSource {
|
|||
$error = mssql_get_last_message($this->connection);
|
||||
|
||||
if ($error) {
|
||||
if (strpos(strtolower($error), 'changed database') === false) {
|
||||
if (!preg_match('/contesto di database|changed database/i', $error)) {
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,6 @@ class DboMysqli extends DboSource {
|
|||
if (mysqli_more_results($this->connection)) {
|
||||
while($lastResult = mysqli_next_result($this->connection));
|
||||
}
|
||||
|
||||
return $firstResult;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -482,15 +482,16 @@ class DboOracle extends DboSource {
|
|||
}
|
||||
$fields = array();
|
||||
|
||||
for($i=0; $row = $this->fetchRow(); $i++) {
|
||||
$fields[strtolower($row[0]['COLUMN_NAME'])] = array('type'=> $this->column($row[0]['DATA_TYPE']),
|
||||
'length'=> $row[0]['DATA_LENGTH']);
|
||||
for ($i = 0; $row = $this->fetchRow(); $i++) {
|
||||
$fields[strtolower($row[0]['COLUMN_NAME'])] = array(
|
||||
'type'=> $this->column($row[0]['DATA_TYPE']),
|
||||
'length'=> $row[0]['DATA_LENGTH']
|
||||
);
|
||||
}
|
||||
$this->__cacheDescription($this->fullTableName($model, false), $fields);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all the records in a table and drops all associated auto-increment sequences.
|
||||
* Using DELETE instead of TRUNCATE because it causes locking problems.
|
||||
|
@ -532,11 +533,10 @@ class DboOracle extends DboSource {
|
|||
$this->execute("SELECT {$this->_sequenceMap[$table]}.nextval FROM dual");
|
||||
$this->execute("ALTER SEQUENCE {$this->_sequenceMap[$table]} INCREMENT BY 1");
|
||||
} else {
|
||||
#$this->execute("DROP SEQUENCE {$this->_sequenceMap[$table]}");
|
||||
//$this->execute("DROP SEQUENCE {$this->_sequenceMap[$table]}");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables, disables, and lists table constraints
|
||||
*
|
||||
|
|
|
@ -1692,28 +1692,12 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
function conditions($conditions, $quoteValues = true, $where = true, $model = null) {
|
||||
$clause = $out = '';
|
||||
if (is_string($conditions) || empty($conditions) || $conditions === true) {
|
||||
if (empty($conditions) || trim($conditions) == '' || $conditions === true) {
|
||||
if ($where) {
|
||||
return ' WHERE 1 = 1';
|
||||
}
|
||||
return '1 = 1';
|
||||
}
|
||||
if (!preg_match('/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i', $conditions, $match)) {
|
||||
if ($where) {
|
||||
$clause = ' WHERE ';
|
||||
}
|
||||
}
|
||||
if (trim($conditions) == '') {
|
||||
$conditions = ' 1 = 1';
|
||||
} else {
|
||||
$conditions = $this->__quoteFields($conditions);
|
||||
}
|
||||
return $clause . $conditions;
|
||||
} else {
|
||||
|
||||
if ($where) {
|
||||
$clause = ' WHERE ';
|
||||
}
|
||||
|
||||
if (is_array($conditions) && !empty($conditions)) {
|
||||
if (!empty($conditions)) {
|
||||
$out = $this->conditionKeysToString($conditions, $quoteValues, $model);
|
||||
}
|
||||
|
@ -1722,6 +1706,19 @@ class DboSource extends DataSource {
|
|||
}
|
||||
return $clause . join(' AND ', $out);
|
||||
}
|
||||
|
||||
if (empty($conditions) || trim($conditions) == '' || $conditions === true) {
|
||||
return $clause . '1 = 1';
|
||||
}
|
||||
if (preg_match('/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i', $conditions, $match)) {
|
||||
$clause = '';
|
||||
}
|
||||
if (trim($conditions) == '') {
|
||||
$conditions = ' 1 = 1';
|
||||
} else {
|
||||
$conditions = $this->__quoteFields($conditions);
|
||||
}
|
||||
return $clause . $conditions;
|
||||
}
|
||||
/**
|
||||
* Creates a WHERE clause by parsing given conditions array. Used by DboSource::conditions().
|
||||
|
|
|
@ -1024,18 +1024,24 @@ class Model extends Overloadable {
|
|||
*
|
||||
* @param string $name Name of the table field
|
||||
* @param mixed $value Value of the field
|
||||
* @param boolean $validate Whether or not this model should validate before saving (defaults to false)
|
||||
* @return boolean True on success save
|
||||
* @param array $options See $options param in Model::save(). Does not respect 'fieldList' key if passed
|
||||
* @return boolean See Model::save()
|
||||
* @access public
|
||||
* @see Model::save()
|
||||
*/
|
||||
function saveField($name, $value, $validate = false) {
|
||||
$id = $this->id;
|
||||
$this->create(false);
|
||||
return $this->save(array($this->alias => array(
|
||||
$this->primaryKey => $id,
|
||||
$name => $value,
|
||||
)), $validate, array($name));
|
||||
|
||||
if (is_array($validate)) {
|
||||
$options = array_merge(array('validate' => false, 'fieldList' => array($name)), $options);
|
||||
} else {
|
||||
$options = array('validate' => $validate, 'fieldList' => array($name));
|
||||
}
|
||||
|
||||
return $this->save(
|
||||
array($this->alias => array($this->primaryKey => $id, $name => $value)), $options
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Saves model data to the database. By default, validation occurs before save.
|
||||
|
@ -1104,7 +1110,7 @@ class Model extends Overloadable {
|
|||
}
|
||||
}
|
||||
|
||||
if ($options['callbacks'] === true || $options['callbacks'] == 'before') {
|
||||
if ($options['callbacks'] === true || $options['callbacks'] === 'before') {
|
||||
if (!$this->Behaviors->trigger($this, 'beforeSave', array($options), array('break' => true, 'breakOn' => false)) || !$this->beforeSave($options)) {
|
||||
$this->whitelist = $_whitelist;
|
||||
return false;
|
||||
|
@ -1183,7 +1189,7 @@ class Model extends Overloadable {
|
|||
if (!empty($this->data)) {
|
||||
$success = $this->data;
|
||||
}
|
||||
if ($options['callbacks'] === true || $options['callbacks'] == 'after') {
|
||||
if ($options['callbacks'] === true || $options['callbacks'] === 'after') {
|
||||
$this->Behaviors->trigger($this, 'afterSave', array($created, $options));
|
||||
$this->afterSave($created);
|
||||
}
|
||||
|
@ -1696,9 +1702,10 @@ class Model extends Overloadable {
|
|||
if ($this->__exists !== null && $reset !== true) {
|
||||
return $this->__exists;
|
||||
}
|
||||
return $this->__exists = ($this->find('count', array(
|
||||
'conditions' => array($this->alias . '.' . $this->primaryKey => $this->getID()), 'recursive' => -1
|
||||
)) > 0);
|
||||
$conditions = array($this->alias . '.' . $this->primaryKey => $this->getID());
|
||||
$recursive = -1;
|
||||
|
||||
return $this->__exists = ($this->find('count', compact('conditions', 'recursive')) > 0);
|
||||
}
|
||||
/**
|
||||
* Returns true if a record that meets given conditions exists
|
||||
|
|
|
@ -1020,7 +1020,7 @@ class Multibyte extends Object {
|
|||
* @return array
|
||||
* @access private
|
||||
*/
|
||||
function __find($char, $type = 'lower'){
|
||||
function __find($char, $type = 'lower') {
|
||||
$_this =& Multibyte::getInstance();
|
||||
$value = false;
|
||||
$found = array();
|
||||
|
|
|
@ -176,7 +176,7 @@ class CakeSession extends Object {
|
|||
*
|
||||
* @access public
|
||||
*/
|
||||
function started(){
|
||||
function started() {
|
||||
if (isset($_SESSION)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -558,8 +558,7 @@ class DispatcherTest extends UnitTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testQueryStringOnRoot() {
|
||||
$_GET = array('coffee' => 'life',
|
||||
'sleep' => 'sissies');
|
||||
$_GET = array('coffee' => 'life', 'sleep' => 'sissies');
|
||||
$Dispatcher =& new Dispatcher();
|
||||
$uri = 'posts/home/?coffee=life&sleep=sissies';
|
||||
$result = $Dispatcher->parseParams($uri);
|
||||
|
|
|
@ -254,7 +254,7 @@ PHP;
|
|||
34 => -2,
|
||||
35 => -2,
|
||||
36 => -2,
|
||||
37=> -2,
|
||||
37 => -2,
|
||||
38 => -2,
|
||||
39 => -2,
|
||||
40 => -2,
|
||||
|
@ -411,7 +411,7 @@ PHP;
|
|||
34 => -2,
|
||||
35 => -2,
|
||||
36 => -2,
|
||||
37=> -2,
|
||||
37 => -2,
|
||||
38 => -2,
|
||||
39 => -2,
|
||||
40 => -2,
|
||||
|
|
|
@ -67,7 +67,7 @@ if (!class_exists('AppController')) {
|
|||
|
||||
}
|
||||
} else {
|
||||
define('AppControllerExists', true);
|
||||
define('APP_CONTROLLER_EXISTS', true);
|
||||
}
|
||||
/**
|
||||
* ParamTestComponent
|
||||
|
@ -335,7 +335,7 @@ class ComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testComponentsWithParams() {
|
||||
$this->skipIf(defined('AppControllerExists'), 'Components with Params test will be skipped as it needs a non-existent AppController. As the an AppController class exists, this cannot be run.');
|
||||
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), 'Components with Params test will be skipped as it needs a non-existent AppController. As the an AppController class exists, this cannot be run.');
|
||||
|
||||
$Controller =& new ComponentTestController();
|
||||
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
|
||||
|
|
|
@ -444,7 +444,7 @@ class AuthTest extends CakeTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testAuthorizeController(){
|
||||
function testAuthorizeController() {
|
||||
$this->AuthUser =& new AuthUser();
|
||||
$user = $this->AuthUser->find();
|
||||
$this->Controller->Session->write('Auth', $user);
|
||||
|
|
|
@ -721,7 +721,8 @@ DIGEST;
|
|||
$result = $this->Controller->Security->generateDigestResponseHash($data);
|
||||
$expected = md5(
|
||||
md5($data['username'] . ':' . $loginData['realm'].':'.$data['password']) . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' .
|
||||
md5(env('REQUEST_METHOD') . ':' . $data['uri']));
|
||||
md5(env('REQUEST_METHOD') . ':' . $data['uri'])
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -157,8 +157,8 @@ if (!class_exists('AppController')) {
|
|||
*/
|
||||
var $components = array('Cookie');
|
||||
}
|
||||
} else if (!defined('AppControllerExists')) {
|
||||
define('AppControllerExists', true);
|
||||
} else if (!defined('APP_CONTROLLER_EXISTS')) {
|
||||
define('APP_CONTROLLER_EXISTS', true);
|
||||
}
|
||||
/**
|
||||
* TestController class
|
||||
|
@ -526,7 +526,7 @@ class ControllerTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testMergeVars() {
|
||||
$this->skipIf(defined('AppControllerExists'), 'MergeVars will be skipped as it needs a non-existent AppController. As the an AppController class exists, this cannot be run.');
|
||||
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), 'MergeVars will be skipped as it needs a non-existent AppController. As the an AppController class exists, this cannot be run.');
|
||||
|
||||
$TestController =& new TestController();
|
||||
$TestController->constructClasses();
|
||||
|
|
|
@ -244,7 +244,7 @@ class FolderTest extends UnitTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testWindowsPath(){
|
||||
function testWindowsPath() {
|
||||
$Folder =& new Folder();
|
||||
$this->assertTrue($Folder->isWindowsPath('C:\cake'));
|
||||
$this->assertTrue($Folder->isWindowsPath('c:\cake'));
|
||||
|
@ -255,7 +255,7 @@ class FolderTest extends UnitTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIsAbsolute(){
|
||||
function testIsAbsolute() {
|
||||
$Folder =& new Folder();
|
||||
$this->assertTrue($Folder->isAbsolute('C:\cake'));
|
||||
$this->assertTrue($Folder->isAbsolute('/usr/local'));
|
||||
|
@ -267,7 +267,7 @@ class FolderTest extends UnitTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testIsSlashTerm(){
|
||||
function testIsSlashTerm() {
|
||||
$Folder =& new Folder();
|
||||
$this->assertTrue($Folder->isSlashTerm('C:\cake\\'));
|
||||
$this->assertTrue($Folder->isSlashTerm('/usr/local/'));
|
||||
|
|
|
@ -1195,10 +1195,12 @@ class HttpSocketTest extends UnitTestCase {
|
|||
function testTokenEscapeChars() {
|
||||
$this->Socket->reset();
|
||||
|
||||
$expected = array('\x22','\x28','\x29','\x3c','\x3e','\x40','\x2c','\x3b','\x3a','\x5c','\x2f','\x5b','\x5d','\x3f','\x3d','\x7b',
|
||||
$expected = array(
|
||||
'\x22','\x28','\x29','\x3c','\x3e','\x40','\x2c','\x3b','\x3a','\x5c','\x2f','\x5b','\x5d','\x3f','\x3d','\x7b',
|
||||
'\x7d','\x20','\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09','\x0a','\x0b','\x0c','\x0d',
|
||||
'\x0e','\x0f','\x10','\x11','\x12','\x13','\x14','\x15','\x16','\x17','\x18','\x19','\x1a','\x1b','\x1c','\x1d',
|
||||
'\x1e','\x1f','\x7f');
|
||||
'\x1e','\x1f','\x7f'
|
||||
);
|
||||
$r = $this->Socket->__tokenEscapeChars();
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class Campaign extends CakeTestModel {
|
|||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $hasMany = array('Ad' => array('fields' => array('id','campaign_id','name') ));
|
||||
var $hasMany = array('Ad' => array('fields' => array('id','campaign_id','name')));
|
||||
}
|
||||
/**
|
||||
* Ad class
|
||||
|
@ -150,7 +150,7 @@ class Ad extends CakeTestModel {
|
|||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $belongsTo = array('Campaign' );
|
||||
var $belongsTo = array('Campaign');
|
||||
}
|
||||
/**
|
||||
* NumberTreeCase class
|
||||
|
@ -165,7 +165,9 @@ class NumberTreeCase extends CakeTestCase {
|
|||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $fixtures = array('core.number_tree', 'core.flag_tree', 'core.campaign','core.ad');
|
||||
var $fixtures = array(
|
||||
'core.number_tree', 'core.flag_tree', 'core.campaign','core.ad', 'core.translate'
|
||||
);
|
||||
/**
|
||||
* testInitialize method
|
||||
*
|
||||
|
@ -929,7 +931,7 @@ class NumberTreeCase extends CakeTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testMoveToRootAndMoveUp(){
|
||||
function testMoveToRootAndMoveUp() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(1, 1);
|
||||
$data = $this->NumberTree->find(array('NumberTree.name' => '1.1'), array('id'));
|
||||
|
@ -1255,7 +1257,7 @@ class NumberTreeCase extends CakeTestCase {
|
|||
*/
|
||||
function testMoveDownWithScope() {
|
||||
$this->Ad =& new Ad();
|
||||
$this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign'));
|
||||
$this->Ad->Behaviors->attach('Tree', array('scope' => 'Campaign'));
|
||||
$this->Ad->moveDown(6);
|
||||
|
||||
$this->Ad->id = 4;
|
||||
|
@ -1272,9 +1274,109 @@ class NumberTreeCase extends CakeTestCase {
|
|||
function testArraySyntax() {
|
||||
$this->NumberTree =& new NumberTree();
|
||||
$this->NumberTree->initialize(3, 3);
|
||||
$this->assertIdentical($this->NumberTree->childcount(2), $this->NumberTree->childcount(array('id' => 2)));
|
||||
$this->assertIdentical($this->NumberTree->getparentnode(2), $this->NumberTree->getparentnode(array('id' => 2)));
|
||||
$this->assertIdentical($this->NumberTree->getpath(4), $this->NumberTree->getpath(array('id' => 4)));
|
||||
$this->assertIdentical($this->NumberTree->childCount(2), $this->NumberTree->childCount(array('id' => 2)));
|
||||
$this->assertIdentical($this->NumberTree->getParentNode(2), $this->NumberTree->getParentNode(array('id' => 2)));
|
||||
$this->assertIdentical($this->NumberTree->getPath(4), $this->NumberTree->getPath(array('id' => 4)));
|
||||
}
|
||||
/**
|
||||
* Tests the interaction (non-interference) between TreeBehavior and other behaviors with respect
|
||||
* to callback hooks
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testTranslatingTree() {
|
||||
$this->FlagTree =& new FlagTree();
|
||||
$this->FlagTree->cacheQueries = false;
|
||||
$this->FlagTree->translateModel = 'TranslateTreeTestModel';
|
||||
$this->FlagTree->Behaviors->attach('Translate', array('name'));
|
||||
|
||||
//Save
|
||||
$this->FlagTree->locale = 'eng';
|
||||
$data = array('FlagTree' => array(
|
||||
'name' => 'name #1',
|
||||
'locale' => 'eng',
|
||||
'parent_id' => null,
|
||||
));
|
||||
$this->FlagTree->save($data);
|
||||
$result = $this->FlagTree->find('all');
|
||||
$expected = array(array('FlagTree' => array(
|
||||
'id' => 1,
|
||||
'name' => 'name #1',
|
||||
'parent_id' => null,
|
||||
'lft' => 1,
|
||||
'rght' => 2,
|
||||
'flag' => 0,
|
||||
'locale' => 'eng',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
//update existing record, same locale
|
||||
$this->FlagTree->create();
|
||||
$data['FlagTree']['name'] = 'Named 2';
|
||||
$this->FlagTree->id = 1;
|
||||
$this->FlagTree->save($data);
|
||||
$result = $this->FlagTree->find('all');
|
||||
$expected = array(array('FlagTree' => array(
|
||||
'id' => 1,
|
||||
'name' => 'Named 2',
|
||||
'parent_id' => null,
|
||||
'lft' => 1,
|
||||
'rght' => 2,
|
||||
'flag' => 0,
|
||||
'locale' => 'eng',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
//update different locale, same record
|
||||
$this->FlagTree->create();
|
||||
$this->FlagTree->locale = 'deu';
|
||||
$this->FlagTree->id = 1;
|
||||
$data = array('FlagTree' => array(
|
||||
'id' => 1,
|
||||
'parent_id' => null,
|
||||
'name' => 'namen #1',
|
||||
'locale' => 'deu',
|
||||
));
|
||||
$this->FlagTree->save($data);
|
||||
|
||||
$this->FlagTree->locale = 'deu';
|
||||
$result = $this->FlagTree->find('all');
|
||||
$expected = array(array('FlagTree' => array(
|
||||
'id' => 1,
|
||||
'name' => 'namen #1',
|
||||
'parent_id' => null,
|
||||
'lft' => 1,
|
||||
'rght' => 2,
|
||||
'flag' => 0,
|
||||
'locale' => 'deu',
|
||||
)));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
//Save with bindTranslation
|
||||
$this->FlagTree->locale = 'eng';
|
||||
$data = array(
|
||||
'name' => array('eng' => 'New title', 'spa' => 'Nuevo leyenda'),
|
||||
'parent_id' => null
|
||||
);
|
||||
$this->FlagTree->create($data);
|
||||
$this->FlagTree->save();
|
||||
|
||||
$this->FlagTree->unbindTranslation();
|
||||
$translations = array('name' => 'Name');
|
||||
$this->FlagTree->bindTranslation($translations, false);
|
||||
$this->FlagTree->locale = array('eng', 'spa');
|
||||
|
||||
$result = $this->FlagTree->read();
|
||||
$expected = array(
|
||||
'FlagTree' => array('id' => 2, 'parent_id' => null, 'locale' => 'eng', 'name' => 'New title', 'flag' => null, 'lft' => 3, 'rght' => 4),
|
||||
'Name' => array(
|
||||
array('id' => 4, 'locale' => 'eng', 'model' => 'FlagTree', 'foreign_key' => 2, 'field' => 'name', 'content' => 'New title'),
|
||||
array('id' => 5, 'locale' => 'spa', 'model' => 'FlagTree', 'foreign_key' => 2, 'field' => 'name', 'content' => 'Nuevo leyenda')
|
||||
),
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -73,9 +73,6 @@ class DboOracleTest extends CakeTestCase {
|
|||
$r = 'ORA-01017: invalid username/password; logon denied';
|
||||
$this->assertEqual($e, $r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -829,12 +829,8 @@ class Article2 extends CakeTestModel {
|
|||
* @access public
|
||||
*/
|
||||
var $belongsTo = array(
|
||||
'Category2' => array(
|
||||
'className' => 'Category2'
|
||||
),
|
||||
'User2' => array(
|
||||
'className' => 'User2'
|
||||
)
|
||||
'Category2' => array('className' => 'Category2'),
|
||||
'User2' => array('className' => 'User2')
|
||||
);
|
||||
/**
|
||||
* schema method
|
||||
|
@ -1061,12 +1057,8 @@ class ArticleFeatured2 extends CakeTestModel {
|
|||
* @access public
|
||||
*/
|
||||
var $belongsTo = array(
|
||||
'CategoryFeatured2' => array(
|
||||
'className' => 'CategoryFeatured2'
|
||||
),
|
||||
'User2' => array(
|
||||
'className' => 'User2'
|
||||
)
|
||||
'CategoryFeatured2' => array('className' => 'CategoryFeatured2'),
|
||||
'User2' => array('className' => 'User2')
|
||||
);
|
||||
/**
|
||||
* hasOne property
|
||||
|
@ -1633,19 +1625,23 @@ class DboSourceTest extends CakeTestCase {
|
|||
$params = &$this->_prepareAssociationQuery($this->Model, $queryData, $binding);
|
||||
|
||||
$result = $this->testDb->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
|
||||
$this->assertPattern('/^SELECT\s+' .
|
||||
$this->assertPattern(
|
||||
'/^SELECT\s+' .
|
||||
'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+'.
|
||||
'FROM\s+`test_model6` AS `TestModel6`\s+WHERE\s+' .
|
||||
'`TestModel6`.`test_model5_id`\s+IN\s+\({\$__cakeID__\$}\)\s*'.
|
||||
'LIMIT \d*'.
|
||||
'\s*$/', $result);
|
||||
'\s*$/', $result
|
||||
);
|
||||
|
||||
$result = $this->testDb->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
||||
$this->assertPattern('/^SELECT\s+'.
|
||||
$this->assertPattern(
|
||||
'/^SELECT\s+'.
|
||||
'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+'.
|
||||
'FROM\s+`test_model5` AS `TestModel5`\s+WHERE\s+'.
|
||||
'(?:\()?\s*1 = 1\s*(?:\))?'.
|
||||
'\s*$/', $result);
|
||||
'\s*$/', $result
|
||||
);
|
||||
}
|
||||
/**
|
||||
* testGenerateAssociationQueryHasManyWithConditions method
|
||||
|
@ -2502,6 +2498,11 @@ class DboSourceTest extends CakeTestCase {
|
|||
$result = $this->testDb->conditions(array("Book.id" => NULL));
|
||||
$expected = " WHERE `Book`.`id` IS NULL";
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
pr($this->testDb->conditions(array(
|
||||
'User.id > 1',
|
||||
'User.user = "User.user is the message body"',
|
||||
)));
|
||||
}
|
||||
/**
|
||||
* testMixedConditionsParsing method
|
||||
|
@ -2980,10 +2981,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
*/
|
||||
function testSchema() {
|
||||
$Schema =& new CakeSchema();
|
||||
$Schema->tables = array(
|
||||
'table' => array(),
|
||||
'anotherTable' => array()
|
||||
);
|
||||
$Schema->tables = array('table' => array(), 'anotherTable' => array());
|
||||
|
||||
$this->expectError();
|
||||
$result = $this->testDb->dropSchema(null);
|
||||
|
|
|
@ -268,7 +268,7 @@ class AclNodeTest extends CakeTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testNode(){
|
||||
function testNode() {
|
||||
$Aco = new DbAcoTest();
|
||||
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
|
||||
$expected = array(2, 1);
|
||||
|
|
|
@ -356,7 +356,7 @@ class ObjectTest extends UnitTestCase {
|
|||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRequestAction(){
|
||||
function testRequestAction() {
|
||||
$result = $this->object->requestAction('');
|
||||
$this->assertFalse($result);
|
||||
|
||||
|
|
|
@ -420,10 +420,7 @@ class RouterTest extends UnitTestCase {
|
|||
|
||||
Router::reload();
|
||||
Router::connect('/:language/pages',
|
||||
array(
|
||||
'controller' => 'pages',
|
||||
'action' => 'index'
|
||||
),
|
||||
array('controller' => 'pages', 'action' => 'index'),
|
||||
array('language' => '[a-z]{3}')
|
||||
);
|
||||
|
||||
|
|
|
@ -392,8 +392,7 @@ class SanitizeTest extends CakeTestCase {
|
|||
'count' => '12',
|
||||
'float' => 2.31456,
|
||||
'updated' => '2008-01-01 00:00:00',
|
||||
)
|
||||
);
|
||||
));
|
||||
Sanitize::formatColumns($this->DataTest);
|
||||
$result = $this->DataTest->data;
|
||||
$this->assertEqual($result, $expected);
|
||||
|
@ -418,6 +417,6 @@ class SanitizeTest extends CakeTestCase {
|
|||
$result = $this->Article->data;
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -150,4 +150,5 @@ class SecurityTest extends UnitTestCase {
|
|||
$this->assertIdentical($result, '');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1261,7 +1261,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
'Badness!',
|
||||
'/span'
|
||||
);
|
||||
// debug($result);exit;
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->input('Model.field', array('div' => array('tag' => 'span'), 'error' => array('wrap' => false)));
|
||||
|
@ -4138,6 +4137,94 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
function testBrokenness() {
|
||||
/*
|
||||
* #4 This test has two parents and four children. By default (as of r7117) both
|
||||
* parents are show but the first parent is missing a child. This is the inconsistency in the
|
||||
* default behaviour - one parent has all children, the other does not - dependent on the data values.
|
||||
*/
|
||||
$result = $this->Form->select('Model.field', array(
|
||||
'Fred' => array(
|
||||
'freds_son_1' => 'Fred',
|
||||
'freds_son_2' => 'Freddie'
|
||||
),
|
||||
'Bert' => array(
|
||||
'berts_son_1' => 'Albert',
|
||||
'berts_son_2' => 'Bertie')
|
||||
),
|
||||
null,
|
||||
array(),
|
||||
false
|
||||
);
|
||||
|
||||
$expected = array(
|
||||
'select' => array('name' => 'data[Model][field]', 'id' => 'ModelField'),
|
||||
array('optgroup' => array('label' => 'Fred')),
|
||||
array('option' => array('value' => 'freds_son_1')),
|
||||
'Fred',
|
||||
'/option',
|
||||
array('option' => array('value' => 'freds_son_2')),
|
||||
'Freddie',
|
||||
'/option',
|
||||
'/optgroup',
|
||||
array('optgroup' => array('label' => 'Bert')),
|
||||
array('option' => array('value' => 'berts_son_1')),
|
||||
'Albert',
|
||||
'/option',
|
||||
array('option' => array('value' => 'berts_son_2')),
|
||||
'Bertie',
|
||||
'/option',
|
||||
'/optgroup',
|
||||
'/select'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
/*
|
||||
* #2 This is structurally identical to the test above (#1) - only the parent name has changed, so we
|
||||
* should expect the same select list data, just with a different name for the parent.
|
||||
* As of #7117, this test fails because option 3 => 'Three' disappears.
|
||||
* This is where data corruption can occur, because when a select value is missing from a list
|
||||
* a form will substitute the first value in the list - without the user knowing.
|
||||
* If the optgroup name 'Parent' (above) is updated to 'Three' (below), this should not affect
|
||||
* the availability of 3 => 'Three' as a valid option.
|
||||
*/
|
||||
$result = $this->Form->select('Model.field', array(
|
||||
1 => 'One',
|
||||
2 => 'Two',
|
||||
'Three' => array(
|
||||
3 => 'Three',
|
||||
4 => 'Four',
|
||||
5 => 'Five'
|
||||
)
|
||||
),
|
||||
null,
|
||||
array(),
|
||||
false
|
||||
);
|
||||
$expected = array(
|
||||
'select' => array('name' => 'data[Model][field]', 'id' => 'ModelField'),
|
||||
array('option' => array('value' => 1)),
|
||||
'One',
|
||||
'/option',
|
||||
array('option' => array('value' => 2)),
|
||||
'Two',
|
||||
'/option',
|
||||
array('optgroup' => array('label' => 'Three')),
|
||||
array('option' => array('value' => 3)),
|
||||
'Three',
|
||||
'/option',
|
||||
array('option' => array('value' => 4)),
|
||||
'Four',
|
||||
'/option',
|
||||
array('option' => array('value' => 5)),
|
||||
'Five',
|
||||
'/option',
|
||||
'/optgroup',
|
||||
'/select'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
|
|
|
@ -338,7 +338,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
$expected = '<span><a href="/index/page:1">1</a></span> | <span class="current">2</span> | <span><a href="/index/page:3">3</a></span> | <span><a href="/index/page:4">4</a></span> | <span><a href="/index/page:5">5</a></span> | <span><a href="/index/page:6">6</a></span> | <span><a href="/index/page:7">7</a></span> | <span><a href="/index/page:8">8</a></span> | <span><a href="/index/page:9">9</a></span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$this->Paginator->params['paging'] = array('Client' => array(
|
||||
'page' => 15, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
|
||||
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
|
||||
|
@ -349,8 +348,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
$expected = '<span><a href="/index/page:1">1</a></span>...<span><a href="/index/page:7">7</a></span> | <span><a href="/index/page:8">8</a></span> | <span><a href="/index/page:9">9</a></span> | <span><a href="/index/page:10">10</a></span> | <span><a href="/index/page:11">11</a></span> | <span><a href="/index/page:12">12</a></span> | <span><a href="/index/page:13">13</a></span> | <span><a href="/index/page:14">14</a></span> | <span class="current">15</span>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
|
||||
$this->Paginator->params['paging'] = array('Client' => array(
|
||||
'page' => 10, 'current' => 3, 'count' => 30, 'prevPage' => false, 'nextPage' => 2, 'pageCount' => 15,
|
||||
'defaults' => array('limit' => 3, 'step' => 1, 'order' => array('Client.name' => 'DESC'), 'conditions' => array()),
|
||||
|
@ -379,7 +376,6 @@ class PaginatorTest extends UnitTestCase {
|
|||
|
||||
$result = $this->Paginator->numbers(array('first' => 1, 'last' => 1));
|
||||
$expected = '<span><a href="/index/page:1">1</a></span>...<span><a href="/index/page:33">33</a></span> | <span><a href="/index/page:34">34</a></span> | <span><a href="/index/page:35">35</a></span> | <span><a href="/index/page:36">36</a></span> | <span class="current">37</span> | <span><a href="/index/page:38">38</a></span> | <span><a href="/index/page:39">39</a></span> | <span><a href="/index/page:40">40</a></span> | <span><a href="/index/page:41">41</a></span> | <span><a href="/index/page:42">42</a></span>';
|
||||
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->Paginator->params['paging'] = array(
|
||||
|
@ -394,7 +390,8 @@ class PaginatorTest extends UnitTestCase {
|
|||
'limit' => 3,
|
||||
'step' => 1,
|
||||
'order' => array('Client.name' => 'DESC'),
|
||||
'conditions' => array()),
|
||||
'conditions' => array()
|
||||
),
|
||||
'options' => array(
|
||||
'page' => 1,
|
||||
'limit' => 3,
|
||||
|
@ -511,7 +508,7 @@ class PaginatorTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* testHasPage method
|
||||
*
|
||||
* @access public
|
||||
|
|
1
cake/tests/fixtures/aco_fixture.php
vendored
1
cake/tests/fixtures/aco_fixture.php
vendored
|
@ -73,4 +73,5 @@ class AcoFixture extends CakeTestFixture {
|
|||
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
20
cake/tests/fixtures/aco_two_fixture.php
vendored
20
cake/tests/fixtures/aco_two_fixture.php
vendored
|
@ -62,16 +62,16 @@ class AcoTwoFixture extends CakeTestFixture {
|
|||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array('id' => 1, 'parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 20),
|
||||
array('id' => 2, 'parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports', 'lft' => 2, 'rght' => 9),
|
||||
array('id' => 3, 'parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 3, 'rght' => 6),
|
||||
array('id' => 4, 'parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'current', 'lft' => 4, 'rght' => 5),
|
||||
array('id' => 5, 'parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'update', 'lft' => 7, 'rght' => 8),
|
||||
array('id' => 6, 'parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'printers', 'lft' => 10, 'rght' => 19),
|
||||
array('id' => 7, 'parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'print', 'lft' => 11, 'rght' => 14),
|
||||
array('id' => 8, 'parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'lettersize','lft' => 12, 'rght' => 13),
|
||||
array('id' => 9, 'parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'refill', 'lft' => 15, 'rght' => 16),
|
||||
array('id' => 10, 'parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'smash', 'lft' => 17, 'rght' => 18),
|
||||
array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 20),
|
||||
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports', 'lft' => 2, 'rght' => 9),
|
||||
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 3, 'rght' => 6),
|
||||
array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'current', 'lft' => 4, 'rght' => 5),
|
||||
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'update', 'lft' => 7, 'rght' => 8),
|
||||
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'printers', 'lft' => 10, 'rght' => 19),
|
||||
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'print', 'lft' => 11, 'rght' => 14),
|
||||
array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'lettersize','lft' => 12, 'rght' => 13),
|
||||
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'refill', 'lft' => 15, 'rght' => 16),
|
||||
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'smash', 'lft' => 17, 'rght' => 18),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
17
cake/tests/fixtures/ad_fixture.php
vendored
17
cake/tests/fixtures/ad_fixture.php
vendored
|
@ -49,7 +49,7 @@ class AdFixture extends CakeTestFixture {
|
|||
'parent_id' => array('type' => 'integer'),
|
||||
'lft' => array('type' => 'integer'),
|
||||
'rght' => array('type' => 'integer'),
|
||||
'name' => array('type' => 'string', 'length' => 255, 'null' => false),
|
||||
'name' => array('type' => 'string', 'length' => 255, 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
|
@ -58,13 +58,14 @@ class AdFixture extends CakeTestFixture {
|
|||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array( 'id' => 1, 'parent_id' => NULL, 'lft' => 1, 'rght' => 2, 'campaign_id' => 1, 'name' => 'Nordover' ),
|
||||
array( 'id' => 2, 'parent_id' => NULL, 'lft' => 3, 'rght' => 4, 'campaign_id' => 1, 'name' => 'Statbergen' ),
|
||||
array( 'id' => 3, 'parent_id' => NULL, 'lft' => 5, 'rght' => 6, 'campaign_id' => 1, 'name' => 'Feroy' ),
|
||||
array( 'id' => 4, 'parent_id' => NULL, 'lft' => 7, 'rght' => 12, 'campaign_id' => 2, 'name' => 'Newcastle' ),
|
||||
array( 'id' => 5, 'parent_id' => NULL, 'lft' => 8, 'rght' => 9, 'campaign_id' => 2, 'name' => 'Dublin' ),
|
||||
array( 'id' => 6, 'parent_id' => NULL, 'lft' => 10, 'rght' => 11, 'campaign_id' => 2, 'name' => 'Alborg' ),
|
||||
array( 'id' => 7, 'parent_id' => NULL, 'lft' => 13, 'rght' => 14, 'campaign_id' => 3, 'name' => 'New York' ),
|
||||
array('parent_id' => null, 'lft' => 1, 'rght' => 2, 'campaign_id' => 1, 'name' => 'Nordover'),
|
||||
array('parent_id' => null, 'lft' => 3, 'rght' => 4, 'campaign_id' => 1, 'name' => 'Statbergen'),
|
||||
array('parent_id' => null, 'lft' => 5, 'rght' => 6, 'campaign_id' => 1, 'name' => 'Feroy'),
|
||||
array('parent_id' => null, 'lft' => 7, 'rght' => 12, 'campaign_id' => 2, 'name' => 'Newcastle'),
|
||||
array('parent_id' => null, 'lft' => 8, 'rght' => 9, 'campaign_id' => 2, 'name' => 'Dublin'),
|
||||
array('parent_id' => null, 'lft' => 10, 'rght' => 11, 'campaign_id' => 2, 'name' => 'Alborg'),
|
||||
array('parent_id' => null, 'lft' => 13, 'rght' => 14, 'campaign_id' => 3, 'name' => 'New York')
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
7
cake/tests/fixtures/campaign_fixture.php
vendored
7
cake/tests/fixtures/campaign_fixture.php
vendored
|
@ -54,9 +54,10 @@ class CampaignFixture extends CakeTestFixture {
|
|||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array( 'id' => 1 , 'name' => 'Hurtigruten' ),
|
||||
array( 'id' => 2 , 'name' => 'Colorline' ),
|
||||
array( 'id' => 3 , 'name' => 'Queen of Scandinavia' )
|
||||
array('name' => 'Hurtigruten'),
|
||||
array('name' => 'Colorline'),
|
||||
array('name' => 'Queen of Scandinavia')
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
19
cake/tests/fixtures/product_fixture.php
vendored
19
cake/tests/fixtures/product_fixture.php
vendored
|
@ -50,7 +50,7 @@ class ProductFixture extends CakeTestFixture {
|
|||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'length' => 255, 'null' => false),
|
||||
'type' => array('type' => 'string', 'length' => 255, 'null' => false),
|
||||
'price' => array('type' => 'integer', 'null' => false),
|
||||
'price' => array('type' => 'integer', 'null' => false)
|
||||
);
|
||||
/**
|
||||
* records property
|
||||
|
@ -59,14 +59,15 @@ class ProductFixture extends CakeTestFixture {
|
|||
* @access public
|
||||
*/
|
||||
var $records = array(
|
||||
array( 'id' => 1 , 'name' => 'Park\'s Great Hits', 'type' => 'Music', 'price' => 19 ),
|
||||
array( 'id' => 2 , 'name' => 'Silly Puddy', 'type' => 'Toy', 'price' => 3 ),
|
||||
array( 'id' => 3 , 'name' => 'Playstation', 'type' => 'Toy', 'price' => 89 ),
|
||||
array( 'id' => 4 , 'name' => 'Men\'s T-Shirt', 'type' => 'Clothing', 'price' => 32 ),
|
||||
array( 'id' => 5 , 'name' => 'Blouse', 'type' => 'Clothing', 'price' => 34 ),
|
||||
array( 'id' => 6 , 'name' => 'Electronica 2002', 'type' => 'Music', 'price' => 4 ),
|
||||
array( 'id' => 7 , 'name' => 'Country Tunes', 'type' => 'Music', 'price' => 21 ),
|
||||
array( 'id' => 8 , 'name' => 'Watermelon', 'type' => 'Food', 'price' => 9 ),
|
||||
array('name' => 'Park\'s Great Hits', 'type' => 'Music', 'price' => 19),
|
||||
array('name' => 'Silly Puddy', 'type' => 'Toy', 'price' => 3),
|
||||
array('name' => 'Playstation', 'type' => 'Toy', 'price' => 89),
|
||||
array('name' => 'Men\'s T-Shirt', 'type' => 'Clothing', 'price' => 32),
|
||||
array('name' => 'Blouse', 'type' => 'Clothing', 'price' => 34),
|
||||
array('name' => 'Electronica 2002', 'type' => 'Music', 'price' => 4),
|
||||
array('name' => 'Country Tunes', 'type' => 'Music', 'price' => 21),
|
||||
array('name' => 'Watermelon', 'type' => 'Food', 'price' => 9)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
4
cake/tests/fixtures/translate_fixture.php
vendored
4
cake/tests/fixtures/translate_fixture.php
vendored
|
@ -85,6 +85,8 @@ class TranslateFixture extends CakeTestFixture {
|
|||
array('locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Titel #3'),
|
||||
array('locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Inhalt #3'),
|
||||
array('locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'title', 'content' => 'Titulek #3'),
|
||||
array('locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Obsah #3'));
|
||||
array('locale' => 'cze', 'model' => 'TranslatedItem', 'foreign_key' => 3, 'field' => 'content', 'content' => 'Obsah #3')
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -34,8 +34,7 @@
|
|||
php_sapi_name() == 'cgi') {
|
||||
define('STDOUT', fopen('php://stdout', 'w'));
|
||||
define('STDERR', fopen('php://stderr', 'w'));
|
||||
register_shutdown_function(
|
||||
create_function('', 'fclose(STDOUT); fclose(STDERR); return true;'));
|
||||
register_shutdown_function(create_function('', 'fclose(STDOUT); fclose(STDERR); return true;'));
|
||||
}
|
||||
/**
|
||||
* Minimal command line test displayer. Writes fail details to STDERR. Returns 0
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestsAppsController extends AppController {
|
|||
var $name = 'TestsApps';
|
||||
var $uses = array();
|
||||
|
||||
function index(){
|
||||
function index() {
|
||||
}
|
||||
|
||||
function some_method() {
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestsPluginsTestsController extends AppController {
|
|||
var $name = 'TestsPluginsTests';
|
||||
var $uses = array();
|
||||
|
||||
function index(){
|
||||
function index() {
|
||||
}
|
||||
|
||||
function some_method() {
|
||||
|
|
Loading…
Reference in a new issue