Revert "Giant changes to make it work on php7"

This reverts commit 144a7a0fb1.
This commit is contained in:
Karl Cordes 2025-08-08 13:39:37 +10:00
parent 144a7a0fb1
commit 97dbeb6a1c
145 changed files with 845 additions and 2144 deletions

View file

@ -65,12 +65,8 @@ RUN chown -R www-data:www-data /var/www/cmc-sales \
# Set working directory # Set working directory
WORKDIR /var/www/cmc-sales WORKDIR /var/www/cmc-sales
# Copy CakePHP core and application # Copy application (will be overridden by volume mount)
COPY cake/ /var/www/cmc-sales/cake/
COPY app/ /var/www/cmc-sales/app/ COPY app/ /var/www/cmc-sales/app/
COPY vendors/ /var/www/cmc-sales/vendors/
COPY index.php /var/www/cmc-sales/
COPY *.sh /var/www/cmc-sales/
# Expose port 80 # Expose port 80
EXPOSE 80 EXPOSE 80

BIN
app/.DS_Store vendored

Binary file not shown.

View file

@ -2,6 +2,8 @@
//CakePHP is pretty awful. I was so foolish. //CakePHP is pretty awful. I was so foolish.
class DATABASE_CONFIG { class DATABASE_CONFIG {
var $default = array( var $default = array(
@ -13,19 +15,4 @@ class DATABASE_CONFIG {
'database' => 'cmc', 'database' => 'cmc',
'prefix' => '', 'prefix' => '',
); );
function __construct() {
// Use environment-specific database settings if APP_ENV is set
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'staging') {
$this->default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'db-staging',
'login' => 'cmc_staging',
'password' => 'staging_password',
'database' => 'cmc_staging',
'prefix' => '',
);
}
}
} }

View file

@ -5,10 +5,10 @@
var $default = array( var $default = array(
'driver' => 'mysql', 'driver' => 'mysql',
'persistent' => false, 'persistent' => false,
'host' => 'db-staging', 'host' => '172.17.0.1',
'login' => 'cmc_staging', 'login' => 'staging',
'password' => 'staging_password', 'password' => 'stagingmoopwoopVerySecure',
'database' => 'cmc_staging', 'database' => 'staging',
'prefix' => '', 'prefix' => '',
); );
} }

View file

@ -94,11 +94,3 @@ if (!function_exists('mysql_connect')) {
return mysqli_real_escape_string($link_identifier, $unescaped_string); return mysqli_real_escape_string($link_identifier, $unescaped_string);
} }
} }
// Create alias for Object class to fix PHP 7 reserved word issue
// This should be included AFTER CakePHP's Object class is defined
function create_object_alias() {
if (class_exists('CakeObject') && !class_exists('Object', false)) {
class_alias('CakeObject', 'Object');
}
}

BIN
app/webroot/.DS_Store vendored

Binary file not shown.

View file

@ -1,111 +0,0 @@
<?php
/**
* CakePHP Setup Test
*/
echo "<h1>CakePHP Setup Test</h1>";
// Test 1: PHP Version
echo "<h2>PHP Information</h2>";
echo "<p><strong>PHP Version:</strong> " . PHP_VERSION . "</p>";
echo "<p><strong>Server API:</strong> " . php_sapi_name() . "</p>";
// Test 2: Required Extensions
echo "<h2>PHP Extensions</h2>";
$extensions = ['mysql', 'mysqli', 'gd', 'curl', 'mbstring'];
foreach ($extensions as $ext) {
$loaded = extension_loaded($ext);
echo "<p><strong>$ext:</strong> " . ($loaded ? '✓ Loaded' : '✗ Not Loaded') . "</p>";
}
// Test 3: CakePHP Constants
echo "<h2>CakePHP Constants</h2>";
$constants = ['ROOT', 'APP_DIR', 'CAKE_CORE_INCLUDE_PATH', 'WWW_ROOT'];
foreach ($constants as $const) {
if (defined($const)) {
echo "<p><strong>$const:</strong> " . constant($const) . "</p>";
} else {
echo "<p><strong>$const:</strong> ✗ Not defined</p>";
}
}
// Test 4: File System
echo "<h2>File System</h2>";
$paths = [
'/var/www/cmc-sales',
'/var/www/cmc-sales/cake',
'/var/www/cmc-sales/app',
'/var/www/cmc-sales/app/webroot'
];
foreach ($paths as $path) {
$exists = file_exists($path);
$readable = is_readable($path);
echo "<p><strong>$path:</strong> " .
($exists ? '✓ Exists' : '✗ Missing') .
($readable ? ', ✓ Readable' : ', ✗ Not readable') . "</p>";
}
// Test 5: CakePHP Core
echo "<h2>CakePHP Core Test</h2>";
$cake_bootstrap = '/var/www/cmc-sales/cake/bootstrap.php';
if (file_exists($cake_bootstrap)) {
echo "<p><strong>CakePHP Bootstrap:</strong> ✓ Found at $cake_bootstrap</p>";
// Try to include it
try {
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', '/var/www/cmc-sales');
}
if (!defined('ROOT')) {
define('ROOT', '/var/www/cmc-sales');
}
if (!defined('APP_DIR')) {
define('APP_DIR', 'app');
}
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
echo "<p><strong>Include Test:</strong> Ready to include CakePHP</p>";
// Note: We don't actually include it here to avoid conflicts
} catch (Exception $e) {
echo "<p><strong>Include Test:</strong> ✗ Error - " . $e->getMessage() . "</p>";
}
} else {
echo "<p><strong>CakePHP Bootstrap:</strong> ✗ Not found</p>";
}
// Test 6: Database
echo "<h2>Database Test</h2>";
$db_host = $_ENV['DB_HOST'] ?? 'db-staging';
$db_user = $_ENV['DB_USER'] ?? 'cmc_staging';
$db_pass = $_ENV['DB_PASSWORD'] ?? '';
$db_name = $_ENV['DB_NAME'] ?? 'cmc_staging';
echo "<p><strong>DB Host:</strong> $db_host</p>";
echo "<p><strong>DB User:</strong> $db_user</p>";
echo "<p><strong>DB Name:</strong> $db_name</p>";
if (function_exists('mysqli_connect')) {
$conn = @mysqli_connect($db_host, $db_user, $db_pass, $db_name);
if ($conn) {
echo "<p><strong>Database Connection:</strong> ✓ Connected</p>";
mysqli_close($conn);
} else {
echo "<p><strong>Database Connection:</strong> ✗ Failed - " . mysqli_connect_error() . "</p>";
}
} else {
echo "<p><strong>Database Connection:</strong> ✗ MySQLi not available</p>";
}
echo "<h2>Server Information</h2>";
echo "<pre>";
echo "Document Root: " . $_SERVER['DOCUMENT_ROOT'] . "\n";
echo "Script Name: " . $_SERVER['SCRIPT_NAME'] . "\n";
echo "Working Directory: " . getcwd() . "\n";
echo "</pre>";
echo "<p><small>Generated at: " . date('Y-m-d H:i:s') . "</small></p>";
?>

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.console * @subpackage cake.cake.console
*/ */
class ErrorHandler extends CakeObject { class ErrorHandler extends Object {
/** /**
* Standard output stream. * Standard output stream.
* *

View file

@ -64,7 +64,7 @@ class ConsoleShell extends Shell {
foreach ($this->models as $model) { foreach ($this->models as $model) {
$class = Inflector::camelize(r('.php', '', $model)); $class = Inflector::camelize(r('.php', '', $model));
$this->models[$model] = $class; $this->models[$model] = $class;
$this->{$class} = new $class(); $this->{$class} =& new $class();
} }
$this->out('Model classes:'); $this->out('Model classes:');
$this->out('--------------'); $this->out('--------------');

View file

@ -79,7 +79,7 @@ class SchemaShell extends Shell {
$connection = $this->params['connection']; $connection = $this->params['connection'];
} }
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection')); $this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection'));
} }
/** /**
* Override main * Override main
@ -138,7 +138,7 @@ class SchemaShell extends Shell {
$content['file'] = $this->params['file']; $content['file'] = $this->params['file'];
if ($snapshot === true) { if ($snapshot === true) {
$Folder = new Folder($this->Schema->path); $Folder =& new Folder($this->Schema->path);
$result = $Folder->read(); $result = $Folder->read();
$numToUse = false; $numToUse = false;

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.console.libs * @subpackage cake.cake.console.libs
*/ */
class Shell extends CakeObject { class Shell extends Object {
/** /**
* An instance of the ShellDispatcher object that loaded this script * An instance of the ShellDispatcher object that loaded this script
* *
@ -200,7 +200,7 @@ class Shell extends CakeObject {
*/ */
function _loadDbConfig() { function _loadDbConfig() {
if (config('database') && class_exists('DATABASE_CONFIG')) { if (config('database') && class_exists('DATABASE_CONFIG')) {
$this->DbConfig = new DATABASE_CONFIG(); $this->DbConfig =& new DATABASE_CONFIG();
return true; return true;
} }
$this->err('Database config could not be loaded'); $this->err('Database config could not be loaded');
@ -222,7 +222,7 @@ class Shell extends CakeObject {
} }
if ($this->uses === true && App::import('Model', 'AppModel')) { if ($this->uses === true && App::import('Model', 'AppModel')) {
$this->AppModel = new AppModel(false, false, false); $this->AppModel =& new AppModel(false, false, false);
return true; return true;
} }
@ -290,7 +290,7 @@ class Shell extends CakeObject {
} else { } else {
$this->taskNames[] = $taskName; $this->taskNames[] = $taskName;
if (!PHP5) { if (!PHP5) {
$this->{$taskName} = new $taskClass($this->Dispatch); $this->{$taskName} =& new $taskClass($this->Dispatch);
} else { } else {
$this->{$taskName} = new $taskClass($this->Dispatch); $this->{$taskName} = new $taskClass($this->Dispatch);
} }

View file

@ -252,7 +252,7 @@ class ControllerTask extends Shell {
exit; exit;
} }
$actions = null; $actions = null;
$modelObj = new $currentModelName(); $modelObj =& new $currentModelName();
$controllerPath = $this->_controllerPath($controllerName); $controllerPath = $this->_controllerPath($controllerName);
$pluralName = $this->_pluralName($currentModelName); $pluralName = $this->_pluralName($currentModelName);
$singularName = Inflector::variable($currentModelName); $singularName = Inflector::variable($currentModelName);

View file

@ -192,7 +192,7 @@ class ProjectTask extends Shell {
* @access public * @access public
*/ */
function securitySalt($path) { function securitySalt($path) {
$File = new File($path . 'config' . DS . 'core.php'); $File =& new File($path . 'config' . DS . 'core.php');
$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')) {
@ -216,7 +216,7 @@ class ProjectTask extends Shell {
*/ */
function corePath($path) { function corePath($path) {
if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) { if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) {
$File = new File($path . 'webroot' . DS . 'index.php'); $File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents); $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
@ -227,7 +227,7 @@ class ProjectTask extends Shell {
return false; return false;
} }
$File = new File($path . 'webroot' . DS . 'test.php'); $File =& new File($path . 'webroot' . DS . 'test.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents); $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
@ -248,7 +248,7 @@ class ProjectTask extends Shell {
* @access public * @access public
*/ */
function cakeAdmin($name) { function cakeAdmin($name) {
$File = new File(CONFIGS . 'core.php'); $File =& new File(CONFIGS . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('%([/\\t\\x20]*Configure::write\(\'Routing.admin\',[\\t\\x20\'a-z]*\\);)%', $contents, $match)) { if (preg_match('%([/\\t\\x20]*Configure::write\(\'Routing.admin\',[\\t\\x20\'a-z]*\\);)%', $contents, $match)) {
$result = str_replace($match[0], "\t" . 'Configure::write(\'Routing.admin\', \''.$name.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Routing.admin\', \''.$name.'\');', $contents);

View file

@ -290,7 +290,7 @@ class ViewTask extends Shell {
$content = $this->getContent(); $content = $this->getContent();
} }
$filename = $this->path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp'; $filename = $this->path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
$Folder = new Folder($this->path . $this->controllerPath, true); $Folder =& new Folder($this->path . $this->controllerPath, true);
$errors = $Folder->errors(); $errors = $Folder->errors();
if (empty($errors)) { if (empty($errors)) {
$path = $Folder->slashTerm($Folder->pwd()); $path = $Folder->slashTerm($Folder->pwd());

View file

@ -37,7 +37,7 @@ App::import('Core', array('Router', 'Controller'));
* @package cake * @package cake
* @subpackage cake.cake * @subpackage cake.cake
*/ */
class Dispatcher extends CakeObject { class Dispatcher extends Object {
/** /**
* Base URL * Base URL
* *
@ -456,7 +456,7 @@ class Dispatcher extends CakeObject {
$params = $this->_restructureParams($params, true); $params = $this->_restructureParams($params, true);
} }
$this->params = $params; $this->params = $params;
$controller = new $ctrlClass(); $controller =& new $ctrlClass();
} }
return $controller; return $controller;
} }
@ -679,7 +679,7 @@ class Dispatcher extends CakeObject {
App::import('Core', 'View'); App::import('Core', 'View');
} }
$controller = null; $controller = null;
$view = new View($controller, false); $view =& new View($controller, false);
return $view->renderCache($filename, getMicrotime()); return $view->renderCache($filename, getMicrotime());
} }
} }

View file

@ -29,7 +29,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Cache extends CakeObject { class Cache extends Object {
/** /**
* Cache engine to use * Cache engine to use
* *
@ -68,7 +68,7 @@ class Cache extends CakeObject {
function &getInstance() { function &getInstance() {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Cache(); $instance[0] =& new Cache();
} }
return $instance[0]; return $instance[0];
} }
@ -148,7 +148,7 @@ class Cache extends CakeObject {
if ($_this->__loadEngine($name) === false) { if ($_this->__loadEngine($name) === false) {
return false; return false;
} }
$_this->_Engine[$name] = new $cacheClass(); $_this->_Engine[$name] =& new $cacheClass();
} }
if ($_this->_Engine[$name]->init($settings)) { if ($_this->_Engine[$name]->init($settings)) {
@ -406,7 +406,7 @@ class Cache extends CakeObject {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class CacheEngine extends CakeObject { class CacheEngine extends Object {
/** /**
* settings of current engine instance * settings of current engine instance
* *

View file

@ -86,7 +86,7 @@ class FileEngine extends CacheEngine {
if (!class_exists('File')) { if (!class_exists('File')) {
require LIBS . 'file.php'; require LIBS . 'file.php';
} }
$this->__File = new File($this->settings['path'] . DS . 'cake'); $this->__File =& new File($this->settings['path'] . DS . 'cake');
} }
if (DIRECTORY_SEPARATOR === '\\') { if (DIRECTORY_SEPARATOR === '\\') {

View file

@ -73,7 +73,7 @@ class MemcacheEngine extends CacheEngine {
} }
if (!isset($this->__Memcache)) { if (!isset($this->__Memcache)) {
$return = false; $return = false;
$this->__Memcache = new Memcache(); $this->__Memcache =& new Memcache();
foreach ($this->settings['servers'] as $server) { foreach ($this->settings['servers'] as $server) {
$parts = explode(':', $server); $parts = explode(':', $server);
$host = $parts[0]; $host = $parts[0];

View file

@ -65,7 +65,7 @@ class ClassRegistry {
function &getInstance() { function &getInstance() {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new ClassRegistry(); $instance[0] =& new ClassRegistry();
} }
return $instance[0]; return $instance[0];
} }
@ -137,7 +137,7 @@ class ClassRegistry {
} }
if (class_exists($class) || App::import($type, $pluginPath . $class)) { if (class_exists($class) || App::import($type, $pluginPath . $class)) {
${$class} = new $class($settings); ${$class} =& new $class($settings);
} elseif ($type === 'Model') { } elseif ($type === 'Model') {
if ($plugin && class_exists($plugin . 'AppModel')) { if ($plugin && class_exists($plugin . 'AppModel')) {
$appModel = $plugin . 'AppModel'; $appModel = $plugin . 'AppModel';
@ -145,7 +145,7 @@ class ClassRegistry {
$appModel = 'AppModel'; $appModel = 'AppModel';
} }
$settings['name'] = $class; $settings['name'] = $class;
${$class} = new $appModel($settings); ${$class} =& new $appModel($settings);
} }
if (!isset(${$class})) { if (!isset(${$class})) {

View file

@ -31,7 +31,7 @@
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @link http://book.cakephp.org/view/42/The-Configuration-Class * @link http://book.cakephp.org/view/42/The-Configuration-Class
*/ */
class Configure extends CakeObject { class Configure extends Object {
/** /**
* List of additional path(s) where model files reside. * List of additional path(s) where model files reside.
* *
@ -133,7 +133,7 @@ class Configure extends CakeObject {
static function &getInstance($boot = true) { static function &getInstance($boot = true) {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Configure(); $instance[0] =& new Configure();
$instance[0]->__loadBootstrap($boot); $instance[0]->__loadBootstrap($boot);
} }
return $instance[0]; return $instance[0];
@ -223,7 +223,7 @@ class Configure extends CakeObject {
require LIBS . 'folder.php'; require LIBS . 'folder.php';
} }
$items = array(); $items = array();
$Folder = new Folder($path); $Folder =& new Folder($path);
$contents = $Folder->read(false, true); $contents = $Folder->read(false, true);
if (is_array($contents)) { if (is_array($contents)) {
@ -717,7 +717,7 @@ class Configure extends CakeObject {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class App extends CakeObject { class App extends Object {
/** /**
* Paths to search for files. * Paths to search for files.
* *
@ -903,7 +903,7 @@ class App extends CakeObject {
function &getInstance() { function &getInstance() {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new App(); $instance[0] =& new App();
$instance[0]->__map = Cache::read('file_map', '_cake_core_'); $instance[0]->__map = Cache::read('file_map', '_cake_core_');
} }
return $instance[0]; return $instance[0];
@ -943,7 +943,7 @@ class App extends CakeObject {
if (!class_exists('Folder')) { if (!class_exists('Folder')) {
require LIBS . 'folder.php'; require LIBS . 'folder.php';
} }
$Folder = new Folder(); $Folder =& new Folder();
$directories = $Folder->tree($path, false, 'dir'); $directories = $Folder->tree($path, false, 'dir');
$this->__paths[$path] = $directories; $this->__paths[$path] = $directories;
} }

View file

@ -28,7 +28,7 @@
* @subpackage cake.cake.libs.controller * @subpackage cake.cake.libs.controller
* @link http://book.cakephp.org/view/62/Components * @link http://book.cakephp.org/view/62/Components
*/ */
class Component extends CakeObject { class Component extends Object {
/** /**
* Contains various controller variable information (plugin, name, base). * Contains various controller variable information (plugin, name, base).
* *
@ -234,9 +234,9 @@ class Component extends CakeObject {
} }
} else { } else {
if ($componentCn === 'SessionComponent') { if ($componentCn === 'SessionComponent') {
$object->{$component} = new $componentCn($base); $object->{$component} =& new $componentCn($base);
} else { } else {
$object->{$component} = new $componentCn(); $object->{$component} =& new $componentCn();
} }
$object->{$component}->enabled = true; $object->{$component}->enabled = true;
$this->_loaded[$component] =& $object->{$component}; $this->_loaded[$component] =& $object->{$component};

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
*/ */
class AclComponent extends CakeObject { class AclComponent extends Object {
/** /**
* Instance of an ACL class * Instance of an ACL class
* *
@ -56,7 +56,7 @@ class AclComponent extends CakeObject {
trigger_error(sprintf(__('Could not find %s.', true), $name), E_USER_WARNING); trigger_error(sprintf(__('Could not find %s.', true), $name), E_USER_WARNING);
} }
} }
$this->_Instance = new $name(); $this->_Instance =& new $name();
$this->_Instance->initialize($this); $this->_Instance->initialize($this);
} }
/** /**
@ -157,7 +157,7 @@ class AclComponent extends CakeObject {
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
* @abstract * @abstract
*/ */
class AclBase extends CakeObject { class AclBase extends Object {
/** /**
* This class should never be instantiated, just subclassed. * This class should never be instantiated, just subclassed.
* *

View file

@ -36,7 +36,7 @@ App::import(array('Router', 'Security'));
* @package cake * @package cake
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
*/ */
class AuthComponent extends CakeObject { class AuthComponent extends Object {
/** /**
* Maintains current user login state. * Maintains current user login state.
* *

View file

@ -37,7 +37,7 @@ App::import('Core', 'Security');
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
* *
*/ */
class CookieComponent extends CakeObject { class CookieComponent extends Object {
/** /**
* The name of the cookie. * The name of the cookie.
* *

View file

@ -35,7 +35,7 @@
* *
*/ */
App::import('Core', 'Multibyte'); App::import('Core', 'Multibyte');
class EmailComponent extends CakeObject{ class EmailComponent extends Object{
/** /**
* Recipient of the email * Recipient of the email
* *
@ -671,7 +671,7 @@ class EmailComponent extends CakeObject{
function __smtp() { function __smtp() {
App::import('Core', array('Socket')); App::import('Core', array('Socket'));
$this->__smtpConnection = new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->smtpOptions)); $this->__smtpConnection =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->smtpOptions));
if (!$this->__smtpConnection->connect()) { if (!$this->__smtpConnection->connect()) {
$this->smtpError = $this->__smtpConnection->lastError(); $this->smtpError = $this->__smtpConnection->lastError();

View file

@ -36,7 +36,7 @@ if (!defined('REQUEST_MOBILE_UA')) {
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
* *
*/ */
class RequestHandlerComponent extends CakeObject { class RequestHandlerComponent extends Object {
/** /**
* The layout that will be switched to for Ajax requests * The layout that will be switched to for Ajax requests
* *

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
*/ */
class SecurityComponent extends CakeObject { class SecurityComponent extends Object {
/** /**
* The controller method that will be called if this request is black-hole'd * The controller method that will be called if this request is black-hole'd
* *

View file

@ -38,7 +38,7 @@ App::import('Core', array('Component', 'View'));
* @link http://book.cakephp.org/view/49/Controllers * @link http://book.cakephp.org/view/49/Controllers
* *
*/ */
class Controller extends CakeObject { class Controller extends Object {
/** /**
* The name of this controller. Controller names are plural, named after the model they manipulate. * The name of this controller. Controller names are plural, named after the model they manipulate.
* *
@ -335,7 +335,7 @@ class Controller extends CakeObject {
} }
$this->modelClass = Inflector::classify($this->name); $this->modelClass = Inflector::classify($this->name);
$this->modelKey = Inflector::underscore($this->modelClass); $this->modelKey = Inflector::underscore($this->modelClass);
$this->Component = new Component(); $this->Component =& new Component();
$childMethods = get_class_methods($this); $childMethods = get_class_methods($this);
$parentMethods = get_class_methods('Controller'); $parentMethods = get_class_methods('Controller');
@ -776,7 +776,7 @@ class Controller extends CakeObject {
$this->set('cakeDebug', $this); $this->set('cakeDebug', $this);
} }
$View = new $viewClass($this); $View =& new $viewClass($this);
if (!empty($this->modelNames)) { if (!empty($this->modelNames)) {
$models = array(); $models = array();

View file

@ -35,7 +35,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs.controller * @subpackage cake.cake.libs.controller
*/ */
class Scaffold extends CakeObject { class Scaffold extends Object {
/** /**
* Controller object * Controller object
* *

View file

@ -43,7 +43,7 @@
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @link http://book.cakephp.org/view/460/Using-the-Debugger-Class * @link http://book.cakephp.org/view/460/Using-the-Debugger-Class
*/ */
class Debugger extends CakeObject { class Debugger extends Object {
/** /**
* A list of errors generated by the application. * A list of errors generated by the application.
* *
@ -105,7 +105,7 @@ class Debugger extends CakeObject {
} }
if (!$instance) { if (!$instance) {
$instance[0] = new Debugger(); $instance[0] =& new Debugger();
if (Configure::read() > 0) { if (Configure::read() > 0) {
Configure::version(); // Make sure the core config is loaded Configure::version(); // Make sure the core config is loaded
$instance[0]->helpPath = Configure::read('Cake.Debugger.HelpPath'); $instance[0]->helpPath = Configure::read('Cake.Debugger.HelpPath');

View file

@ -66,7 +66,7 @@ class CakeErrorController extends AppController {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class ErrorHandler extends CakeObject { class ErrorHandler extends Object {
/** /**
* Controller instance. * Controller instance.
* *
@ -86,9 +86,9 @@ class ErrorHandler extends CakeObject {
if ($__previousError != array($method, $messages)) { if ($__previousError != array($method, $messages)) {
$__previousError = array($method, $messages); $__previousError = array($method, $messages);
$this->controller = new CakeErrorController(); $this->controller =& new CakeErrorController();
} else { } else {
$this->controller = new Controller(); $this->controller =& new Controller();
$this->controller->viewPath = 'errors'; $this->controller->viewPath = 'errors';
} }

View file

@ -38,7 +38,7 @@ if (!class_exists('Folder')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class File extends CakeObject { class File extends Object {
/** /**
* Folder object of the File * Folder object of the File
* *
@ -93,7 +93,7 @@ class File extends CakeObject {
*/ */
function __construct($path, $create = false, $mode = 0755) { function __construct($path, $create = false, $mode = 0755) {
parent::__construct(); parent::__construct();
$this->Folder = new Folder(dirname($path), $create, $mode); $this->Folder =& new Folder(dirname($path), $create, $mode);
if (!is_dir($path)) { if (!is_dir($path)) {
$this->name = basename($path); $this->name = basename($path);
} }

View file

@ -39,7 +39,7 @@ if (!class_exists('Object')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Flay extends CakeObject{ class Flay extends Object{
/** /**
* Text to be parsed. * Text to be parsed.
* *

View file

@ -37,7 +37,7 @@ if (!class_exists('Object')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Folder extends CakeObject { class Folder extends Object {
/** /**
* Path to Folder. * Path to Folder.
* *

View file

@ -36,7 +36,7 @@ App::import('Core', 'l10n');
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class I18n extends CakeObject { class I18n extends Object {
/** /**
* Instance of the I10n class for localization * Instance of the I10n class for localization
* *
@ -106,8 +106,8 @@ class I18n extends CakeObject {
function &getInstance() { function &getInstance() {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new I18n(); $instance[0] =& new I18n();
$instance[0]->l10n = new L10n(); $instance[0]->l10n =& new L10n();
} }
return $instance[0]; return $instance[0];
} }

View file

@ -45,7 +45,7 @@ if (!class_exists('Set')) {
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @link http://book.cakephp.org/view/491/Inflector * @link http://book.cakephp.org/view/491/Inflector
*/ */
class Inflector extends CakeObject { class Inflector extends Object {
/** /**
* Pluralized words. * Pluralized words.
* *
@ -128,7 +128,7 @@ class Inflector extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Inflector(); $instance[0] =& new Inflector();
if (file_exists(CONFIGS.'inflections.php')) { if (file_exists(CONFIGS.'inflections.php')) {
include(CONFIGS.'inflections.php'); include(CONFIGS.'inflections.php');
$instance[0]->__pluralRules = $pluralRules; $instance[0]->__pluralRules = $pluralRules;

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class L10n extends CakeObject { class L10n extends Object {
/** /**
* The language for current locale * The language for current locale
* *

View file

@ -31,7 +31,7 @@ if (!class_exists('File')) {
* @package cake.tests * @package cake.tests
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class MagicDb extends CakeObject { class MagicDb extends Object {
/** /**
* Holds the parsed MagicDb for this class instance * Holds the parsed MagicDb for this class instance
* *
@ -53,7 +53,7 @@ class MagicDb extends CakeObject {
if (is_array($magicDb) || strpos($magicDb, '# FILE_ID DB') === 0) { if (is_array($magicDb) || strpos($magicDb, '# FILE_ID DB') === 0) {
$data = $magicDb; $data = $magicDb;
} else { } else {
$File = new File($magicDb); $File =& new File($magicDb);
if (!$File->exists()) { if (!$File->exists()) {
return false; return false;
} }
@ -158,7 +158,7 @@ class MagicDb extends CakeObject {
} }
$matches = array(); $matches = array();
$MagicFileResource = new MagicFileResource($file); $MagicFileResource =& new MagicFileResource($file);
foreach ($this->db['database'] as $format) { foreach ($this->db['database'] as $format) {
$magic = $format[0]; $magic = $format[0];
$match = $MagicFileResource->test($magic); $match = $MagicFileResource->test($magic);
@ -178,7 +178,7 @@ class MagicDb extends CakeObject {
* @package cake.tests * @package cake.tests
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class MagicFileResource extends CakeObject{ class MagicFileResource extends Object{
/** /**
* undocumented variable * undocumented variable
* *
@ -202,7 +202,7 @@ class MagicFileResource extends CakeObject{
*/ */
function __construct($file) { function __construct($file) {
if (file_exists($file)) { if (file_exists($file)) {
$this->resource = new File($file); $this->resource =& new File($file);
} else { } else {
$this->resource = $file; $this->resource = $file;
} }

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs.model * @subpackage cake.cake.libs.model
*/ */
class ModelBehavior extends CakeObject { class ModelBehavior extends Object {
/** /**
* Contains configuration settings for use with individual model objects. This * Contains configuration settings for use with individual model objects. This
* is used because if multiple models use this Behavior, each will use the same * is used because if multiple models use this Behavior, each will use the same
@ -204,7 +204,7 @@ class ModelBehavior extends CakeObject {
* @package cake * @package cake
* @subpackage cake.cake.libs.model * @subpackage cake.cake.libs.model
*/ */
class BehaviorCollection extends CakeObject { class BehaviorCollection extends Object {
/** /**
* Stores a reference to the attached name * Stores a reference to the attached name
* *
@ -283,7 +283,7 @@ class BehaviorCollection extends CakeObject {
if (PHP5) { if (PHP5) {
$this->{$name} = new $class; $this->{$name} = new $class;
} else { } else {
$this->{$name} = new $class; $this->{$name} =& new $class;
} }
ClassRegistry::addObject($class, $this->{$name}); ClassRegistry::addObject($class, $this->{$name});
} }

View file

@ -35,7 +35,7 @@ config('database');
* @package cake * @package cake
* @subpackage cake.cake.libs.model * @subpackage cake.cake.libs.model
*/ */
class ConnectionManager extends CakeObject { class ConnectionManager extends Object {
/** /**
* Holds a loaded instance of the Connections object * Holds a loaded instance of the Connections object
* *
@ -63,7 +63,7 @@ class ConnectionManager extends CakeObject {
*/ */
function __construct() { function __construct() {
if (class_exists('DATABASE_CONFIG')) { if (class_exists('DATABASE_CONFIG')) {
$this->config = new DATABASE_CONFIG(); $this->config =& new DATABASE_CONFIG();
} }
} }
/** /**
@ -77,7 +77,7 @@ class ConnectionManager extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new ConnectionManager(); $instance[0] =& new ConnectionManager();
} }
return $instance[0]; return $instance[0];
@ -103,7 +103,7 @@ class ConnectionManager extends CakeObject {
$conn = $connections[$name]; $conn = $connections[$name];
$class = $conn['classname']; $class = $conn['classname'];
$_this->loadDataSource($name); $_this->loadDataSource($name);
$_this->_dataSources[$name] = new $class($_this->config->{$name}); $_this->_dataSources[$name] =& new $class($_this->config->{$name});
$_this->_dataSources[$name]->configKeyName = $name; $_this->_dataSources[$name]->configKeyName = $name;
} else { } else {
trigger_error(sprintf(__("ConnectionManager::getDataSource - Non-existent data source %s", true), $name), E_USER_ERROR); trigger_error(sprintf(__("ConnectionManager::getDataSource - Non-existent data source %s", true), $name), E_USER_ERROR);

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs.model.datasources * @subpackage cake.cake.libs.model.datasources
*/ */
class DataSource extends CakeObject { class DataSource extends Object {
/** /**
* Are we connected to the DataSource? * Are we connected to the DataSource?
* *

View file

@ -29,7 +29,7 @@ App::import('Model', 'ConnectionManager');
* @package cake * @package cake
* @subpackage cake.cake.libs.model * @subpackage cake.cake.libs.model
*/ */
class CakeSchema extends CakeObject { class CakeSchema extends Object {
/** /**
* Name of the App Schema * Name of the App Schema
* *
@ -158,7 +158,7 @@ class CakeSchema extends CakeObject {
} }
if (class_exists($class)) { if (class_exists($class)) {
$Schema = new $class($options); $Schema =& new $class($options);
return $Schema; return $Schema;
} }
@ -354,7 +354,7 @@ class CakeSchema extends CakeObject {
$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}?>";
$content = $File->prepare($content); $content = $File->prepare($content);

View file

@ -241,7 +241,7 @@ if (!function_exists('mb_encode_mimeheader')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Multibyte extends CakeObject { class Multibyte extends Object {
/** /**
* Holds the case folding values * Holds the case folding values
* *
@ -274,7 +274,7 @@ class Multibyte extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Multibyte(); $instance[0] =& new Multibyte();
} }
return $instance[0]; return $instance[0];
} }

View file

@ -34,7 +34,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class CakeObject { class Object {
/** /**
* Log object * Log object
* *
@ -295,7 +295,4 @@ class CakeObject {
} }
} }
} }
// Note: In PHP 7+, 'Object' is a reserved class name
// All classes that extend Object should now extend CakeObject instead
?> ?>

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Overloadable extends CakeObject { class Overloadable extends Object {
/** /**
* Constructor. * Constructor.
* *
@ -88,7 +88,7 @@ Overloadable::overload('Overloadable');
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Overloadable2 extends CakeObject { class Overloadable2 extends Object {
/** /**
* Constructor * Constructor
* *

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Overloadable extends CakeObject { class Overloadable extends Object {
/** /**
* Overload implementation. No need for implementation in PHP5. * Overload implementation. No need for implementation in PHP5.
* *
@ -60,7 +60,7 @@ class Overloadable extends CakeObject {
* *
* @package cake * @package cake
*/ */
class Overloadable2 extends CakeObject { class Overloadable2 extends Object {
/** /**
* Overload implementation. No need for implementation in PHP5. * Overload implementation. No need for implementation in PHP5.
* *

View file

@ -37,7 +37,7 @@ if (!class_exists('Object')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Router extends CakeObject { class Router extends Object {
/** /**
* Array of routes * Array of routes
* *
@ -170,7 +170,7 @@ class Router extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Router(); $instance[0] =& new Router();
$instance[0]->__admin = Configure::read('Routing.admin'); $instance[0]->__admin = Configure::read('Routing.admin');
} }
return $instance[0]; return $instance[0];

View file

@ -32,7 +32,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Security extends CakeObject { class Security extends Object {
/** /**
* Default hash method * Default hash method
* *
@ -50,7 +50,7 @@ class Security extends CakeObject {
function &getInstance() { function &getInstance() {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Security; $instance[0] =& new Security;
} }
return $instance[0]; return $instance[0];
} }

View file

@ -46,7 +46,7 @@ if (!class_exists('Security')) {
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class CakeSession extends CakeObject { class CakeSession extends Object {
/** /**
* True if the Session is still valid * True if the Session is still valid
* *

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class Set extends CakeObject { class Set extends Object {
/** /**
* Deprecated * Deprecated
* *

View file

@ -31,7 +31,7 @@ App::import('Core', 'Validation');
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class CakeSocket extends CakeObject { class CakeSocket extends Object {
/** /**
* Object description * Object description
* *

View file

@ -30,7 +30,7 @@
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
*/ */
class String extends CakeObject { class String extends Object {
/** /**
* Gets a reference to the String object instance * Gets a reference to the String object instance
* *
@ -42,7 +42,7 @@ class String extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new String(); $instance[0] =& new String();
} }
return $instance[0]; return $instance[0];
} }

View file

@ -52,7 +52,7 @@
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @since CakePHP v 1.2.0.3830 * @since CakePHP v 1.2.0.3830
*/ */
class Validation extends CakeObject { class Validation extends Object {
/** /**
* Set the the value of methods $check param. * Set the the value of methods $check param.
* *
@ -119,7 +119,7 @@ class Validation extends CakeObject {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new Validation(); $instance[0] =& new Validation();
} }
return $instance[0]; return $instance[0];
} }

View file

@ -252,7 +252,7 @@ class CacheHelper extends AppHelper {
'; ';
} }
$file .= '$controller = new ' . $this->controllerName . 'Controller(); $file .= '$controller =& new ' . $this->controllerName . 'Controller();
$controller->plugin = $this->plugin = \''.$this->plugin.'\'; $controller->plugin = $this->plugin = \''.$this->plugin.'\';
$controller->helpers = $this->helpers = unserialize(\'' . serialize($this->helpers) . '\'); $controller->helpers = $this->helpers = unserialize(\'' . serialize($this->helpers) . '\');
$controller->base = $this->base = \'' . $this->base . '\'; $controller->base = $this->base = \'' . $this->base . '\';

View file

@ -136,7 +136,7 @@ class JsHelper extends Overloadable2 {
} }
$func .= "'" . Router::url($url) . "'"; $func .= "'" . Router::url($url) . "'";
$ajax = new AjaxHelper(); $ajax =& new AjaxHelper();
$func .= ", " . $ajax->__optionsForAjax($options) . ")"; $func .= ", " . $ajax->__optionsForAjax($options) . ")";
if (isset($options['before'])) { if (isset($options['before'])) {

View file

@ -46,7 +46,7 @@ class XmlHelper extends AppHelper {
*/ */
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
$this->Xml = new Xml(); $this->Xml =& new Xml();
$this->Xml->options(array('verifyNs' => false)); $this->Xml->options(array('verifyNs' => false));
} }
/** /**
@ -155,7 +155,7 @@ class XmlHelper extends AppHelper {
*/ */
function serialize($data, $options = array()) { function serialize($data, $options = array()) {
$options += array('attributes' => false, 'format' => 'attributes'); $options += array('attributes' => false, 'format' => 'attributes');
$data = new Xml($data, $options); $data =& new Xml($data, $options);
return $data->toString($options + array('header' => false)); return $data->toString($options + array('header' => false));
} }
} }

View file

@ -34,7 +34,7 @@ App::import('Core', array('Helper', 'ClassRegistry'));
* @package cake * @package cake
* @subpackage cake.cake.libs.view * @subpackage cake.cake.libs.view
*/ */
class View extends CakeObject { class View extends Object {
/** /**
* Path parts for creating links in views. * Path parts for creating links in views.
* *
@ -745,7 +745,7 @@ class View extends CakeObject {
return false; return false;
} }
} }
$loaded[$helper] = new $helperCn($options); $loaded[$helper] =& new $helperCn($options);
$vars = array( $vars = array(
'base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin' 'base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin'
); );

View file

@ -34,7 +34,7 @@ App::import('Core', 'Set');
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @since CakePHP v .0.10.3.1400 * @since CakePHP v .0.10.3.1400
*/ */
class XmlNode extends CakeObject { class XmlNode extends Object {
/** /**
* Name of node * Name of node
* *
@ -147,7 +147,7 @@ class XmlNode extends CakeObject {
* @return object XmlNode * @return object XmlNode
*/ */
function &createNode($name = null, $value = null, $namespace = false) { function &createNode($name = null, $value = null, $namespace = false) {
$node = new XmlNode($name, $value, $namespace); $node =& new XmlNode($name, $value, $namespace);
$node->setParent($this); $node->setParent($this);
return $node; return $node;
} }
@ -161,7 +161,7 @@ class XmlNode extends CakeObject {
* @return object XmlElement * @return object XmlElement
*/ */
function &createElement($name = null, $value = null, $attributes = array(), $namespace = false) { function &createElement($name = null, $value = null, $attributes = array(), $namespace = false) {
$element = new XmlElement($name, $value, $attributes, $namespace); $element =& new XmlElement($name, $value, $attributes, $namespace);
$element->setParent($this); $element->setParent($this);
return $element; return $element;
} }
@ -1398,7 +1398,7 @@ class XmlManager {
static $instance = array(); static $instance = array();
if (!$instance) { if (!$instance) {
$instance[0] = new XmlManager(); $instance[0] =& new XmlManager();
} }
return $instance[0]; return $instance[0];
} }

View file

@ -151,7 +151,7 @@ class ShellDispatcherTest extends UnitTestCase {
* @return void * @return void
*/ */
function testParseParams() { function testParseParams() {
$Dispatcher = new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
$params = array( $params = array(
'/cake/1.2.x.x/cake/console/cake.php', '/cake/1.2.x.x/cake/console/cake.php',
@ -423,7 +423,7 @@ class ShellDispatcherTest extends UnitTestCase {
* @return void * @return void
*/ */
function testBuildPaths() { function testBuildPaths() {
$Dispatcher = new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
$result = $Dispatcher->shellPaths; $result = $Dispatcher->shellPaths;
$expected = array( $expected = array(
@ -444,13 +444,13 @@ class ShellDispatcherTest extends UnitTestCase {
* @return void * @return void
*/ */
function testDispatch() { function testDispatch() {
$Dispatcher = new TestShellDispatcher(array('sample')); $Dispatcher =& new TestShellDispatcher(array('sample'));
$this->assertPattern('/This is the main method called from SampleShell/', $Dispatcher->stdout); $this->assertPattern('/This is the main method called from SampleShell/', $Dispatcher->stdout);
$Dispatcher = new TestShellDispatcher(array('test_plugin_two.example')); $Dispatcher =& new TestShellDispatcher(array('test_plugin_two.example'));
$this->assertPattern('/This is the main method called from TestPluginTwo.ExampleShell/', $Dispatcher->stdout); $this->assertPattern('/This is the main method called from TestPluginTwo.ExampleShell/', $Dispatcher->stdout);
$Dispatcher = new TestShellDispatcher(array('test_plugin_two.welcome', 'say_hello')); $Dispatcher =& new TestShellDispatcher(array('test_plugin_two.welcome', 'say_hello'));
$this->assertPattern('/This is the say_hello method called from TestPluginTwo.WelcomeShell/', $Dispatcher->stdout); $this->assertPattern('/This is the say_hello method called from TestPluginTwo.WelcomeShell/', $Dispatcher->stdout);
} }
/** /**
@ -460,7 +460,7 @@ class ShellDispatcherTest extends UnitTestCase {
* @return void * @return void
*/ */
function testHelpCommand() { function testHelpCommand() {
$Dispatcher = new TestShellDispatcher(); $Dispatcher =& new TestShellDispatcher();
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:"; $expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t example"; $expected .= "\n\t example";

View file

@ -84,8 +84,8 @@ class AclShellTest extends CakeTestCase {
* @access public * @access public
*/ */
function startTest() { function startTest() {
$this->Dispatcher = new TestAclShellMockShellDispatcher(); $this->Dispatcher =& new TestAclShellMockShellDispatcher();
$this->Task = new MockAclShell($this->Dispatcher); $this->Task =& new MockAclShell($this->Dispatcher);
$this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch =& $this->Dispatcher;
$this->Task->params['datasource'] = 'test_suite'; $this->Task->params['datasource'] = 'test_suite';
} }

View file

@ -62,8 +62,8 @@ class ApiShellTest extends CakeTestCase {
* @access public * @access public
*/ */
function startTest() { function startTest() {
$this->Dispatcher = new ApiShellMockShellDispatcher(); $this->Dispatcher =& new ApiShellMockShellDispatcher();
$this->Shell = new MockApiShell($this->Dispatcher); $this->Shell =& new MockApiShell($this->Dispatcher);
$this->Shell->Dispatch =& $this->Dispatcher; $this->Shell->Dispatch =& $this->Dispatcher;
} }
/** /**

View file

@ -124,8 +124,8 @@ class SchemaShellTest extends CakeTestCase {
* @access public * @access public
*/ */
function startTest() { function startTest() {
$this->Dispatcher = new TestSchemaShellMockShellDispatcher(); $this->Dispatcher =& new TestSchemaShellMockShellDispatcher();
$this->Shell = new MockSchemaShell($this->Dispatcher); $this->Shell =& new MockSchemaShell($this->Dispatcher);
$this->Shell->Dispatch =& $this->Dispatcher; $this->Shell->Dispatch =& $this->Dispatcher;
} }
@ -193,9 +193,9 @@ class SchemaShellTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testDumpWithFileWriting() { function testDumpWithFileWriting() {
$file = new File(APP . 'config' . DS . 'sql' . DS . 'i18n.php'); $file =& new File(APP . 'config' . DS . 'sql' . DS . 'i18n.php');
$contents = $file->read(); $contents = $file->read();
$file = new File(TMP . 'tests' . DS . 'i18n.php'); $file =& new File(TMP . 'tests' . DS . 'i18n.php');
$file->write($contents); $file->write($contents);
$this->Shell->params = array('name' => 'i18n'); $this->Shell->params = array('name' => 'i18n');
@ -204,7 +204,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->Schema->path = TMP . 'tests'; $this->Shell->Schema->path = TMP . 'tests';
$this->Shell->dump(); $this->Shell->dump();
$sql = new File(TMP . 'tests' . DS . 'i18n.sql'); $sql =& new File(TMP . 'tests' . DS . 'i18n.sql');
$contents = $sql->read(); $contents = $sql->read();
$this->assertPattern('/DROP TABLE/', $contents); $this->assertPattern('/DROP TABLE/', $contents);
$this->assertPattern('/CREATE TABLE `i18n`/', $contents); $this->assertPattern('/CREATE TABLE `i18n`/', $contents);
@ -228,7 +228,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->path = TMP; $this->Shell->path = TMP;
$this->Shell->params['file'] = 'schema.php'; $this->Shell->params['file'] = 'schema.php';
$this->Shell->args = array('snapshot'); $this->Shell->args = array('snapshot');
$this->Shell->Schema = new MockSchemaCakeSchema(); $this->Shell->Schema =& new MockSchemaCakeSchema();
$this->Shell->Schema->setReturnValue('read', array('schema data')); $this->Shell->Schema->setReturnValue('read', array('schema data'));
$this->Shell->Schema->setReturnValue('write', true); $this->Shell->Schema->setReturnValue('write', true);
@ -249,7 +249,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->args = array(); $this->Shell->args = array();
$this->Shell->setReturnValue('in', 'q'); $this->Shell->setReturnValue('in', 'q');
$this->Shell->Schema = new MockSchemaCakeSchema(); $this->Shell->Schema =& new MockSchemaCakeSchema();
$this->Shell->Schema->path = TMP; $this->Shell->Schema->path = TMP;
$this->Shell->Schema->expectNever('read'); $this->Shell->Schema->expectNever('read');
@ -269,7 +269,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->setReturnValue('in', 'o'); $this->Shell->setReturnValue('in', 'o');
$this->Shell->expectAt(1, 'out', array(new PatternExpectation('/Schema file:\s[a-z\.]+\sgenerated/'))); $this->Shell->expectAt(1, 'out', array(new PatternExpectation('/Schema file:\s[a-z\.]+\sgenerated/')));
$this->Shell->Schema = new MockSchemaCakeSchema(); $this->Shell->Schema =& new MockSchemaCakeSchema();
$this->Shell->Schema->path = TMP; $this->Shell->Schema->path = TMP;
$this->Shell->Schema->setReturnValue('read', array('schema data')); $this->Shell->Schema->setReturnValue('read', array('schema data'));
$this->Shell->Schema->setReturnValue('write', true); $this->Shell->Schema->setReturnValue('write', true);
@ -341,7 +341,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->setReturnValue('in', 'y'); $this->Shell->setReturnValue('in', 'y');
$this->Shell->run(); $this->Shell->run();
$article = new Model(array('name' => 'Article', 'ds' => 'test_suite')); $article =& new Model(array('name' => 'Article', 'ds' => 'test_suite'));
$fields = $article->schema(); $fields = $article->schema();
$this->assertTrue(isset($fields['summary'])); $this->assertTrue(isset($fields['summary']));

View file

@ -95,8 +95,8 @@ class ShellTest extends CakeTestCase {
* @access public * @access public
*/ */
function setUp() { function setUp() {
$this->Dispatcher = new TestShellMockShellDispatcher(); $this->Dispatcher =& new TestShellMockShellDispatcher();
$this->Shell = new TestShell($this->Dispatcher); $this->Shell =& new TestShell($this->Dispatcher);
} }
/** /**
* tearDown method * tearDown method

View file

@ -59,8 +59,8 @@ class ExtractTaskTest extends CakeTestCase {
* @access public * @access public
*/ */
function setUp() { function setUp() {
$this->Dispatcher = new TestExtractTaskMockShellDispatcher(); $this->Dispatcher =& new TestExtractTaskMockShellDispatcher();
$this->Task = new ExtractTask($this->Dispatcher); $this->Task =& new ExtractTask($this->Dispatcher);
} }
/** /**
* tearDown method * tearDown method

View file

@ -63,8 +63,8 @@ class TestTaskTest extends CakeTestCase {
* @access public * @access public
*/ */
function setUp() { function setUp() {
$this->Dispatcher = new TestTestTaskMockShellDispatcher(); $this->Dispatcher =& new TestTestTaskMockShellDispatcher();
$this->Task = new MockTestTask($this->Dispatcher); $this->Task =& new MockTestTask($this->Dispatcher);
$this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch =& $this->Dispatcher;
} }
/** /**

View file

@ -544,7 +544,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testParseParamsWithoutZerosAndEmptyPost() { function testParseParamsWithoutZerosAndEmptyPost() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3"); $test = $Dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3");
$this->assertIdentical($test['controller'], 'testcontroller'); $this->assertIdentical($test['controller'], 'testcontroller');
$this->assertIdentical($test['action'], 'testaction'); $this->assertIdentical($test['action'], 'testaction');
@ -561,7 +561,7 @@ class DispatcherTest extends CakeTestCase {
*/ */
function testParseParamsReturnsPostedData() { function testParseParamsReturnsPostedData() {
$_POST['testdata'] = "My Posted Content"; $_POST['testdata'] = "My Posted Content";
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/"); $test = $Dispatcher->parseParams("/");
$this->assertTrue($test['form'], "Parsed URL not returning post data"); $this->assertTrue($test['form'], "Parsed URL not returning post data");
$this->assertIdentical($test['form']['testdata'], "My Posted Content"); $this->assertIdentical($test['form']['testdata'], "My Posted Content");
@ -573,7 +573,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testParseParamsWithSingleZero() { function testParseParamsWithSingleZero() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/testcontroller/testaction/1/0/23"); $test = $Dispatcher->parseParams("/testcontroller/testaction/1/0/23");
$this->assertIdentical($test['controller'], 'testcontroller'); $this->assertIdentical($test['controller'], 'testcontroller');
$this->assertIdentical($test['action'], 'testaction'); $this->assertIdentical($test['action'], 'testaction');
@ -588,7 +588,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testParseParamsWithManySingleZeros() { function testParseParamsWithManySingleZeros() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/testcontroller/testaction/0/0/0/0/0/0"); $test = $Dispatcher->parseParams("/testcontroller/testaction/0/0/0/0/0/0");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0]); $this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0]);
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1]); $this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1]);
@ -604,7 +604,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testParseParamsWithManyZerosInEachSectionOfUrl() { function testParseParamsWithManyZerosInEachSectionOfUrl() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000"); $test = $Dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000");
$this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0]); $this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0]);
$this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1]); $this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1]);
@ -620,7 +620,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() { function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$test = $Dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400"); $test = $Dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400");
$this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0]); $this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0]);
$this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1]); $this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1]);
@ -641,7 +641,7 @@ class DispatcherTest extends CakeTestCase {
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
$_GET = array('coffee' => 'life', 'sleep' => 'sissies'); $_GET = array('coffee' => 'life', 'sleep' => 'sissies');
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$uri = 'posts/home/?coffee=life&sleep=sissies'; $uri = 'posts/home/?coffee=life&sleep=sissies';
$result = $Dispatcher->parseParams($uri); $result = $Dispatcher->parseParams($uri);
$this->assertPattern('/posts/', $result['controller']); $this->assertPattern('/posts/', $result['controller']);
@ -649,7 +649,7 @@ class DispatcherTest extends CakeTestCase {
$this->assertTrue(isset($result['url']['sleep'])); $this->assertTrue(isset($result['url']['sleep']));
$this->assertTrue(isset($result['url']['coffee'])); $this->assertTrue(isset($result['url']['coffee']));
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$uri = '/?coffee=life&sleep=sissy'; $uri = '/?coffee=life&sleep=sissy';
$result = $Dispatcher->parseParams($uri); $result = $Dispatcher->parseParams($uri);
$this->assertPattern('/pages/', $result['controller']); $this->assertPattern('/pages/', $result['controller']);
@ -712,7 +712,7 @@ class DispatcherTest extends CakeTestCase {
), ),
)); ));
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$result = $Dispatcher->parseParams('/'); $result = $Dispatcher->parseParams('/');
$expected = array( $expected = array(
@ -830,7 +830,7 @@ class DispatcherTest extends CakeTestCase {
) )
) )
); );
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$result = $Dispatcher->parseParams('/'); $result = $Dispatcher->parseParams('/');
$expected = array( $expected = array(
'Document' => array( 'Document' => array(
@ -895,7 +895,7 @@ class DispatcherTest extends CakeTestCase {
) )
); );
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$result = $Dispatcher->parseParams('/'); $result = $Dispatcher->parseParams('/');
$expected = array( $expected = array(
@ -917,7 +917,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGetUrl() { function testGetUrl() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->base = '/app/webroot/index.php'; $Dispatcher->base = '/app/webroot/index.php';
$uri = '/app/webroot/index.php/posts/add'; $uri = '/app/webroot/index.php/posts/add';
$result = $Dispatcher->getUrl($uri); $result = $Dispatcher->getUrl($uri);
@ -933,7 +933,7 @@ class DispatcherTest extends CakeTestCase {
$_GET['url'] = array(); $_GET['url'] = array();
Configure::write('App.base', '/control'); Configure::write('App.base', '/control');
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->baseUrl(); $Dispatcher->baseUrl();
$uri = '/control/students/browse'; $uri = '/control/students/browse';
$result = $Dispatcher->getUrl($uri); $result = $Dispatcher->getUrl($uri);
@ -941,7 +941,7 @@ class DispatcherTest extends CakeTestCase {
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
$_GET['url'] = array(); $_GET['url'] = array();
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->base = ''; $Dispatcher->base = '';
$uri = '/?/home'; $uri = '/?/home';
$result = $Dispatcher->getUrl($uri); $result = $Dispatcher->getUrl($uri);
@ -956,7 +956,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testBaseUrlAndWebrootWithModRewrite() { function testBaseUrlAndWebrootWithModRewrite() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches'; $_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
@ -1037,7 +1037,7 @@ class DispatcherTest extends CakeTestCase {
Configure::write('App.base', '/control'); Configure::write('App.base', '/control');
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$result = $Dispatcher->baseUrl(); $result = $Dispatcher->baseUrl();
$expected = '/control'; $expected = '/control';
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
@ -1051,7 +1051,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html';
$_SERVER['SCRIPT_FILENAME'] = '/var/www/abtravaff/html/newaffiliate/index.php'; $_SERVER['SCRIPT_FILENAME'] = '/var/www/abtravaff/html/newaffiliate/index.php';
$_SERVER['PHP_SELF'] = '/newaffiliate/index.php'; $_SERVER['PHP_SELF'] = '/newaffiliate/index.php';
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$result = $Dispatcher->baseUrl(); $result = $Dispatcher->baseUrl();
$expected = '/newaffiliate'; $expected = '/newaffiliate';
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
@ -1065,7 +1065,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testBaseUrlAndWebrootWithBaseUrl() { function testBaseUrlAndWebrootWithBaseUrl() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
Configure::write('App.dir', 'app'); Configure::write('App.dir', 'app');
@ -1134,7 +1134,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testBaseUrlAndWebrootWithBase() { function testBaseUrlAndWebrootWithBase() {
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->base = '/app'; $Dispatcher->base = '/app';
$result = $Dispatcher->baseUrl(); $result = $Dispatcher->baseUrl();
$expected = '/app'; $expected = '/app';
@ -1164,7 +1164,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testMissingController() { function testMissingController() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'some_controller/home/param:value/param2:value2'; $url = 'some_controller/home/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
@ -1183,7 +1183,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPrivate() { function testPrivate() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'some_pages/_protected/param:value/param2:value2'; $url = 'some_pages/_protected/param:value/param2:value2';
@ -1205,7 +1205,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testMissingAction() { function testMissingAction() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'some_pages/home/param:value/param2:value2'; $url = 'some_pages/home/param:value/param2:value2';
@ -1220,7 +1220,7 @@ class DispatcherTest extends CakeTestCase {
))); )));
$this->assertEqual($expected, $controller); $this->assertEqual($expected, $controller);
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'some_pages/redirect/param:value/param2:value2'; $url = 'some_pages/redirect/param:value/param2:value2';
@ -1242,7 +1242,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDispatch() { function testDispatch() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'pages/home/param:value/param2:value2'; $url = 'pages/home/param:value/param2:value2';
@ -1269,7 +1269,7 @@ class DispatcherTest extends CakeTestCase {
unset($Dispatcher); unset($Dispatcher);
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/timesheets/index.php'); Configure::write('App.baseUrl','/timesheets/index.php');
$url = 'timesheets'; $url = 'timesheets';
@ -1296,7 +1296,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDispatchWithArray() { function testDispatchWithArray() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('App.baseUrl','/index.php'); Configure::write('App.baseUrl','/index.php');
$url = 'pages/home/param:value/param2:value2'; $url = 'pages/home/param:value/param2:value2';
@ -1316,7 +1316,7 @@ class DispatcherTest extends CakeTestCase {
*/ */
function testAdminDispatch() { function testAdminDispatch() {
$_POST = array(); $_POST = array();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php'); Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php');
$url = 'admin/test_dispatch_pages/index/param:value/param2:value2'; $url = 'admin/test_dispatch_pages/index/param:value/param2:value2';
@ -1349,7 +1349,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Router::connect('/my_plugin/:controller/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display')); Router::connect('/my_plugin/:controller/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display'));
$Dispatcher->base = false; $Dispatcher->base = false;
@ -1397,7 +1397,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display')); Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display'));
$Dispatcher->base = false; $Dispatcher->base = false;
@ -1434,7 +1434,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/add/param:value/param2:value2'; $url = 'my_plugin/add/param:value/param2:value2';
@ -1455,7 +1455,7 @@ class DispatcherTest extends CakeTestCase {
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
/* Simulates the Route for a real plugin, installed in APP/plugins */ /* Simulates the Route for a real plugin, installed in APP/plugins */
@ -1483,7 +1483,7 @@ class DispatcherTest extends CakeTestCase {
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'admin/my_plugin/add/5/param:value/param2:value2'; $url = 'admin/my_plugin/add/5/param:value/param2:value2';
@ -1503,7 +1503,7 @@ class DispatcherTest extends CakeTestCase {
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$controller = $Dispatcher->dispatch('admin/articles_test', array('return' => 1)); $controller = $Dispatcher->dispatch('admin/articles_test', array('return' => 1));
@ -1536,21 +1536,21 @@ class DispatcherTest extends CakeTestCase {
Router::reload(); Router::reload();
Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin')); Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin'));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/my_plugin/add'; $url = 'my_plugin/my_plugin/add';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertFalse(isset($controller->params['pass'][0])); $this->assertFalse(isset($controller->params['pass'][0]));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/my_plugin/add/0'; $url = 'my_plugin/my_plugin/add/0';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertTrue(isset($controller->params['pass'][0])); $this->assertTrue(isset($controller->params['pass'][0]));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/add'; $url = 'my_plugin/add';
@ -1558,14 +1558,14 @@ class DispatcherTest extends CakeTestCase {
$this->assertFalse(isset($controller->params['pass'][0])); $this->assertFalse(isset($controller->params['pass'][0]));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/add/0'; $url = 'my_plugin/add/0';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertIdentical('0',$controller->params['pass'][0]); $this->assertIdentical('0',$controller->params['pass'][0]);
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/add/1'; $url = 'my_plugin/add/1';
@ -1583,7 +1583,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/not_here/param:value/param2:value2'; $url = 'my_plugin/not_here/param:value/param2:value2';
@ -1599,7 +1599,7 @@ class DispatcherTest extends CakeTestCase {
$this->assertIdentical($expected, $controller); $this->assertIdentical($expected, $controller);
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'my_plugin/param:value/param2:value2'; $url = 'my_plugin/param:value/param2:value2';
@ -1627,7 +1627,7 @@ class DispatcherTest extends CakeTestCase {
Router::reload(); Router::reload();
Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'), array('controller', 'action')); Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'), array('controller', 'action'));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
$url = 'test_dispatch_pages/admin_index/param:value/param2:value2'; $url = 'test_dispatch_pages/admin_index/param:value/param2:value2';
@ -1648,7 +1648,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testTestPluginDispatch() { function testTestPluginDispatch() {
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$_back = Configure::read('pluginPaths'); $_back = Configure::read('pluginPaths');
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
$url = '/test_plugin/tests/index'; $url = '/test_plugin/tests/index';
@ -1668,7 +1668,7 @@ class DispatcherTest extends CakeTestCase {
*/ */
function testChangingParamsFromBeforeFilter() { function testChangingParamsFromBeforeFilter() {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$url = 'some_posts/index/param:value/param2:value2'; $url = 'some_posts/index/param:value/param2:value2';
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
@ -1707,7 +1707,7 @@ class DispatcherTest extends CakeTestCase {
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
Configure::write('vendorPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors'. DS)); Configure::write('vendorPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors'. DS));
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Configure::write('debug', 0); Configure::write('debug', 0);
ob_start(); ob_start();
@ -1777,7 +1777,7 @@ class DispatcherTest extends CakeTestCase {
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)); Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
$dispatcher = new Dispatcher(); $dispatcher =& new Dispatcher();
$dispatcher->base = false; $dispatcher->base = false;
$url = '/'; $url = '/';
@ -1902,7 +1902,7 @@ class DispatcherTest extends CakeTestCase {
Router::mapResources('Posts'); Router::mapResources('Posts');
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$dispatcher = new Dispatcher(); $dispatcher =& new Dispatcher();
$dispatcher->base = false; $dispatcher->base = false;
$result = $dispatcher->parseParams('/posts'); $result = $dispatcher->parseParams('/posts');
@ -1956,7 +1956,7 @@ class DispatcherTest extends CakeTestCase {
"/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E" "/index.php/%22%3E%3Ch1%20onclick=%22alert('xss');%22%3Eheya%3C/h1%3E"
); );
$dispatcher = new Dispatcher(); $dispatcher =& new Dispatcher();
$result = $dispatcher->baseUrl(); $result = $dispatcher->baseUrl();
$expected = '/index.php/h1 onclick=alert(xss);heya'; $expected = '/index.php/h1 onclick=alert(xss);heya';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
@ -1968,7 +1968,7 @@ class DispatcherTest extends CakeTestCase {
* @return void * @return void
*/ */
function testEnvironmentDetection() { function testEnvironmentDetection() {
$dispatcher = new Dispatcher(); $dispatcher =& new Dispatcher();
$environments = array( $environments = array(
'IIS' => array( 'IIS' => array(
@ -2077,7 +2077,7 @@ class DispatcherTest extends CakeTestCase {
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
Router::reload(); Router::reload();
$Dispatcher = new TestDispatcher(); $Dispatcher =& new TestDispatcher();
Router::connect('/myalias/:action/*', array('controller' => 'my_controller', 'action' => null)); Router::connect('/myalias/:action/*', array('controller' => 'my_controller', 'action' => null));
$Dispatcher->base = false; $Dispatcher->base = false;

View file

@ -78,8 +78,8 @@ class CakeTestCaseTest extends CakeTestCase {
* @return void * @return void
*/ */
function setUp() { function setUp() {
$this->Case = new SubjectCakeTestCase(); $this->Case =& new SubjectCakeTestCase();
$reporter = new MockCakeHtmlReporter(); $reporter =& new MockCakeHtmlReporter();
$this->Case->setReporter($reporter); $this->Case->setReporter($reporter);
$this->Reporter = $reporter; $this->Reporter = $reporter;
} }
@ -265,7 +265,7 @@ class CakeTestCaseTest extends CakeTestCase {
$this->assertEqual($result, array('var' => 'string')); $this->assertEqual($result, array('var' => 'string'));
$db =& ConnectionManager::getDataSource('test_suite'); $db =& ConnectionManager::getDataSource('test_suite');
$fixture = new PostFixture(); $fixture =& new PostFixture();
$fixture->create($db); $fixture->create($db);
$result = $this->Case->testAction('/tests_apps_posts/add', array('return' => 'vars')); $result = $this->Case->testAction('/tests_apps_posts/add', array('return' => 'vars'));
@ -321,7 +321,7 @@ class CakeTestCaseTest extends CakeTestCase {
ConnectionManager::create('cake_test_case', $config); ConnectionManager::create('cake_test_case', $config);
$db2 =& ConnectionManager::getDataSource('cake_test_case'); $db2 =& ConnectionManager::getDataSource('cake_test_case');
$fixture = new PostFixture($db2); $fixture =& new PostFixture($db2);
$fixture->create($db2); $fixture->create($db2);
$fixture->insert($db2); $fixture->insert($db2);
@ -349,7 +349,7 @@ class CakeTestCaseTest extends CakeTestCase {
ConnectionManager::create('cake_test_case', $config); ConnectionManager::create('cake_test_case', $config);
$db =& ConnectionManager::getDataSource('cake_test_case'); $db =& ConnectionManager::getDataSource('cake_test_case');
$fixture = new PostFixture($db); $fixture =& new PostFixture($db);
$fixture->create($db); $fixture->create($db);
$fixture->insert($db); $fixture->insert($db);
@ -399,8 +399,8 @@ class CakeTestCaseTest extends CakeTestCase {
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS)); Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS));
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
$Dispatcher = new CakeTestDispatcher(); $Dispatcher =& new CakeTestDispatcher();
$Case = new CakeDispatcherMockTestCase(); $Case =& new CakeDispatcherMockTestCase();
$Case->expectOnce('startController'); $Case->expectOnce('startController');
$Case->expectOnce('endController'); $Case->expectOnce('endController');

View file

@ -125,7 +125,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function setUp() { function setUp() {
$this->criticDb = new FixtureMockDboSource(); $this->criticDb =& new FixtureMockDboSource();
$this->criticDb->fullDebug = true; $this->criticDb->fullDebug = true;
} }
/** /**
@ -144,23 +144,23 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function testInit() { function testInit() {
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
unset($Fixture->table); unset($Fixture->table);
$Fixture->init(); $Fixture->init();
$this->assertEqual($Fixture->table, 'fixture_tests'); $this->assertEqual($Fixture->table, 'fixture_tests');
$this->assertEqual($Fixture->primaryKey, 'id'); $this->assertEqual($Fixture->primaryKey, 'id');
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
$Fixture->primaryKey = 'my_random_key'; $Fixture->primaryKey = 'my_random_key';
$Fixture->init(); $Fixture->init();
$this->assertEqual($Fixture->primaryKey, 'my_random_key'); $this->assertEqual($Fixture->primaryKey, 'my_random_key');
$this->_initDb(); $this->_initDb();
$Source = new CakeTestFixtureTestFixture(); $Source =& new CakeTestFixtureTestFixture();
$Source->create($this->db); $Source->create($this->db);
$Source->insert($this->db); $Source->insert($this->db);
$Fixture = new CakeTestFixtureImportFixture(); $Fixture =& new CakeTestFixtureImportFixture();
$expected = array('id', 'name', 'created'); $expected = array('id', 'name', 'created');
$this->assertEqual(array_keys($Fixture->fields), $expected); $this->assertEqual(array_keys($Fixture->fields), $expected);
@ -174,7 +174,7 @@ class CakeTestFixtureTest extends CakeTestCase {
$Fixture->init(); $Fixture->init();
$this->assertEqual(count($Fixture->records), count($Source->records)); $this->assertEqual(count($Fixture->records), count($Source->records));
$Fixture = new CakeTestFixtureImportFixture(); $Fixture =& new CakeTestFixtureImportFixture();
$Fixture->fields = $Fixture->records = null; $Fixture->fields = $Fixture->records = null;
$Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'test_suite'); $Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'test_suite');
$Fixture->init(); $Fixture->init();
@ -201,13 +201,13 @@ class CakeTestFixtureTest extends CakeTestCase {
ConnectionManager::create('new_test_suite', array_merge($testSuiteConfig, array('prefix' => 'new_' . $testSuiteConfig['prefix']))); ConnectionManager::create('new_test_suite', array_merge($testSuiteConfig, array('prefix' => 'new_' . $testSuiteConfig['prefix'])));
$newTestSuiteDb =& ConnectionManager::getDataSource('new_test_suite'); $newTestSuiteDb =& ConnectionManager::getDataSource('new_test_suite');
$Source = new CakeTestFixtureTestFixture(); $Source =& new CakeTestFixtureTestFixture();
$Source->create($newTestSuiteDb); $Source->create($newTestSuiteDb);
$Source->insert($newTestSuiteDb); $Source->insert($newTestSuiteDb);
$defaultDb->config = $newTestSuiteDb->config; $defaultDb->config = $newTestSuiteDb->config;
$Fixture = new CakeTestFixtureDefaultImportFixture(); $Fixture =& new CakeTestFixtureDefaultImportFixture();
$Fixture->fields = $Fixture->records = null; $Fixture->fields = $Fixture->records = null;
$Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'new_test_suite'); $Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'new_test_suite');
$Fixture->init(); $Fixture->init();
@ -227,7 +227,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function testCreate() { function testCreate() {
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->expectAtLeastOnce('execute'); $this->criticDb->expectAtLeastOnce('execute');
$this->criticDb->expectAtLeastOnce('createSchema'); $this->criticDb->expectAtLeastOnce('createSchema');
$return = $Fixture->create($this->criticDb); $return = $Fixture->create($this->criticDb);
@ -245,7 +245,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function testInsert() { function testInsert() {
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->setReturnValue('insertMulti', true); $this->criticDb->setReturnValue('insertMulti', true);
$this->criticDb->expectAtLeastOnce('insertMulti'); $this->criticDb->expectAtLeastOnce('insertMulti');
@ -260,7 +260,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDrop() { function testDrop() {
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->setReturnValueAt(0, 'execute', true); $this->criticDb->setReturnValueAt(0, 'execute', true);
$this->criticDb->expectAtLeastOnce('execute'); $this->criticDb->expectAtLeastOnce('execute');
$this->criticDb->expectAtLeastOnce('dropSchema'); $this->criticDb->expectAtLeastOnce('dropSchema');
@ -280,7 +280,7 @@ class CakeTestFixtureTest extends CakeTestCase {
* @return void * @return void
*/ */
function testTruncate() { function testTruncate() {
$Fixture = new CakeTestFixtureTestFixture(); $Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->expectAtLeastOnce('truncate'); $this->criticDb->expectAtLeastOnce('truncate');
$Fixture->truncate($this->criticDb); $Fixture->truncate($this->criticDb);
$this->assertTrue($this->criticDb->fullDebug); $this->assertTrue($this->criticDb->fullDebug);

View file

@ -158,7 +158,7 @@ class CodeCoverageManagerTest extends CakeTestCase {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class Set extends CakeObject { class Set extends Object {
/** /**
* Value of the Set object. * Value of the Set object.
* *
@ -315,7 +315,7 @@ PHP;
* @package cake * @package cake
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class Set extends CakeObject { class Set extends Object {
/** /**
* Value of the Set object. * Value of the Set object.
* *

View file

@ -72,7 +72,7 @@ if (!class_exists('AppController')) {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class ParamTestComponent extends CakeObject { class ParamTestComponent extends Object {
/** /**
* name property * name property
* *
@ -133,7 +133,7 @@ class ComponentTestController extends AppController {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class AppleComponent extends CakeObject { class AppleComponent extends Object {
/** /**
* components property * components property
* *
@ -165,7 +165,7 @@ class AppleComponent extends CakeObject {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class OrangeComponent extends CakeObject { class OrangeComponent extends Object {
/** /**
* components property * components property
* *
@ -202,7 +202,7 @@ class OrangeComponent extends CakeObject {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class BananaComponent extends CakeObject { class BananaComponent extends Object {
/** /**
* testField property * testField property
* *
@ -227,7 +227,7 @@ class BananaComponent extends CakeObject {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class MutuallyReferencingOneComponent extends CakeObject { class MutuallyReferencingOneComponent extends Object {
/** /**
* components property * components property
* *
@ -242,7 +242,7 @@ class MutuallyReferencingOneComponent extends CakeObject {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class MutuallyReferencingTwoComponent extends CakeObject { class MutuallyReferencingTwoComponent extends Object {
/** /**
* components property * components property
* *
@ -257,7 +257,7 @@ class MutuallyReferencingTwoComponent extends CakeObject {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class SomethingWithEmailComponent extends CakeObject { class SomethingWithEmailComponent extends Object {
/** /**
* components property * components property
* *
@ -302,19 +302,19 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testLoadComponents() { function testLoadComponents() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('RequestHandler'); $Controller->components = array('RequestHandler');
$Component = new Component(); $Component =& new Component();
$Component->init($Controller); $Component->init($Controller);
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->plugin = 'test_plugin'; $Controller->plugin = 'test_plugin';
$Controller->components = array('RequestHandler', 'TestPluginComponent'); $Controller->components = array('RequestHandler', 'TestPluginComponent');
$Component = new Component(); $Component =& new Component();
$Component->init($Controller); $Component->init($Controller);
$this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent'));
@ -325,19 +325,19 @@ class ComponentTest extends CakeTestCase {
)); ));
$this->assertFalse(isset($Controller->TestPluginOtherComponent)); $this->assertFalse(isset($Controller->TestPluginOtherComponent));
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Security'); $Controller->components = array('Security');
$Component = new Component(); $Component =& new Component();
$Component->init($Controller); $Component->init($Controller);
$this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
$this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent')); $this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent'));
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Security', 'Cookie', 'RequestHandler'); $Controller->components = array('Security', 'Cookie', 'RequestHandler');
$Component = new Component(); $Component =& new Component();
$Component->init($Controller); $Component->init($Controller);
$this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent'));
@ -351,7 +351,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testNestedComponentLoading() { function testNestedComponentLoading() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Apple'); $Controller->components = array('Apple');
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->Component->initialize($Controller); $Controller->Component->initialize($Controller);
@ -370,7 +370,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testComponentStartup() { function testComponentStartup() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Apple'); $Controller->components = array('Apple');
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->Component->initialize($Controller); $Controller->Component->initialize($Controller);
@ -390,7 +390,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testMultipleComponentInitialize() { function testMultipleComponentInitialize() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Orange', 'Banana'); $Controller->components = array('Orange', 'Banana');
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->Component->initialize($Controller); $Controller->Component->initialize($Controller);
@ -409,7 +409,7 @@ class ComponentTest extends CakeTestCase {
return; return;
} }
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple'); $Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
$Controller->constructClasses(); $Controller->constructClasses();
@ -424,7 +424,7 @@ class ComponentTest extends CakeTestCase {
$this->assertEqual($Controller->ParamTest->flag, true); $this->assertEqual($Controller->ParamTest->flag, true);
//Settings are merged from app controller and current controller. //Settings are merged from app controller and current controller.
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array( $Controller->components = array(
'ParamTest' => array('test' => 'value'), 'ParamTest' => array('test' => 'value'),
'Orange' => array('ripeness' => 'perfect') 'Orange' => array('ripeness' => 'perfect')
@ -443,7 +443,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testComponentParamsNoDuplication() { function testComponentParamsNoDuplication() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('Orange' => array('setting' => array('itemx'))); $Controller->components = array('Orange' => array('setting' => array('itemx')));
$Controller->constructClasses(); $Controller->constructClasses();
@ -457,7 +457,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testMutuallyReferencingComponents() { function testMutuallyReferencingComponents() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('MutuallyReferencingOne'); $Controller->components = array('MutuallyReferencingOne');
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->Component->initialize($Controller); $Controller->Component->initialize($Controller);
@ -481,7 +481,7 @@ class ComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSomethingReferencingEmailComponent() { function testSomethingReferencingEmailComponent() {
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->components = array('SomethingWithEmail'); $Controller->components = array('SomethingWithEmail');
$Controller->constructClasses(); $Controller->constructClasses();
$Controller->Component->initialize($Controller); $Controller->Component->initialize($Controller);
@ -510,7 +510,7 @@ class ComponentTest extends CakeTestCase {
function testDoubleLoadingOfSessionComponent() { function testDoubleLoadingOfSessionComponent() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController'); $this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController');
$Controller = new ComponentTestController(); $Controller =& new ComponentTestController();
$Controller->uses = array(); $Controller->uses = array();
$Controller->components = array('Session'); $Controller->components = array('Session');
$Controller->constructClasses(); $Controller->constructClasses();

View file

@ -165,10 +165,10 @@ class DbAclTwoTest extends DbAcl {
* @return void * @return void
*/ */
function __construct() { function __construct() {
$this->Aro = new AroTwoTest(); $this->Aro =& new AroTwoTest();
$this->Aro->Permission = new PermissionTwoTest(); $this->Aro->Permission =& new PermissionTwoTest();
$this->Aco = new AcoTwoTest(); $this->Aco =& new AcoTwoTest();
$this->Aro->Permission = new PermissionTwoTest(); $this->Aro->Permission =& new PermissionTwoTest();
} }
} }
/** /**
@ -200,7 +200,7 @@ class AclComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function startTest() { function startTest() {
$this->Acl = new AclComponent(); $this->Acl =& new AclComponent();
} }
/** /**
* before method * before method

View file

@ -445,7 +445,7 @@ class AuthTest extends CakeTestCase {
Configure::write('Acl.database', 'test_suite'); Configure::write('Acl.database', 'test_suite');
Configure::write('Acl.classname', 'DbAcl'); Configure::write('Acl.classname', 'DbAcl');
$this->Controller = new AuthTestController(); $this->Controller =& new AuthTestController();
$this->Controller->Component->init($this->Controller); $this->Controller->Component->init($this->Controller);
ClassRegistry::addObject('view', new View($this->Controller)); ClassRegistry::addObject('view', new View($this->Controller));
@ -509,7 +509,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testLogin() { function testLogin() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user['id'] = 1; $user['id'] = 1;
$user['username'] = 'mariano'; $user['username'] = 'mariano';
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake'); $user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
@ -580,7 +580,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAuthorizeFalse() { function testAuthorizeFalse() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user = $this->AuthUser->find(); $user = $this->AuthUser->find();
$this->Controller->Session->write('Auth', $user); $this->Controller->Session->write('Auth', $user);
$this->Controller->Auth->userModel = 'AuthUser'; $this->Controller->Auth->userModel = 'AuthUser';
@ -605,7 +605,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAuthorizeController() { function testAuthorizeController() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user = $this->AuthUser->find(); $user = $this->AuthUser->find();
$this->Controller->Session->write('Auth', $user); $this->Controller->Session->write('Auth', $user);
$this->Controller->Auth->userModel = 'AuthUser'; $this->Controller->Auth->userModel = 'AuthUser';
@ -628,7 +628,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAuthorizeModel() { function testAuthorizeModel() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user = $this->AuthUser->find(); $user = $this->AuthUser->find();
$this->Controller->Session->write('Auth', $user); $this->Controller->Session->write('Auth', $user);
@ -653,7 +653,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAuthorizeCrud() { function testAuthorizeCrud() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user = $this->AuthUser->find(); $user = $this->AuthUser->find();
$this->Controller->Session->write('Auth', $user); $this->Controller->Session->write('Auth', $user);
@ -951,7 +951,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testEmptyUsernameOrPassword() { function testEmptyUsernameOrPassword() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user['id'] = 1; $user['id'] = 1;
$user['username'] = 'mariano'; $user['username'] = 'mariano';
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake'); $user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
@ -981,7 +981,7 @@ class AuthTest extends CakeTestCase {
* @return void * @return void
*/ */
function testInjection() { function testInjection() {
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$this->AuthUser->id = 2; $this->AuthUser->id = 2;
$this->AuthUser->saveField('password', Security::hash(Configure::read('Security.salt') . 'cake')); $this->AuthUser->saveField('password', Security::hash(Configure::read('Security.salt') . 'cake'));
@ -1086,7 +1086,7 @@ class AuthTest extends CakeTestCase {
'argSeparator' => ':', 'namedArgs' => array() 'argSeparator' => ':', 'namedArgs' => array()
))); )));
$this->AuthUser = new AuthUser(); $this->AuthUser =& new AuthUser();
$user = array( $user = array(
'id' => 1, 'username' => 'felix', 'id' => 1, 'username' => 'felix',
'password' => Security::hash(Configure::read('Security.salt') . 'cake' 'password' => Security::hash(Configure::read('Security.salt') . 'cake'
@ -1131,7 +1131,7 @@ class AuthTest extends CakeTestCase {
function testCustomField() { function testCustomField() {
Router::reload(); Router::reload();
$this->AuthUserCustomField = new AuthUserCustomField(); $this->AuthUserCustomField =& new AuthUserCustomField();
$user = array( $user = array(
'id' => 1, 'email' => 'harking@example.com', 'id' => 1, 'email' => 'harking@example.com',
'password' => Security::hash(Configure::read('Security.salt') . 'cake' 'password' => Security::hash(Configure::read('Security.salt') . 'cake'
@ -1208,7 +1208,7 @@ class AuthTest extends CakeTestCase {
} }
ob_start(); ob_start();
$Dispatcher = new Dispatcher(); $Dispatcher =& new Dispatcher();
$Dispatcher->dispatch('/ajax_auth/add', array('return' => 1)); $Dispatcher->dispatch('/ajax_auth/add', array('return' => 1));
$result = ob_get_clean(); $result = ob_get_clean();
$this->assertEqual("Ajax!\nthis is the test element", $result); $this->assertEqual("Ajax!\nthis is the test element", $result);

View file

@ -181,7 +181,7 @@ class EmailComponentTest extends CakeTestCase {
$this->_appEncoding = Configure::read('App.encoding'); $this->_appEncoding = Configure::read('App.encoding');
Configure::write('App.encoding', 'UTF-8'); Configure::write('App.encoding', 'UTF-8');
$this->Controller = new EmailTestController(); $this->Controller =& new EmailTestController();
restore_error_handler(); restore_error_handler();
@$this->Controller->Component->init($this->Controller); @$this->Controller->Component->init($this->Controller);
@ -470,7 +470,7 @@ TEXTBLOC;
$this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost'); $this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost');
$this->Controller->EmailTest->reset(); $this->Controller->EmailTest->reset();
$socket = new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->Controller->EmailTest->smtpOptions)); $socket =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->Controller->EmailTest->smtpOptions));
$this->Controller->EmailTest->setConnectionSocket($socket); $this->Controller->EmailTest->setConnectionSocket($socket);
$this->assertTrue($this->Controller->EmailTest->getConnectionSocket()); $this->assertTrue($this->Controller->EmailTest->getConnectionSocket());

View file

@ -137,7 +137,7 @@ class SecurityComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function setUp() { function setUp() {
$this->Controller = new SecurityTestController(); $this->Controller =& new SecurityTestController();
$this->Controller->Component->init($this->Controller); $this->Controller->Component->init($this->Controller);
$this->Controller->Security =& $this->Controller->TestSecurity; $this->Controller->Security =& $this->Controller->TestSecurity;
$this->Controller->Security->blackHoleCallback = 'fail'; $this->Controller->Security->blackHoleCallback = 'fail';

View file

@ -107,20 +107,20 @@ class SessionComponentTest extends CakeTestCase {
*/ */
function testSessionAutoStart() { function testSessionAutoStart() {
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->__active); $this->assertFalse($Session->__active);
$this->assertFalse($Session->__started); $this->assertFalse($Session->__started);
$Session->startup(new SessionTestController()); $Session->startup(new SessionTestController());
Configure::write('Session.start', true); Configure::write('Session.start', true);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertTrue($Session->__active); $this->assertTrue($Session->__active);
$this->assertFalse($Session->__started); $this->assertFalse($Session->__started);
$Session->startup(new SessionTestController()); $Session->startup(new SessionTestController());
$this->assertTrue(isset($_SESSION)); $this->assertTrue(isset($_SESSION));
$Object = new Object(); $Object = new Object();
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->start(); $Session->start();
$expected = $Session->id(); $expected = $Session->id();
@ -137,14 +137,14 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionInitialize() { function testSessionInitialize() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertEqual($Session->__bare, 0); $this->assertEqual($Session->__bare, 0);
$Session->initialize(new SessionTestController()); $Session->initialize(new SessionTestController());
$this->assertEqual($Session->__bare, 0); $this->assertEqual($Session->__bare, 0);
$sessionController = new SessionTestController(); $sessionController =& new SessionTestController();
$sessionController->params['bare'] = 1; $sessionController->params['bare'] = 1;
$Session->initialize($sessionController); $Session->initialize($sessionController);
$this->assertEqual($Session->__bare, 1); $this->assertEqual($Session->__bare, 1);
@ -156,14 +156,14 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionActivate() { function testSessionActivate() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertTrue($Session->__active); $this->assertTrue($Session->__active);
$this->assertNull($Session->activate()); $this->assertNull($Session->activate());
$this->assertTrue($Session->__active); $this->assertTrue($Session->__active);
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->__active); $this->assertFalse($Session->__active);
$this->assertNull($Session->activate()); $this->assertNull($Session->activate());
$this->assertTrue($Session->__active); $this->assertTrue($Session->__active);
@ -177,7 +177,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionValid() { function testSessionValid() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertTrue($Session->valid()); $this->assertTrue($Session->valid());
@ -185,17 +185,17 @@ class SessionComponentTest extends CakeTestCase {
$this->assertFalse($Session->valid()); $this->assertFalse($Session->valid());
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->__active); $this->assertFalse($Session->__active);
$this->assertFalse($Session->valid()); $this->assertFalse($Session->valid());
Configure::write('Session.start', true); Configure::write('Session.start', true);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->time = $Session->read('Config.time') + 1; $Session->time = $Session->read('Config.time') + 1;
$this->assertFalse($Session->valid()); $this->assertFalse($Session->valid());
Configure::write('Session.checkAgent', false); Configure::write('Session.checkAgent', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->time = $Session->read('Config.time') + 1; $Session->time = $Session->read('Config.time') + 1;
$this->assertFalse($Session->valid()); $this->assertFalse($Session->valid());
Configure::write('Session.checkAgent', true); Configure::write('Session.checkAgent', true);
@ -207,12 +207,12 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionError() { function testSessionError() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->error()); $this->assertFalse($Session->error());
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->__active); $this->assertFalse($Session->__active);
$this->assertFalse($Session->error()); $this->assertFalse($Session->error());
Configure::write('Session.start', true); Configure::write('Session.start', true);
@ -224,7 +224,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionReadWrite() { function testSessionReadWrite() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->read('Test')); $this->assertFalse($Session->read('Test'));
@ -251,7 +251,7 @@ class SessionComponentTest extends CakeTestCase {
$Session->del('Test'); $Session->del('Test');
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->write('Test', 'some value')); $this->assertFalse($Session->write('Test', 'some value'));
$Session->write('Test', 'some value'); $Session->write('Test', 'some value');
$this->assertFalse($Session->read('Test')); $this->assertFalse($Session->read('Test'));
@ -264,7 +264,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionDel() { function testSessionDel() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->del('Test')); $this->assertFalse($Session->del('Test'));
@ -272,7 +272,7 @@ class SessionComponentTest extends CakeTestCase {
$this->assertTrue($Session->del('Test')); $this->assertTrue($Session->del('Test'));
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->write('Test', 'some value'); $Session->write('Test', 'some value');
$this->assertFalse($Session->del('Test')); $this->assertFalse($Session->del('Test'));
Configure::write('Session.start', true); Configure::write('Session.start', true);
@ -284,7 +284,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionDelete() { function testSessionDelete() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->delete('Test')); $this->assertFalse($Session->delete('Test'));
@ -292,7 +292,7 @@ class SessionComponentTest extends CakeTestCase {
$this->assertTrue($Session->delete('Test')); $this->assertTrue($Session->delete('Test'));
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->write('Test', 'some value'); $Session->write('Test', 'some value');
$this->assertFalse($Session->delete('Test')); $this->assertFalse($Session->delete('Test'));
Configure::write('Session.start', true); Configure::write('Session.start', true);
@ -304,7 +304,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionCheck() { function testSessionCheck() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertFalse($Session->check('Test')); $this->assertFalse($Session->check('Test'));
@ -313,7 +313,7 @@ class SessionComponentTest extends CakeTestCase {
$Session->delete('Test'); $Session->delete('Test');
Configure::write('Session.start', false); Configure::write('Session.start', false);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->write('Test', 'some value'); $Session->write('Test', 'some value');
$this->assertFalse($Session->check('Test')); $this->assertFalse($Session->check('Test'));
Configure::write('Session.start', true); Configure::write('Session.start', true);
@ -325,7 +325,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionFlash() { function testSessionFlash() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertNull($Session->read('Message.flash')); $this->assertNull($Session->read('Message.flash'));
@ -351,7 +351,7 @@ class SessionComponentTest extends CakeTestCase {
*/ */
function testSessionId() { function testSessionId() {
unset($_SESSION); unset($_SESSION);
$Session = new SessionComponent(); $Session =& new SessionComponent();
$this->assertNull($Session->id()); $this->assertNull($Session->id());
} }
/** /**
@ -361,7 +361,7 @@ class SessionComponentTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSessionDestroy() { function testSessionDestroy() {
$Session = new SessionComponent(); $Session =& new SessionComponent();
$Session->write('Test', 'some value'); $Session->write('Test', 'some value');
$this->assertEqual($Session->read('Test'), 'some value'); $this->assertEqual($Session->read('Test'), 'some value');

View file

@ -328,7 +328,7 @@ class TestController extends AppController {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs.controller * @subpackage cake.tests.cases.libs.controller
*/ */
class TestComponent extends CakeObject { class TestComponent extends Object {
/** /**
* beforeRedirect method * beforeRedirect method
* *
@ -380,7 +380,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testConstructClasses() { function testConstructClasses() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->modelClass = 'ControllerPost'; $Controller->modelClass = 'ControllerPost';
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->constructClasses(); $Controller->constructClasses();
@ -388,7 +388,7 @@ class ControllerTest extends CakeTestCase {
unset($Controller); unset($Controller);
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->uses = array('ControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->constructClasses(); $Controller->constructClasses();
@ -404,7 +404,7 @@ class ControllerTest extends CakeTestCase {
); );
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('TestPlugin.TestPluginPost'); $Controller->uses = array('TestPlugin.TestPluginPost');
$Controller->constructClasses(); $Controller->constructClasses();
@ -422,7 +422,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAliasName() { function testAliasName() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('NameTest'); $Controller->uses = array('NameTest');
$Controller->constructClasses(); $Controller->constructClasses();
@ -439,7 +439,7 @@ class ControllerTest extends CakeTestCase {
*/ */
function testPersistent() { function testPersistent() {
Configure::write('Cache.disable', false); Configure::write('Cache.disable', false);
$Controller = new Controller(); $Controller =& new Controller();
$Controller->modelClass = 'ControllerPost'; $Controller->modelClass = 'ControllerPost';
$Controller->persistModel = true; $Controller->persistModel = true;
$Controller->constructClasses(); $Controller->constructClasses();
@ -458,7 +458,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPaginate() { function testPaginate() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->uses = array('ControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->params['url'] = array(); $Controller->params['url'] = array();
@ -519,7 +519,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPaginateExtraParams() { function testPaginateExtraParams() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->uses = array('ControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->params['url'] = array(); $Controller->params['url'] = array();
@ -551,7 +551,7 @@ class ControllerTest extends CakeTestCase {
$this->assertEqual($Controller->ControllerPost->lastQuery['limit'], 12); $this->assertEqual($Controller->ControllerPost->lastQuery['limit'], 12);
$this->assertEqual($paging['options']['limit'], 12); $this->assertEqual($paging['options']['limit'], 12);
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPaginateModel'); $Controller->uses = array('ControllerPaginateModel');
$Controller->params['url'] = array(); $Controller->params['url'] = array();
$Controller->constructClasses(); $Controller->constructClasses();
@ -578,7 +578,7 @@ class ControllerTest extends CakeTestCase {
* @access public * @access public
*/ */
function testPaginatePassedArgs() { function testPaginatePassedArgs() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPost'); $Controller->uses = array('ControllerPost');
$Controller->passedArgs[] = array('1', '2', '3'); $Controller->passedArgs[] = array('1', '2', '3');
$Controller->params['url'] = array(); $Controller->params['url'] = array();
@ -610,7 +610,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testPaginateSpecialType() { function testPaginateSpecialType() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->uses = array('ControllerPost', 'ControllerComment');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->params['url'] = array(); $Controller->params['url'] = array();
@ -631,7 +631,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDefaultPaginateParams() { function testDefaultPaginateParams() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->modelClass = 'ControllerPost'; $Controller->modelClass = 'ControllerPost';
$Controller->params['url'] = array(); $Controller->params['url'] = array();
$Controller->paginate = array('order' => 'ControllerPost.id DESC'); $Controller->paginate = array('order' => 'ControllerPost.id DESC');
@ -648,7 +648,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFlash() { function testFlash() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->flash('this should work', '/flash'); $Controller->flash('this should work', '/flash');
$result = $Controller->output; $result = $Controller->output;
@ -678,7 +678,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testControllerSet() { function testControllerSet() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->set('variable_with_underscores', null); $Controller->set('variable_with_underscores', null);
$this->assertTrue(array_key_exists('variable_with_underscores', $Controller->viewVars)); $this->assertTrue(array_key_exists('variable_with_underscores', $Controller->viewVars));
@ -713,7 +713,7 @@ class ControllerTest extends CakeTestCase {
function testRender() { function testRender() {
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)); Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS));
$Controller = new Controller(); $Controller =& new Controller();
$Controller->viewPath = 'posts'; $Controller->viewPath = 'posts';
$result = $Controller->render('index'); $result = $Controller->render('index');
@ -744,7 +744,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testToBeInheritedGuardmethods() { function testToBeInheritedGuardmethods() {
$Controller = new Controller(); $Controller =& new Controller();
$this->assertTrue($Controller->_beforeScaffold('')); $this->assertTrue($Controller->_beforeScaffold(''));
$this->assertTrue($Controller->_afterScaffoldSave('')); $this->assertTrue($Controller->_afterScaffoldSave(''));
$this->assertTrue($Controller->_afterScaffoldSaveError('')); $this->assertTrue($Controller->_afterScaffoldSaveError(''));
@ -806,8 +806,8 @@ class ControllerTest extends CakeTestCase {
App::import('Helper', 'Cache'); App::import('Helper', 'Cache');
foreach ($codes as $code => $msg) { foreach ($codes as $code => $msg) {
$MockController = new MockController(); $MockController =& new MockController();
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}")); $MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}"));
$MockController->expectAt(1, 'header', array('Location: http://cakephp.org')); $MockController->expectAt(1, 'header', array('Location: http://cakephp.org'));
@ -816,8 +816,8 @@ class ControllerTest extends CakeTestCase {
$this->assertFalse($MockController->autoRender); $this->assertFalse($MockController->autoRender);
} }
foreach ($codes as $code => $msg) { foreach ($codes as $code => $msg) {
$MockController = new MockController(); $MockController =& new MockController();
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}")); $MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}"));
$MockController->expectAt(1, 'header', array('Location: http://cakephp.org')); $MockController->expectAt(1, 'header', array('Location: http://cakephp.org'));
@ -826,24 +826,24 @@ class ControllerTest extends CakeTestCase {
$this->assertFalse($MockController->autoRender); $this->assertFalse($MockController->autoRender);
} }
$MockController = new MockController(); $MockController =& new MockController();
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array('Location: http://www.example.org/users/login')); $MockController->expectAt(0, 'header', array('Location: http://www.example.org/users/login'));
$MockController->expectCallCount('header', 1); $MockController->expectCallCount('header', 1);
$MockController->redirect('http://www.example.org/users/login', null, false); $MockController->redirect('http://www.example.org/users/login', null, false);
$MockController = new MockController(); $MockController =& new MockController();
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
$MockController->expectAt(1, 'header', array('Location: http://www.example.org/users/login')); $MockController->expectAt(1, 'header', array('Location: http://www.example.org/users/login'));
$MockController->expectCallCount('header', 2); $MockController->expectCallCount('header', 2);
$MockController->redirect('http://www.example.org/users/login', 301, false); $MockController->redirect('http://www.example.org/users/login', 301, false);
$MockController = new MockController(); $MockController =& new MockController();
$MockController->components = array('MockTest'); $MockController->components = array('MockTest');
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', null); $MockController->MockTest->setReturnValue('beforeRedirect', null);
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
@ -851,9 +851,9 @@ class ControllerTest extends CakeTestCase {
$MockController->expectCallCount('header', 2); $MockController->expectCallCount('header', 2);
$MockController->redirect('http://cakephp.org', 301, false); $MockController->redirect('http://cakephp.org', 301, false);
$MockController = new MockController(); $MockController =& new MockController();
$MockController->components = array('MockTest'); $MockController->components = array('MockTest');
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org'); $MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org');
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
@ -861,17 +861,17 @@ class ControllerTest extends CakeTestCase {
$MockController->expectCallCount('header', 2); $MockController->expectCallCount('header', 2);
$MockController->redirect('http://cakephp.org', 301, false); $MockController->redirect('http://cakephp.org', 301, false);
$MockController = new MockController(); $MockController =& new MockController();
$MockController->components = array('MockTest'); $MockController->components = array('MockTest');
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', false); $MockController->MockTest->setReturnValue('beforeRedirect', false);
$MockController->expectNever('header'); $MockController->expectNever('header');
$MockController->redirect('http://cakephp.org', 301, false); $MockController->redirect('http://cakephp.org', 301, false);
$MockController = new MockController(); $MockController =& new MockController();
$MockController->components = array('MockTest', 'MockTestB'); $MockController->components = array('MockTest', 'MockTestB');
$MockController->Component = new Component(); $MockController->Component =& new Component();
$MockController->Component->init($MockController); $MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org'); $MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org');
$MockController->MockTestB->setReturnValue('beforeRedirect', 'http://bakery.cakephp.org'); $MockController->MockTestB->setReturnValue('beforeRedirect', 'http://bakery.cakephp.org');
@ -891,7 +891,7 @@ class ControllerTest extends CakeTestCase {
return; return;
} }
$TestController = new TestController(); $TestController =& new TestController();
$TestController->constructClasses(); $TestController->constructClasses();
$testVars = get_class_vars('TestController'); $testVars = get_class_vars('TestController');
@ -914,7 +914,7 @@ class ControllerTest extends CakeTestCase {
$this->assertEqual(count(array_diff($TestController->uses, $uses)), 0); $this->assertEqual(count(array_diff($TestController->uses, $uses)), 0);
$this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0); $this->assertEqual(count(array_diff_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0);
$TestController = new AnotherTestController(); $TestController =& new AnotherTestController();
$TestController->constructClasses(); $TestController->constructClasses();
$appVars = get_class_vars('AppController'); $appVars = get_class_vars('AppController');
@ -927,7 +927,7 @@ class ControllerTest extends CakeTestCase {
$this->assertFalse(isset($TestController->ControllerPost)); $this->assertFalse(isset($TestController->ControllerPost));
$TestController = new ControllerCommentsController(); $TestController =& new ControllerCommentsController();
$TestController->constructClasses(); $TestController->constructClasses();
$appVars = get_class_vars('AppController'); $appVars = get_class_vars('AppController');
@ -950,7 +950,7 @@ class ControllerTest extends CakeTestCase {
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) { if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
return; return;
} }
$TestController = new TestController(); $TestController =& new TestController();
$expected = array('foo'); $expected = array('foo');
$TestController->components = array('Cookie' => $expected); $TestController->components = array('Cookie' => $expected);
$TestController->constructClasses(); $TestController->constructClasses();
@ -963,7 +963,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testMergeVarsNotGreedy() { function testMergeVarsNotGreedy() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->components = array(); $Controller->components = array();
$Controller->uses = array(); $Controller->uses = array();
$Controller->constructClasses(); $Controller->constructClasses();
@ -977,7 +977,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testReferer() { function testReferer() {
$Controller = new Controller(); $Controller =& new Controller();
$_SERVER['HTTP_REFERER'] = 'http://cakephp.org'; $_SERVER['HTTP_REFERER'] = 'http://cakephp.org';
$result = $Controller->referer(null, false); $result = $Controller->referer(null, false);
$expected = 'http://cakephp.org'; $expected = 'http://cakephp.org';
@ -1023,7 +1023,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSetAction() { function testSetAction() {
$TestController = new TestController(); $TestController =& new TestController();
$TestController->setAction('index', 1, 2); $TestController->setAction('index', 1, 2);
$expected = array('testId' => 1, 'test2Id' => 2); $expected = array('testId' => 1, 'test2Id' => 2);
$this->assertidentical($TestController->data, $expected); $this->assertidentical($TestController->data, $expected);
@ -1035,7 +1035,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testUnimplementedIsAuthorized() { function testUnimplementedIsAuthorized() {
$TestController = new TestController(); $TestController =& new TestController();
$TestController->isAuthorized(); $TestController->isAuthorized();
$this->assertError(); $this->assertError();
} }
@ -1046,7 +1046,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testValidateErrors() { function testValidateErrors() {
$TestController = new TestController(); $TestController =& new TestController();
$TestController->constructClasses(); $TestController->constructClasses();
$this->assertFalse($TestController->validateErrors()); $this->assertFalse($TestController->validateErrors());
$this->assertEqual($TestController->validate(), 0); $this->assertEqual($TestController->validate(), 0);
@ -1067,7 +1067,7 @@ class ControllerTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPostConditions() { function testPostConditions() {
$Controller = new Controller(); $Controller =& new Controller();
$data = array( $data = array(
@ -1132,7 +1132,7 @@ class ControllerTest extends CakeTestCase {
*/ */
function testRequestHandlerPrefers(){ function testRequestHandlerPrefers(){
Configure::write('debug', 2); Configure::write('debug', 2);
$Controller = new Controller(); $Controller =& new Controller();
$Controller->components = array("RequestHandler"); $Controller->components = array("RequestHandler");
$Controller->modelClass='ControllerPost'; $Controller->modelClass='ControllerPost';
$Controller->params['url']['ext'] = 'rss'; $Controller->params['url']['ext'] = 'rss';

View file

@ -53,7 +53,7 @@ if (!class_exists('AppController')) {
* *
* @package cake.tests.cases.libs.controller * @package cake.tests.cases.libs.controller
**/ **/
class MergeVarComponent extends CakeObject { class MergeVarComponent extends Object {
} }
@ -139,7 +139,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
* @return void * @return void
**/ **/
function testComponentParamMergingNoDuplication() { function testComponentParamMergingNoDuplication() {
$Controller = new MergeVariablesController(); $Controller =& new MergeVariablesController();
$Controller->constructClasses(); $Controller->constructClasses();
$expected = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false)); $expected = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false));
@ -151,7 +151,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
* @return void * @return void
**/ **/
function testComponentMergingWithRedeclarations() { function testComponentMergingWithRedeclarations() {
$Controller = new MergeVariablesController(); $Controller =& new MergeVariablesController();
$Controller->components['MergeVar'] = array('remote', 'redirect' => true); $Controller->components['MergeVar'] = array('remote', 'redirect' => true);
$Controller->constructClasses(); $Controller->constructClasses();
@ -164,7 +164,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
* @return void * @return void
**/ **/
function testHelperSettingMergingNoDuplication() { function testHelperSettingMergingNoDuplication() {
$Controller = new MergeVariablesController(); $Controller =& new MergeVariablesController();
$Controller->constructClasses(); $Controller->constructClasses();
$expected = array('MergeVar' => array('format' => 'html', 'terse')); $expected = array('MergeVar' => array('format' => 'html', 'terse'));
@ -176,7 +176,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
* @return void * @return void
**/ **/
function testMergeVarsWithPlugin() { function testMergeVarsWithPlugin() {
$Controller = new MergePostsController(); $Controller =& new MergePostsController();
$Controller->components = array('Email' => array('ports' => 'open')); $Controller->components = array('Email' => array('ports' => 'open'));
$Controller->plugin = 'MergeVarPlugin'; $Controller->plugin = 'MergeVarPlugin';
$Controller->constructClasses(); $Controller->constructClasses();
@ -194,7 +194,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
); );
$this->assertEqual($Controller->helpers, $expected, 'Helpers are unexpected %s'); $this->assertEqual($Controller->helpers, $expected, 'Helpers are unexpected %s');
$Controller = new MergePostsController(); $Controller =& new MergePostsController();
$Controller->components = array(); $Controller->components = array();
$Controller->plugin = 'MergeVarPlugin'; $Controller->plugin = 'MergeVarPlugin';
$Controller->constructClasses(); $Controller->constructClasses();
@ -212,7 +212,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase {
* @return void * @return void
**/ **/
function testMergeVarsNotGreedy() { function testMergeVarsNotGreedy() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->components = array(); $Controller->components = array();
$Controller->uses = array(); $Controller->uses = array();
$Controller->constructClasses(); $Controller->constructClasses();

View file

@ -67,7 +67,7 @@ class PagesControllerTest extends CakeTestCase {
} }
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)); Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS));
$Pages = new PagesController(); $Pages =& new PagesController();
$Pages->viewPath = 'posts'; $Pages->viewPath = 'posts';
$Pages->display('index'); $Pages->display('index');

View file

@ -262,7 +262,7 @@ class ScaffoldViewTest extends CakeTestCase {
* @return void * @return void
*/ */
function startTest() { function startTest() {
$this->Controller = new ScaffoldMockController(); $this->Controller =& new ScaffoldMockController();
} }
/** /**
* endTest method * endTest method
@ -284,7 +284,7 @@ class ScaffoldViewTest extends CakeTestCase {
Configure::write('Routing.admin', 'admin'); Configure::write('Routing.admin', 'admin');
$this->Controller->action = 'index'; $this->Controller->action = 'index';
$ScaffoldView = new TestScaffoldView($this->Controller); $ScaffoldView =& new TestScaffoldView($this->Controller);
$result = $ScaffoldView->testGetFilename('index'); $result = $ScaffoldView->testGetFilename('index');
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp'; $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
@ -328,11 +328,11 @@ class ScaffoldViewTest extends CakeTestCase {
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS)); Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS));
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
$Controller = new ScaffoldMockController(); $Controller =& new ScaffoldMockController();
$Controller->scaffold = 'admin'; $Controller->scaffold = 'admin';
$Controller->viewPath = 'posts'; $Controller->viewPath = 'posts';
$Controller->action = 'admin_edit'; $Controller->action = 'admin_edit';
$ScaffoldView = new TestScaffoldView($Controller); $ScaffoldView =& new TestScaffoldView($Controller);
$result = $ScaffoldView->testGetFilename('admin_edit'); $result = $ScaffoldView->testGetFilename('admin_edit');
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' .DS . 'views' . DS . 'posts' . DS . 'scaffold.edit.ctp'; $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' .DS . 'views' . DS . 'posts' . DS . 'scaffold.edit.ctp';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
@ -341,12 +341,12 @@ class ScaffoldViewTest extends CakeTestCase {
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' .DS . 'views' . DS . 'posts' . DS . 'scaffold.edit.ctp'; $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' .DS . 'views' . DS . 'posts' . DS . 'scaffold.edit.ctp';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$Controller = new ScaffoldMockController(); $Controller =& new ScaffoldMockController();
$Controller->scaffold = 'admin'; $Controller->scaffold = 'admin';
$Controller->viewPath = 'tests'; $Controller->viewPath = 'tests';
$Controller->plugin = 'test_plugin'; $Controller->plugin = 'test_plugin';
$Controller->action = 'admin_add'; $Controller->action = 'admin_add';
$ScaffoldView = new TestScaffoldView($Controller); $ScaffoldView =& new TestScaffoldView($Controller);
$result = $ScaffoldView->testGetFilename('admin_add'); $result = $ScaffoldView->testGetFilename('admin_add');
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins'
. DS .'test_plugin' . DS . 'views' . DS . 'tests' . DS . 'scaffold.edit.ctp'; . DS .'test_plugin' . DS . 'views' . DS . 'tests' . DS . 'scaffold.edit.ctp';
@ -595,7 +595,7 @@ class ScaffoldTest extends CakeTestCase {
* @return void * @return void
*/ */
function startTest() { function startTest() {
$this->Controller = new ScaffoldMockController(); $this->Controller =& new ScaffoldMockController();
} }
/** /**
* endTest method * endTest method
@ -634,7 +634,7 @@ class ScaffoldTest extends CakeTestCase {
$this->Controller->controller = 'scaffold_mock'; $this->Controller->controller = 'scaffold_mock';
$this->Controller->base = '/'; $this->Controller->base = '/';
$this->Controller->constructClasses(); $this->Controller->constructClasses();
$Scaffold = new TestScaffoldMock($this->Controller, $params); $Scaffold =& new TestScaffoldMock($this->Controller, $params);
$result = $Scaffold->getParams(); $result = $Scaffold->getParams();
$this->assertEqual($result['action'], 'admin_edit'); $this->assertEqual($result['action'], 'admin_edit');
} }
@ -664,7 +664,7 @@ class ScaffoldTest extends CakeTestCase {
$this->Controller->controller = 'scaffold_mock'; $this->Controller->controller = 'scaffold_mock';
$this->Controller->base = '/'; $this->Controller->base = '/';
$this->Controller->constructClasses(); $this->Controller->constructClasses();
$Scaffold = new TestScaffoldMock($this->Controller, $params); $Scaffold =& new TestScaffoldMock($this->Controller, $params);
$result = $Scaffold->controller->viewVars; $result = $Scaffold->controller->viewVars;
$this->assertEqual($result['singularHumanName'], 'Scaffold Mock'); $this->assertEqual($result['singularHumanName'], 'Scaffold Mock');

View file

@ -36,7 +36,7 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class BlueberryComponent extends CakeObject { class BlueberryComponent extends Object {
/** /**
* testName property * testName property
* *
@ -261,7 +261,7 @@ class ErrorHandlerTest extends CakeTestCase {
$this->assertPattern("/<strong>'\/test_error'<\/strong>/", $result); $this->assertPattern("/<strong>'\/test_error'<\/strong>/", $result);
ob_start(); ob_start();
$TestErrorHandler = new TestErrorHandler('error404', array('message' => 'Page not found')); $TestErrorHandler =& new TestErrorHandler('error404', array('message' => 'Page not found'));
ob_get_clean(); ob_get_clean();
ob_start(); ob_start();
$TestErrorHandler->error404(array( $TestErrorHandler->error404(array(

View file

@ -47,7 +47,7 @@ class FileTest extends CakeTestCase {
*/ */
function testBasic() { function testBasic() {
$file = __FILE__; $file = __FILE__;
$this->File = new File($file); $this->File =& new File($file);
$result = $this->File->pwd(); $result = $this->File->pwd();
$expecting = $file; $expecting = $file;
@ -209,7 +209,7 @@ class FileTest extends CakeTestCase {
*/ */
function testCreate() { function testCreate() {
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp';
$File = new File($tmpFile, true, 0777); $File =& new File($tmpFile, true, 0777);
$this->assertTrue($File->exists()); $this->assertTrue($File->exists());
} }
/** /**
@ -219,7 +219,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testOpeningNonExistantFileCreatesIt() { function testOpeningNonExistantFileCreatesIt() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertTrue($someFile->open()); $this->assertTrue($someFile->open());
$this->assertEqual($someFile->read(), ''); $this->assertEqual($someFile->read(), '');
$someFile->close(); $someFile->close();
@ -252,7 +252,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testReadable() { function testReadable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertTrue($someFile->open()); $this->assertTrue($someFile->open());
$this->assertTrue($someFile->readable()); $this->assertTrue($someFile->readable());
$someFile->close(); $someFile->close();
@ -265,7 +265,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testWritable() { function testWritable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertTrue($someFile->open()); $this->assertTrue($someFile->open());
$this->assertTrue($someFile->writable()); $this->assertTrue($someFile->writable());
$someFile->close(); $someFile->close();
@ -278,7 +278,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testExecutable() { function testExecutable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertTrue($someFile->open()); $this->assertTrue($someFile->open());
$this->assertFalse($someFile->executable()); $this->assertFalse($someFile->executable());
$someFile->close(); $someFile->close();
@ -291,7 +291,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testLastAccess() { function testLastAccess() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertFalse($someFile->lastAccess()); $this->assertFalse($someFile->lastAccess());
$this->assertTrue($someFile->open()); $this->assertTrue($someFile->open());
$this->assertEqual($someFile->lastAccess(), time()); $this->assertEqual($someFile->lastAccess(), time());
@ -305,7 +305,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
function testLastChange() { function testLastChange() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile =& new File(TMP . 'some_file.txt', false);
$this->assertFalse($someFile->lastChange()); $this->assertFalse($someFile->lastChange());
$this->assertTrue($someFile->open('r+')); $this->assertTrue($someFile->open('r+'));
$this->assertEqual($someFile->lastChange(), time()); $this->assertEqual($someFile->lastChange(), time());
@ -328,7 +328,7 @@ class FileTest extends CakeTestCase {
unlink($tmpFile); unlink($tmpFile);
} }
$TmpFile = new File($tmpFile); $TmpFile =& new File($tmpFile);
$this->assertFalse(file_exists($tmpFile)); $this->assertFalse(file_exists($tmpFile));
$this->assertFalse(is_resource($TmpFile->handle)); $this->assertFalse(is_resource($TmpFile->handle));
@ -358,7 +358,7 @@ class FileTest extends CakeTestCase {
unlink($tmpFile); unlink($tmpFile);
} }
$TmpFile = new File($tmpFile); $TmpFile =& new File($tmpFile);
$this->assertFalse(file_exists($tmpFile)); $this->assertFalse(file_exists($tmpFile));
$fragments = array('CakePHP\'s', ' test suite', ' was here ...', ''); $fragments = array('CakePHP\'s', ' test suite', ' was here ...', '');
@ -386,13 +386,13 @@ class FileTest extends CakeTestCase {
if (!file_exists($tmpFile)) { if (!file_exists($tmpFile)) {
touch($tmpFile); touch($tmpFile);
} }
$TmpFile = new File($tmpFile); $TmpFile =& new File($tmpFile);
$this->assertTrue(file_exists($tmpFile)); $this->assertTrue(file_exists($tmpFile));
$result = $TmpFile->delete(); $result = $TmpFile->delete();
$this->assertTrue($result); $this->assertTrue($result);
$this->assertFalse(file_exists($tmpFile)); $this->assertFalse(file_exists($tmpFile));
$TmpFile = new File('/this/does/not/exist'); $TmpFile =& new File('/this/does/not/exist');
$result = $TmpFile->delete(); $result = $TmpFile->delete();
$this->assertFalse($result); $this->assertFalse($result);
} }

View file

@ -40,7 +40,7 @@ class FolderTest extends CakeTestCase {
*/ */
function testBasic() { function testBasic() {
$path = dirname(__FILE__); $path = dirname(__FILE__);
$Folder = new Folder($path); $Folder =& new Folder($path);
$result = $Folder->pwd(); $result = $Folder->pwd();
$this->assertEqual($result, $path); $this->assertEqual($result, $path);
@ -66,7 +66,7 @@ class FolderTest extends CakeTestCase {
$path = dirname(dirname(__FILE__)); $path = dirname(dirname(__FILE__));
$inside = dirname($path) . DS; $inside = dirname($path) . DS;
$Folder = new Folder($path); $Folder =& new Folder($path);
$result = $Folder->pwd(); $result = $Folder->pwd();
$this->assertEqual($result, $path); $this->assertEqual($result, $path);
@ -91,7 +91,7 @@ class FolderTest extends CakeTestCase {
*/ */
function testOperations() { function testOperations() {
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel'; $path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel';
$Folder = new Folder($path); $Folder =& new Folder($path);
$result = is_dir($Folder->pwd()); $result = is_dir($Folder->pwd());
$this->assertTrue($result); $this->assertTrue($result);
@ -150,7 +150,7 @@ class FolderTest extends CakeTestCase {
$result = $Folder->delete(); $result = $Folder->delete();
$this->assertTrue($result); $this->assertTrue($result);
$Folder = new Folder('non-existent'); $Folder =& new Folder('non-existent');
$result = $Folder->pwd(); $result = $Folder->pwd();
$this->assertNull($result); $this->assertNull($result);
} }
@ -164,7 +164,7 @@ class FolderTest extends CakeTestCase {
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Folder permissions tests not supported on Windows'); $this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Folder permissions tests not supported on Windows');
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel'; $path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel';
$Folder = new Folder($path); $Folder =& new Folder($path);
$subdir = 'test_folder_new'; $subdir = 'test_folder_new';
$new = TMP . $subdir; $new = TMP . $subdir;
@ -174,7 +174,7 @@ class FolderTest extends CakeTestCase {
$this->assertTrue($Folder->create($new . DS . 'test2')); $this->assertTrue($Folder->create($new . DS . 'test2'));
$filePath = $new . DS . 'test1.php'; $filePath = $new . DS . 'test1.php';
$File = new File($filePath); $File =& new File($filePath);
$this->assertTrue($File->create()); $this->assertTrue($File->create());
$copy = TMP . 'test_folder_copy'; $copy = TMP . 'test_folder_copy';
@ -200,7 +200,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testZeroAsDirectory() { function testZeroAsDirectory() {
$Folder = new Folder(TMP); $Folder =& new Folder(TMP);
$new = TMP . '0'; $new = TMP . '0';
$this->assertTrue($Folder->create($new)); $this->assertTrue($Folder->create($new));
@ -222,7 +222,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFolderRead() { function testFolderRead() {
$Folder = new Folder(TMP); $Folder =& new Folder(TMP);
$expected = array('cache', 'logs', 'sessions', 'tests'); $expected = array('cache', 'logs', 'sessions', 'tests');
$result = $Folder->read(true, true); $result = $Folder->read(true, true);
@ -240,7 +240,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFolderTree() { function testFolderTree() {
$Folder = new Folder(); $Folder =& new Folder();
$expected = array( $expected = array(
array( array(
TEST_CAKE_CORE_INCLUDE_PATH . 'config', TEST_CAKE_CORE_INCLUDE_PATH . 'config',
@ -380,7 +380,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testInCakePath() { function testInCakePath() {
$Folder = new Folder(); $Folder =& new Folder();
$Folder->cd(ROOT); $Folder->cd(ROOT);
$path = 'C:\\path\\to\\file'; $path = 'C:\\path\\to\\file';
$result = $Folder->inCakePath($path); $result = $Folder->inCakePath($path);
@ -404,7 +404,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFind() { function testFind() {
$Folder = new Folder(); $Folder =& new Folder();
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config'); $Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');
$result = $Folder->find(); $result = $Folder->find();
$expected = array('config.php', 'paths.php'); $expected = array('config.php', 'paths.php');
@ -456,7 +456,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testFindRecursive() { function testFindRecursive() {
$Folder = new Folder(); $Folder =& new Folder();
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH); $Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH);
$result = $Folder->findRecursive('(config|paths)\.php'); $result = $Folder->findRecursive('(config|paths)\.php');
$expected = array( $expected = array(
@ -476,7 +476,7 @@ class FolderTest extends CakeTestCase {
$Folder->cd(TMP); $Folder->cd(TMP);
$Folder->mkdir($Folder->pwd() . DS . 'testme'); $Folder->mkdir($Folder->pwd() . DS . 'testme');
$Folder->cd('testme'); $Folder->cd('testme');
$File = new File($Folder->pwd() . DS . 'paths.php'); $File =& new File($Folder->pwd() . DS . 'paths.php');
$File->create(); $File->create();
$Folder->cd(TMP . 'sessions'); $Folder->cd(TMP . 'sessions');
$result = $Folder->findRecursive('paths\.php'); $result = $Folder->findRecursive('paths\.php');
@ -484,7 +484,7 @@ class FolderTest extends CakeTestCase {
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
$Folder->cd(TMP . 'testme'); $Folder->cd(TMP . 'testme');
$File = new File($Folder->pwd() . DS . 'my.php'); $File =& new File($Folder->pwd() . DS . 'my.php');
$File->create(); $File->create();
$Folder->cd($Folder->pwd() . '/../..'); $Folder->cd($Folder->pwd() . '/../..');
@ -515,7 +515,7 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testConstructWithNonExistantPath() { function testConstructWithNonExistantPath() {
$Folder = new Folder(TMP . 'config_non_existant', true); $Folder =& new Folder(TMP . 'config_non_existant', true);
$this->assertTrue(is_dir(TMP . 'config_non_existant')); $this->assertTrue(is_dir(TMP . 'config_non_existant'));
$Folder->cd(TMP); $Folder->cd(TMP);
$Folder->delete($Folder->pwd() . 'config_non_existant'); $Folder->delete($Folder->pwd() . 'config_non_existant');
@ -527,10 +527,10 @@ class FolderTest extends CakeTestCase {
* @return void * @return void
*/ */
function testDirSize() { function testDirSize() {
$Folder = new Folder(TMP . 'config_non_existant', true); $Folder =& new Folder(TMP . 'config_non_existant', true);
$this->assertEqual($Folder->dirSize(), 0); $this->assertEqual($Folder->dirSize(), 0);
$File = new File($Folder->pwd() . DS . 'my.php', true, 0777); $File =& new File($Folder->pwd() . DS . 'my.php', true, 0777);
$File->create(); $File->create();
$File->write('something here'); $File->write('something here');
$File->close(); $File->close();
@ -547,7 +547,7 @@ class FolderTest extends CakeTestCase {
*/ */
function testDelete() { function testDelete() {
$path = TMP . 'folder_delete_test'; $path = TMP . 'folder_delete_test';
$Folder = new Folder($path, true); $Folder =& new Folder($path, true);
touch(TMP . 'folder_delete_test' . DS . 'file1'); touch(TMP . 'folder_delete_test' . DS . 'file1');
touch(TMP . 'folder_delete_test' . DS . 'file2'); touch(TMP . 'folder_delete_test' . DS . 'file2');
@ -593,35 +593,35 @@ class FolderTest extends CakeTestCase {
touch($file1); touch($file1);
touch($file2); touch($file2);
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->copy($folder3); $result = $Folder->copy($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php')); $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
$Folder = new Folder($folder3); $Folder =& new Folder($folder3);
$Folder->delete(); $Folder->delete();
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->copy($folder3); $result = $Folder->copy($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php')); $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
$Folder = new Folder($folder3); $Folder =& new Folder($folder3);
$Folder->delete(); $Folder->delete();
new Folder($folder3, true); new Folder($folder3, true);
new Folder($folder3 . DS . 'folder2', true); new Folder($folder3 . DS . 'folder2', true);
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched'); file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->copy($folder3); $result = $Folder->copy($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
$this->assertEqual(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched'); $this->assertEqual(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched');
$Folder = new Folder($path); $Folder =& new Folder($path);
$Folder->delete(); $Folder->delete();
} }
/** /**
@ -651,7 +651,7 @@ class FolderTest extends CakeTestCase {
touch($file1); touch($file1);
touch($file2); touch($file2);
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->move($folder3); $result = $Folder->move($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
@ -661,7 +661,7 @@ class FolderTest extends CakeTestCase {
$this->assertFalse(file_exists($folder2)); $this->assertFalse(file_exists($folder2));
$this->assertFalse(file_exists($file2)); $this->assertFalse(file_exists($file2));
$Folder = new Folder($folder3); $Folder =& new Folder($folder3);
$Folder->delete(); $Folder->delete();
new Folder($folder1, true); new Folder($folder1, true);
@ -669,7 +669,7 @@ class FolderTest extends CakeTestCase {
touch($file1); touch($file1);
touch($file2); touch($file2);
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->move($folder3); $result = $Folder->move($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
@ -679,7 +679,7 @@ class FolderTest extends CakeTestCase {
$this->assertFalse(file_exists($folder2)); $this->assertFalse(file_exists($folder2));
$this->assertFalse(file_exists($file2)); $this->assertFalse(file_exists($file2));
$Folder = new Folder($folder3); $Folder =& new Folder($folder3);
$Folder->delete(); $Folder->delete();
new Folder($folder1, true); new Folder($folder1, true);
@ -690,7 +690,7 @@ class FolderTest extends CakeTestCase {
touch($file2); touch($file2);
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched'); file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
$Folder = new Folder($folder1); $Folder =& new Folder($folder1);
$result = $Folder->move($folder3); $result = $Folder->move($folder3);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
@ -699,7 +699,7 @@ class FolderTest extends CakeTestCase {
$this->assertFalse(file_exists($folder2)); $this->assertFalse(file_exists($folder2));
$this->assertFalse(file_exists($file2)); $this->assertFalse(file_exists($file2));
$Folder = new Folder($path); $Folder =& new Folder($path);
$Folder->delete(); $Folder->delete();
} }
} }

View file

@ -58,8 +58,8 @@ class HttpSocketTest extends CakeTestCase {
Mock::generatePartial('HttpSocket', 'TestHttpSocketRequests', array('read', 'write', 'connect', 'request')); Mock::generatePartial('HttpSocket', 'TestHttpSocketRequests', array('read', 'write', 'connect', 'request'));
} }
$this->Socket = new TestHttpSocket(); $this->Socket =& new TestHttpSocket();
$this->RequestSocket = new TestHttpSocketRequests(); $this->RequestSocket =& new TestHttpSocketRequests();
} }
/** /**
* We use this function to clean up after the test case was executed * We use this function to clean up after the test case was executed

View file

@ -39,7 +39,7 @@ class L10nTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGet() { function testGet() {
$l10n = new L10n(); $l10n =& new L10n();
// Catalog Entry // Catalog Entry
$l10n->get('en'); $l10n->get('en');
@ -124,7 +124,7 @@ class L10nTest extends CakeTestCase {
$__SERVER = $_SERVER; $__SERVER = $_SERVER;
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
$l10n = new L10n(); $l10n =& new L10n();
$l10n->get(); $l10n->get();
$result = $l10n->language; $result = $l10n->language;
$expected = 'English (Canadian)'; $expected = 'English (Canadian)';
@ -175,7 +175,7 @@ class L10nTest extends CakeTestCase {
* @return void * @return void
*/ */
function testMap() { function testMap() {
$l10n = new L10n(); $l10n =& new L10n();
$result = $l10n->map(array('afr', 'af')); $result = $l10n->map(array('afr', 'af'));
$expected = array('afr' => 'af', 'af' => 'afr'); $expected = array('afr' => 'af', 'af' => 'afr');
@ -496,7 +496,7 @@ class L10nTest extends CakeTestCase {
* @return void * @return void
*/ */
function testCatalog() { function testCatalog() {
$l10n = new L10n(); $l10n =& new L10n();
$result = $l10n->catalog(array('af')); $result = $l10n->catalog(array('af'));
$expected = array( $expected = array(

View file

@ -43,7 +43,7 @@ class MagicDbTest extends UnitTestCase {
* @access public * @access public
*/ */
function setUp() { function setUp() {
$this->Db = new MagicDb(); $this->Db =& new MagicDb();
} }
/** /**
* MagicDb::analyze should properly detect the file type and output additional info as requested. * MagicDb::analyze should properly detect the file type and output additional info as requested.
@ -158,7 +158,7 @@ class MagicDbTest extends UnitTestCase {
* @package cake * @package cake
* @subpackage cake.tests.cases.libs * @subpackage cake.tests.cases.libs
*/ */
class MagicDbTestData extends CakeObject { class MagicDbTestData extends Object {
/** /**
* Base64 encoded data * Base64 encoded data
* *

View file

@ -983,7 +983,7 @@ class BehaviorTest extends CakeTestCase {
* @return void * @return void
*/ */
function testBehaviorTrigger() { function testBehaviorTrigger() {
$Apple = new Apple(); $Apple =& new Apple();
$Apple->Behaviors->attach('Test'); $Apple->Behaviors->attach('Test');
$Apple->Behaviors->attach('Test2'); $Apple->Behaviors->attach('Test2');
$Apple->Behaviors->attach('Test3'); $Apple->Behaviors->attach('Test3');
@ -1057,7 +1057,7 @@ class BehaviorTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testBehaviorAttachAndDetach() { function testBehaviorAttachAndDetach() {
$Sample = new Sample(); $Sample =& new Sample();
$Sample->actsAs = array('Test3' => array('bar'), 'Test2' => array('foo', 'bar')); $Sample->actsAs = array('Test3' => array('bar'), 'Test2' => array('foo', 'bar'));
$Sample->Behaviors->init($Sample->alias, $Sample->actsAs); $Sample->Behaviors->init($Sample->alias, $Sample->actsAs);
$Sample->Behaviors->attach('Test2'); $Sample->Behaviors->attach('Test2');

View file

@ -210,8 +210,8 @@ class AclBehaviorTestCase extends CakeTestCase {
function startTest() { function startTest() {
Configure::write('Acl.database', 'test_suite'); Configure::write('Acl.database', 'test_suite');
$this->Aco = new Aco(); $this->Aco =& new Aco();
$this->Aro = new Aro(); $this->Aro =& new Aro();
} }
/** /**
* tearDown method * tearDown method
@ -230,12 +230,12 @@ class AclBehaviorTestCase extends CakeTestCase {
* @access public * @access public
*/ */
function testSetup() { function testSetup() {
$User = new AclUser(); $User =& new AclUser();
$this->assertTrue(isset($User->Behaviors->Acl->settings['User'])); $this->assertTrue(isset($User->Behaviors->Acl->settings['User']));
$this->assertEqual($User->Behaviors->Acl->settings['User']['type'], 'requester'); $this->assertEqual($User->Behaviors->Acl->settings['User']['type'], 'requester');
$this->assertTrue(is_object($User->Aro)); $this->assertTrue(is_object($User->Aro));
$Post = new AclPost(); $Post =& new AclPost();
$this->assertTrue(isset($Post->Behaviors->Acl->settings['Post'])); $this->assertTrue(isset($Post->Behaviors->Acl->settings['Post']));
$this->assertEqual($Post->Behaviors->Acl->settings['Post']['type'], 'controlled'); $this->assertEqual($Post->Behaviors->Acl->settings['Post']['type'], 'controlled');
$this->assertTrue(is_object($Post->Aco)); $this->assertTrue(is_object($Post->Aco));
@ -247,7 +247,7 @@ class AclBehaviorTestCase extends CakeTestCase {
* @access public * @access public
*/ */
function testAfterSave() { function testAfterSave() {
$Post = new AclPost(); $Post =& new AclPost();
$data = array( $data = array(
'Post' => array( 'Post' => array(
'author_id' => 1, 'author_id' => 1,
@ -271,7 +271,7 @@ class AclBehaviorTestCase extends CakeTestCase {
); );
$this->Aro->save($aroData); $this->Aro->save($aroData);
$Person = new AclPerson(); $Person =& new AclPerson();
$data = array( $data = array(
'AclPerson' => array( 'AclPerson' => array(
'name' => 'Trent', 'name' => 'Trent',
@ -304,7 +304,7 @@ class AclBehaviorTestCase extends CakeTestCase {
) )
); );
$this->Aro->save($aroData); $this->Aro->save($aroData);
$Person = new AclPerson(); $Person =& new AclPerson();
$data = array( $data = array(
'AclPerson' => array( 'AclPerson' => array(
'name' => 'Trent', 'name' => 'Trent',
@ -349,7 +349,7 @@ class AclBehaviorTestCase extends CakeTestCase {
* @access public * @access public
*/ */
function testNode() { function testNode() {
$Person = new AclPerson(); $Person =& new AclPerson();
$aroData = array( $aroData = array(
'Aro' => array( 'Aro' => array(
'model' => 'AclPerson', 'model' => 'AclPerson',

View file

@ -3123,7 +3123,7 @@ class ContainableBehaviorTest extends CakeTestCase {
* @return void * @return void
*/ */
function testPaginate() { function testPaginate() {
$Controller = new Controller(); $Controller =& new Controller();
$Controller->uses = array('Article'); $Controller->uses = array('Article');
$Controller->passedArgs[] = '1'; $Controller->passedArgs[] = '1';
$Controller->params['url'] = array(); $Controller->params['url'] = array();

View file

@ -70,22 +70,22 @@ class TranslateBehaviorTest extends CakeTestCase {
* @return void * @return void
*/ */
function testTranslateModel() { function testTranslateModel() {
$TestModel = new Tag(); $TestModel =& new Tag();
$TestModel->translateTable = 'another_i18n'; $TestModel->translateTable = 'another_i18n';
$TestModel->Behaviors->attach('Translate', array('title')); $TestModel->Behaviors->attach('Translate', array('title'));
$this->assertEqual($TestModel->translateModel()->name, 'I18nModel'); $this->assertEqual($TestModel->translateModel()->name, 'I18nModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'another_i18n'); $this->assertEqual($TestModel->translateModel()->useTable, 'another_i18n');
$TestModel = new User(); $TestModel =& new User();
$TestModel->Behaviors->attach('Translate', array('title')); $TestModel->Behaviors->attach('Translate', array('title'));
$this->assertEqual($TestModel->translateModel()->name, 'I18nModel'); $this->assertEqual($TestModel->translateModel()->name, 'I18nModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'i18n'); $this->assertEqual($TestModel->translateModel()->useTable, 'i18n');
$TestModel = new TranslatedArticle(); $TestModel =& new TranslatedArticle();
$this->assertEqual($TestModel->translateModel()->name, 'TranslateArticleModel'); $this->assertEqual($TestModel->translateModel()->name, 'TranslateArticleModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'article_i18n'); $this->assertEqual($TestModel->translateModel()->useTable, 'article_i18n');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$this->assertEqual($TestModel->translateModel()->name, 'TranslateTestModel'); $this->assertEqual($TestModel->translateModel()->name, 'TranslateTestModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'i18n'); $this->assertEqual($TestModel->translateModel()->useTable, 'i18n');
} }
@ -98,7 +98,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleFalsePlain() { function testLocaleFalsePlain() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = false; $TestModel->locale = false;
$result = $TestModel->read(null, 1); $result = $TestModel->read(null, 1);
@ -122,7 +122,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleFalseAssociations() { function testLocaleFalseAssociations() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = false; $TestModel->locale = false;
$TestModel->unbindTranslation(); $TestModel->unbindTranslation();
$translations = array('title' => 'Title', 'content' => 'Content'); $translations = array('title' => 'Title', 'content' => 'Content');
@ -176,7 +176,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleSingle() { function testLocaleSingle() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$result = $TestModel->read(null, 1); $result = $TestModel->read(null, 1);
$expected = array( $expected = array(
@ -231,7 +231,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleSingleWithConditions() { function testLocaleSingleWithConditions() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated'))); $result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated')));
$expected = array( $expected = array(
@ -270,7 +270,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleSingleAssociations() { function testLocaleSingleAssociations() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$TestModel->unbindTranslation(); $TestModel->unbindTranslation();
$translations = array('title' => 'Title', 'content' => 'Content'); $translations = array('title' => 'Title', 'content' => 'Content');
@ -330,7 +330,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testLocaleMultiple() { function testLocaleMultiple() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = array('deu', 'eng', 'cze'); $TestModel->locale = array('deu', 'eng', 'cze');
$delete = array( $delete = array(
array('locale' => 'deu'), array('locale' => 'deu'),
@ -393,7 +393,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testMissingTranslation() { function testMissingTranslation() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'rus'; $TestModel->locale = 'rus';
$result = $TestModel->read(null, 1); $result = $TestModel->read(null, 1);
$this->assertFalse($result); $this->assertFalse($result);
@ -420,7 +420,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testTranslatedFindList() { function testTranslatedFindList() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'deu'; $TestModel->locale = 'deu';
$TestModel->displayField = 'title'; $TestModel->displayField = 'title';
$result = $TestModel->find('list', array('recursive' => 1)); $result = $TestModel->find('list', array('recursive' => 1));
@ -453,7 +453,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testReadSelectedFields() { function testReadSelectedFields() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$result = $TestModel->find('all', array('fields' => array('slug', 'TranslatedItem.content'))); $result = $TestModel->find('all', array('fields' => array('slug', 'TranslatedItem.content')));
$expected = array( $expected = array(
@ -488,7 +488,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testSaveCreate() { function testSaveCreate() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'spa'; $TestModel->locale = 'spa';
$data = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4', 'content' => 'Contenido #4'); $data = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4', 'content' => 'Contenido #4');
$TestModel->create($data); $TestModel->create($data);
@ -506,7 +506,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testSaveUpdate() { function testSaveUpdate() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'spa'; $TestModel->locale = 'spa';
$oldData = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4'); $oldData = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4');
$TestModel->create($oldData); $TestModel->create($oldData);
@ -528,7 +528,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testMultipleCreate() { function testMultipleCreate() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'deu'; $TestModel->locale = 'deu';
$data = array( $data = array(
'slug' => 'new_translated', 'slug' => 'new_translated',
@ -566,7 +566,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testMultipleUpdate() { function testMultipleUpdate() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$TestModel->validate['title'] = 'notEmpty'; $TestModel->validate['title'] = 'notEmpty';
$data = array('TranslatedItem' => array( $data = array('TranslatedItem' => array(
@ -608,7 +608,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testMixedCreateUpdateWithArrayLocale() { function testMixedCreateUpdateWithArrayLocale() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = array('cze', 'deu'); $TestModel->locale = array('cze', 'deu');
$data = array('TranslatedItem' => array( $data = array('TranslatedItem' => array(
'id' => 1, 'id' => 1,
@ -647,7 +647,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testValidation() { function testValidation() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$TestModel->validate['title'] = '/Only this title/'; $TestModel->validate['title'] = '/Only this title/';
$data = array('TranslatedItem' => array( $data = array('TranslatedItem' => array(
@ -678,7 +678,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testAttachDetach() { function testAttachDetach() {
$this->loadFixtures('Translate', 'TranslatedItem'); $this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(); $TestModel =& new TranslatedItem();
$Behavior =& $this->Model->Behaviors->Translate; $Behavior =& $this->Model->Behaviors->Translate;
$TestModel->unbindTranslation(); $TestModel->unbindTranslation();
@ -728,7 +728,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testAnotherTranslateTable() { function testAnotherTranslateTable() {
$this->loadFixtures('Translate', 'TranslatedItem', 'TranslateTable'); $this->loadFixtures('Translate', 'TranslatedItem', 'TranslateTable');
$TestModel = new TranslatedItemWithTable(); $TestModel =& new TranslatedItemWithTable();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$result = $TestModel->read(null, 1); $result = $TestModel->read(null, 1);
$expected = array( $expected = array(
@ -751,7 +751,7 @@ class TranslateBehaviorTest extends CakeTestCase {
function testTranslateWithAssociations() { function testTranslateWithAssociations() {
$this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User', 'Comment', 'ArticlesTag', 'Tag'); $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User', 'Comment', 'ArticlesTag', 'Tag');
$TestModel = new TranslatedArticle(); $TestModel =& new TranslatedArticle();
$TestModel->locale = 'eng'; $TestModel->locale = 'eng';
$recursive = $TestModel->recursive; $recursive = $TestModel->recursive;

View file

@ -60,7 +60,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testInitialize() { function testInitialize() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->find('count'); $result = $this->Tree->find('count');
@ -77,7 +77,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectInvalidLeft() { function testDetectInvalidLeft() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -103,7 +103,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectInvalidRight() { function testDetectInvalidRight() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -129,7 +129,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectInvalidParent() { function testDetectInvalidParent() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -154,7 +154,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectNoneExistantParent() { function testDetectNoneExistantParent() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -177,7 +177,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRecoverFromMissingParent() { function testRecoverFromMissingParent() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -200,7 +200,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectInvalidParents() { function testDetectInvalidParents() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->updateAll(array($parentField => null)); $this->Tree->updateAll(array($parentField => null));
@ -222,7 +222,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectInvalidLftsRghts() { function testDetectInvalidLftsRghts() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->updateAll(array($leftField => 0, $rightField => 0)); $this->Tree->updateAll(array($leftField => 0, $rightField => 0));
@ -243,7 +243,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDetectEqualLftsRghts() { function testDetectEqualLftsRghts() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 3); $this->Tree->initialize(1, 3);
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -270,7 +270,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testAddOrphan() { function testAddOrphan() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null))); $this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null)));
@ -289,7 +289,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testAddMiddle() { function testAddMiddle() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data= $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); $data= $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
@ -322,7 +322,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testAddInvalid() { function testAddInvalid() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -346,7 +346,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testAddNotIndexedByModel() { function testAddNotIndexedByModel() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null)); $this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null));
@ -365,7 +365,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMovePromote() { function testMovePromote() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -391,7 +391,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveWithWhitelist() { function testMoveWithWhitelist() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -418,7 +418,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testInsertWithWhitelist() { function testInsertWithWhitelist() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->whitelist = array('name', $parentField); $this->Tree->whitelist = array('name', $parentField);
@ -436,7 +436,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveBefore() { function testMoveBefore() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -464,7 +464,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveAfter() { function testMoveAfter() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -492,7 +492,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveDemoteInvalid() { function testMoveDemoteInvalid() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -525,7 +525,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveInvalid() { function testMoveInvalid() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -551,7 +551,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveSelfInvalid() { function testMoveSelfInvalid() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -577,7 +577,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveUpSuccess() { function testMoveUpSuccess() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.2'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.2'), array('id'));
@ -598,7 +598,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveUpFail() { function testMoveUpFail() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.1')); $data = $this->Tree->find(array($modelClass . '.name' => '1.1'));
@ -620,7 +620,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveUp2() { function testMoveUp2() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 10); $this->Tree->initialize(1, 10);
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
@ -650,7 +650,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveUpFirst() { function testMoveUpFirst() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 10); $this->Tree->initialize(1, 10);
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
@ -680,7 +680,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveDownSuccess() { function testMoveDownSuccess() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
@ -701,7 +701,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveDownFail() { function testMoveDownFail() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.2')); $data = $this->Tree->find(array($modelClass . '.name' => '1.2'));
@ -722,7 +722,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveDownLast() { function testMoveDownLast() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 10); $this->Tree->initialize(1, 10);
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
@ -752,7 +752,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveDown2() { function testMoveDown2() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 10); $this->Tree->initialize(1, 10);
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
@ -782,7 +782,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testSaveNoMove() { function testSaveNoMove() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 10); $this->Tree->initialize(1, 10);
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
@ -812,7 +812,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testMoveToRootAndMoveUp() { function testMoveToRootAndMoveUp() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(1, 1); $this->Tree->initialize(1, 1);
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); $data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
$this->Tree->id = $data[$modelClass]['id']; $this->Tree->id = $data[$modelClass]['id'];
@ -836,7 +836,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testDelete() { function testDelete() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -871,7 +871,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRemove() { function testRemove() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
$result = $this->Tree->findByName('1.1'); $result = $this->Tree->findByName('1.1');
@ -903,7 +903,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRemoveLastTopParent() { function testRemoveLastTopParent() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -936,7 +936,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRemoveNoChildren() { function testRemoveNoChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -970,7 +970,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRemoveAndDelete() { function testRemoveAndDelete() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -1002,7 +1002,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testRemoveAndDeleteNoChildren() { function testRemoveAndDeleteNoChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -1034,7 +1034,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testChildren() { function testChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
@ -1062,7 +1062,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testCountChildren() { function testCountChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
@ -1082,7 +1082,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testGetParentNode() { function testGetParentNode() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2')); $data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
@ -1100,7 +1100,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testGetPath() { function testGetPath() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2')); $data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
@ -1120,7 +1120,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testNoAmbiguousColumn() { function testNoAmbiguousColumn() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->bindModel(array('belongsTo' => array('Dummy' => $this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
@ -1152,7 +1152,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testReorderTree() { function testReorderTree() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(3, 3); $this->Tree->initialize(3, 3);
$nodes = $this->Tree->find('list', array('order' => $leftField)); $nodes = $this->Tree->find('list', array('order' => $leftField));
@ -1180,7 +1180,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testGenerateTreeListWithSelfJoin() { function testGenerateTreeListWithSelfJoin() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->bindModel(array('belongsTo' => array('Dummy' => $this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
@ -1197,7 +1197,7 @@ class NumberTreeTest extends CakeTestCase {
*/ */
function testArraySyntax() { function testArraySyntax() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(3, 3); $this->Tree->initialize(3, 3);
$this->assertIdentical($this->Tree->childCount(2), $this->Tree->childCount(array('id' => 2))); $this->assertIdentical($this->Tree->childCount(2), $this->Tree->childCount(array('id' => 2)));
$this->assertIdentical($this->Tree->getParentNode(2), $this->Tree->getParentNode(array('id' => 2))); $this->assertIdentical($this->Tree->getParentNode(2), $this->Tree->getParentNode(array('id' => 2)));
@ -1237,7 +1237,7 @@ class ScopedTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testStringScope() { function testStringScope() {
$this->Tree = new FlagTree(); $this->Tree =& new FlagTree();
$this->Tree->initialize(2, 3); $this->Tree->initialize(2, 3);
$this->Tree->id = 1; $this->Tree->id = 1;
@ -1273,7 +1273,7 @@ class ScopedTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testArrayScope() { function testArrayScope() {
$this->Tree = new FlagTree(); $this->Tree =& new FlagTree();
$this->Tree->initialize(2, 3); $this->Tree->initialize(2, 3);
$this->Tree->id = 1; $this->Tree->id = 1;
@ -1309,7 +1309,7 @@ class ScopedTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testMoveUpWithScope() { function testMoveUpWithScope() {
$this->Ad = new Ad(); $this->Ad =& new Ad();
$this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign')); $this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign'));
$this->Ad->moveUp(6); $this->Ad->moveUp(6);
@ -1325,7 +1325,7 @@ class ScopedTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testMoveDownWithScope() { function testMoveDownWithScope() {
$this->Ad = new Ad(); $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->moveDown(6);
@ -1342,7 +1342,7 @@ class ScopedTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testTranslatingTree() { function testTranslatingTree() {
$this->Tree = new FlagTree(); $this->Tree =& new FlagTree();
$this->Tree->cacheQueries = false; $this->Tree->cacheQueries = false;
$this->Tree->translateModel = 'TranslateTreeTestModel'; $this->Tree->translateModel = 'TranslateTreeTestModel';
$this->Tree->Behaviors->attach('Translate', array('name')); $this->Tree->Behaviors->attach('Translate', array('name'));
@ -1441,10 +1441,10 @@ class ScopedTreeTest extends NumberTreeTest {
*/ */
function testAliasesWithScopeInTwoTreeAssociations() { function testAliasesWithScopeInTwoTreeAssociations() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->TreeTwo = new NumberTreeTwo(); $this->TreeTwo =& new NumberTreeTwo();
$record = $this->Tree->find('first'); $record = $this->Tree->find('first');
@ -1522,7 +1522,7 @@ class AfterTreeTest extends NumberTreeTest {
* @return void * @return void
*/ */
function testAftersaveCallback() { function testAftersaveCallback() {
$this->Tree = new AfterTree(); $this->Tree =& new AfterTree();
$expected = array('AfterTree' => array('name' => 'Six and One Half Changed in AfterTree::afterSave() but not in database', 'parent_id' => 6, 'lft' => 11, 'rght' => 12)); $expected = array('AfterTree' => array('name' => 'Six and One Half Changed in AfterTree::afterSave() but not in database', 'parent_id' => 6, 'lft' => 11, 'rght' => 12));
$result = $this->Tree->save(array('AfterTree' => array('name' => 'Six and One Half', 'parent_id' => 6))); $result = $this->Tree->save(array('AfterTree' => array('name' => 'Six and One Half', 'parent_id' => 6)));
@ -1594,7 +1594,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testMovePromote() { function testMovePromote() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -1620,7 +1620,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testMoveWithWhitelist() { function testMoveWithWhitelist() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$this->Tree->id = null; $this->Tree->id = null;
@ -1647,7 +1647,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testRemoveNoChildren() { function testRemoveNoChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -1681,7 +1681,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testRemoveAndDeleteNoChildren() { function testRemoveAndDeleteNoChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$initialCount = $this->Tree->find('count'); $initialCount = $this->Tree->find('count');
@ -1713,7 +1713,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testChildren() { function testChildren() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
@ -1741,7 +1741,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testNoAmbiguousColumn() { function testNoAmbiguousColumn() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->bindModel(array('belongsTo' => array('Dummy' => $this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);
@ -1773,7 +1773,7 @@ class UuidTreeTest extends NumberTreeTest {
*/ */
function testGenerateTreeListWithSelfJoin() { function testGenerateTreeListWithSelfJoin() {
extract($this->settings); extract($this->settings);
$this->Tree = new $modelClass(); $this->Tree =& new $modelClass();
$this->Tree->bindModel(array('belongsTo' => array('Dummy' => $this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
$this->Tree->initialize(2, 2); $this->Tree->initialize(2, 2);

View file

@ -371,7 +371,7 @@ class DboMysqlTest extends CakeTestCase {
function testIndexOnMySQL4Output() { function testIndexOnMySQL4Output() {
$name = $this->db->fullTableName('simple'); $name = $this->db->fullTableName('simple');
$mockDbo = new QueryMockDboMysql($this); $mockDbo =& new QueryMockDboMysql($this);
$columnData = array( $columnData = array(
array('0' => array( array('0' => array(
'Table' => 'with_compound_keys', 'Table' => 'with_compound_keys',
@ -512,7 +512,7 @@ class DboMysqlTest extends CakeTestCase {
App::import('Core', 'Schema'); App::import('Core', 'Schema');
$this->db->cacheSources = $this->db->testing = false; $this->db->cacheSources = $this->db->testing = false;
$schema1 = new CakeSchema(array( $schema1 =& new CakeSchema(array(
'name' => 'AlterTest1', 'name' => 'AlterTest1',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(
@ -523,7 +523,7 @@ class DboMysqlTest extends CakeTestCase {
))); )));
$this->db->query($this->db->createSchema($schema1)); $this->db->query($this->db->createSchema($schema1));
$schema2 = new CakeSchema(array( $schema2 =& new CakeSchema(array(
'name' => 'AlterTest2', 'name' => 'AlterTest2',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(
@ -543,7 +543,7 @@ class DboMysqlTest extends CakeTestCase {
$this->assertEqual($schema2->tables['altertest']['indexes'], $indexes); $this->assertEqual($schema2->tables['altertest']['indexes'], $indexes);
// Change three indexes, delete one and add another one // Change three indexes, delete one and add another one
$schema3 = new CakeSchema(array( $schema3 =& new CakeSchema(array(
'name' => 'AlterTest3', 'name' => 'AlterTest3',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(

View file

@ -103,7 +103,7 @@ class DboOracleTest extends CakeTestCase {
*/ */
function testName() { function testName() {
$Db = $this->db; $Db = $this->db;
#$Db = new DboOracle($config = null, $autoConnect = false); #$Db =& new DboOracle($config = null, $autoConnect = false);
$r = $Db->name($Db->name($Db->name('foo.last_update_date'))); $r = $Db->name($Db->name($Db->name('foo.last_update_date')));
$e = 'foo.last_update_date'; $e = 'foo.last_update_date';

View file

@ -415,7 +415,7 @@ class DboPostgresTest extends CakeTestCase {
ªºnh˚ºO^∏…®[Ó“ÅfıÌ≥∫F!(π∑T6`¬tΩÆ0ì»rTÎ`»Ñ« ªºnh˚ºO^∏…®[Ó“ÅfıÌ≥∫F!(π∑T6`¬tΩÆ0ì»rTÎ`»Ñ«
]≈åp˝)=¿Ô0∆öVÂmˇˆ„ø~¯ÁÔ∏b*fc»‡Îı„Ú}∆tœs∂Y∫ÜaÆ˙X∏~<ÿ·Ù vé1p¿TD∆ÔîÄ“úhˆ*Ú€îe)K p¨ÚJ3Ÿ∞ã>ÊuNê°“√Ü Ê9iÙ0˙AAEÍ ˙`∂£\'ûce•åƒXŸÁ´1SK{qdá"tÏ[wQ#SµBe∞∑µó…ÌV`B"Ñ≥„!è_Óφ-ºú¿Ë0ˆeê∂´ë+HFj…‡zvHÓN|ÔL÷ûñ3õÜ$z%sá…pÎóV38âs Çoµ•ß3†<9B·¨û~¢3)ÂxóÿÁCÕòÆ ∫Í=»ÿSπS;∆~±êÆTEp∑óÈ÷ÀuìDHÈ $ÉõæÜjû§"≤ÃONM®RËíRr{õS ∏Ê™op±W;ÂUÔP∫kÔˇflTæ∑óflË” ÆC©Ô[≥◊HÁ˚¨hê"ÆbF?ú%h˙ˇ4xèÕ(ó2ÙáíM])Ñd|=fë-cI0ñL¢kÖêk‰Rƒ«ıÄWñ8mO3∏&√æËX¯Hó—ì]yF2»˜ádàà‡‹Çο„≥7mªHAS∑¶.;Œx(1}_kd©.fidç48M\áªCp^Krí<ɉXÓıïl!Ì$N<ı∞B»G]…∂Ó¯>˛ÔbõÒπÀ•:ôO<j∂™œ%âÏ—>@È$pÖuÊ´-QqV ?V≥JÆÍqÛX8(lπï@zgÖ}Fe<ˇ‡Sñ“ÿ˜ê?6‡L∫Oß~µ?ËeäÚ®YîÕ =¢DÁu*GvBk;)L¬N«î:flö∂≠ÇΩq„Ñm하Ë"û≥§:±≤i^ΩÑ!)Wıyŧôá„RÄ÷Òôc≠—s™rıPdêãh˘ßHVç5fifiÈF€çÌÛuçÖ/M=µ±ÿGû1coÔuñæ.õ∑7ÉÏÜÆ,°H†ÍÉÌ∂7e º® íˆ◊øNWK”ÂYµñé;µ¶gV->µtË¥áßN2 ¯¶BaP-)eW.àôt^∏1C∑Ö?L„&”54jvãªZ ÷+4% ´0l…»ú^°´© ûiπ∑é®óܱÒÿ‰ïˆÌdˆ◊Æ19rQ=Í|ı•rMæ¬;ò‰Y‰é9. ˝V«ã¯∏,+ë®j*¡·/'; ]≈åp˝)=¿Ô0∆öVÂmˇˆ„ø~¯ÁÔ∏b*fc»‡Îı„Ú}∆tœs∂Y∫ÜaÆ˙X∏~<ÿ·Ù vé1p¿TD∆ÔîÄ“úhˆ*Ú€îe)K p¨ÚJ3Ÿ∞ã>ÊuNê°“√Ü Ê9iÙ0˙AAEÍ ˙`∂£\'ûce•åƒXŸÁ´1SK{qdá"tÏ[wQ#SµBe∞∑µó…ÌV`B"Ñ≥„!è_Óφ-ºú¿Ë0ˆeê∂´ë+HFj…‡zvHÓN|ÔL÷ûñ3õÜ$z%sá…pÎóV38âs Çoµ•ß3†<9B·¨û~¢3)ÂxóÿÁCÕòÆ ∫Í=»ÿSπS;∆~±êÆTEp∑óÈ÷ÀuìDHÈ $ÉõæÜjû§"≤ÃONM®RËíRr{õS ∏Ê™op±W;ÂUÔP∫kÔˇflTæ∑óflË” ÆC©Ô[≥◊HÁ˚¨hê"ÆbF?ú%h˙ˇ4xèÕ(ó2ÙáíM])Ñd|=fë-cI0ñL¢kÖêk‰Rƒ«ıÄWñ8mO3∏&√æËX¯Hó—ì]yF2»˜ádàà‡‹Çο„≥7mªHAS∑¶.;Œx(1}_kd©.fidç48M\áªCp^Krí<ɉXÓıïl!Ì$N<ı∞B»G]…∂Ó¯>˛ÔbõÒπÀ•:ôO<j∂™œ%âÏ—>@È$pÖuÊ´-QqV ?V≥JÆÍqÛX8(lπï@zgÖ}Fe<ˇ‡Sñ“ÿ˜ê?6‡L∫Oß~µ?ËeäÚ®YîÕ =¢DÁu*GvBk;)L¬N«î:flö∂≠ÇΩq„Ñm하Ë"û≥§:±≤i^ΩÑ!)Wıyŧôá„RÄ÷Òôc≠—s™rıPdêãh˘ßHVç5fifiÈF€çÌÛuçÖ/M=µ±ÿGû1coÔuñæ.õ∑7ÉÏÜÆ,°H†ÍÉÌ∂7e º® íˆ◊øNWK”ÂYµñé;µ¶gV->µtË¥áßN2 ¯¶BaP-)eW.àôt^∏1C∑Ö?L„&”54jvãªZ ÷+4% ´0l…»ú^°´© ûiπ∑é®óܱÒÿ‰ïˆÌdˆ◊Æ19rQ=Í|ı•rMæ¬;ò‰Y‰é9. ˝V«ã¯∏,+ë®j*¡·/';
$model = new AppModel(array('name' => 'BinaryTest', 'ds' => 'test_suite')); $model =& new AppModel(array('name' => 'BinaryTest', 'ds' => 'test_suite'));
$model->save(compact('data')); $model->save(compact('data'));
$result = $model->find('first'); $result = $model->find('first');
@ -528,7 +528,7 @@ class DboPostgresTest extends CakeTestCase {
* @return void * @return void
*/ */
function testAlterSchema() { function testAlterSchema() {
$Old = new CakeSchema(array( $Old =& new CakeSchema(array(
'connection' => 'test_suite', 'connection' => 'test_suite',
'name' => 'AlterPosts', 'name' => 'AlterPosts',
'alter_posts' => array( 'alter_posts' => array(
@ -543,7 +543,7 @@ class DboPostgresTest extends CakeTestCase {
)); ));
$this->db->query($this->db->createSchema($Old)); $this->db->query($this->db->createSchema($Old));
$New = new CakeSchema(array( $New =& new CakeSchema(array(
'connection' => 'test_suite', 'connection' => 'test_suite',
'name' => 'AlterPosts', 'name' => 'AlterPosts',
'alter_posts' => array( 'alter_posts' => array(
@ -575,7 +575,7 @@ class DboPostgresTest extends CakeTestCase {
function testAlterIndexes() { function testAlterIndexes() {
$this->db->cacheSources = false; $this->db->cacheSources = false;
$schema1 = new CakeSchema(array( $schema1 =& new CakeSchema(array(
'name' => 'AlterTest1', 'name' => 'AlterTest1',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(
@ -587,7 +587,7 @@ class DboPostgresTest extends CakeTestCase {
)); ));
$this->db->query($this->db->createSchema($schema1)); $this->db->query($this->db->createSchema($schema1));
$schema2 = new CakeSchema(array( $schema2 =& new CakeSchema(array(
'name' => 'AlterTest2', 'name' => 'AlterTest2',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(
@ -609,7 +609,7 @@ class DboPostgresTest extends CakeTestCase {
$this->assertEqual($schema2->tables['altertest']['indexes'], $indexes); $this->assertEqual($schema2->tables['altertest']['indexes'], $indexes);
// Change three indexes, delete one and add another one // Change three indexes, delete one and add another one
$schema3 = new CakeSchema(array( $schema3 =& new CakeSchema(array(
'name' => 'AlterTest3', 'name' => 'AlterTest3',
'connection' => 'test_suite', 'connection' => 'test_suite',
'altertest' => array( 'altertest' => array(

View file

@ -210,7 +210,7 @@ class DboSqliteTest extends CakeTestCase {
* @return void * @return void
**/ **/
function testDescribe() { function testDescribe() {
$Model = new Model(array('name' => 'User', 'ds' => 'test_suite', 'table' => 'users')); $Model =& new Model(array('name' => 'User', 'ds' => 'test_suite', 'table' => 'users'));
$result = $this->db->describe($Model); $result = $this->db->describe($Model);
$expected = array( $expected = array(
'id' => array( 'id' => array(
@ -256,7 +256,7 @@ class DboSqliteTest extends CakeTestCase {
function testDescribeWithUuidPrimaryKey() { function testDescribeWithUuidPrimaryKey() {
$tableName = 'uuid_tests'; $tableName = 'uuid_tests';
$this->db->query("CREATE TABLE {$tableName} (id VARCHAR(36) PRIMARY KEY, name VARCHAR, created DATETIME, modified DATETIME)"); $this->db->query("CREATE TABLE {$tableName} (id VARCHAR(36) PRIMARY KEY, name VARCHAR, created DATETIME, modified DATETIME)");
$Model = new Model(array('name' => 'UuidTest', 'ds' => 'test_suite', 'table' => 'uuid_tests')); $Model =& new Model(array('name' => 'UuidTest', 'ds' => 'test_suite', 'table' => 'uuid_tests'));
$result = $this->db->describe($Model); $result = $this->db->describe($Model);
$expected = array( $expected = array(
'type' => 'string', 'type' => 'string',

View file

@ -1209,13 +1209,13 @@ 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->startQuote = '`';
$this->testDb->endQuote = '`'; $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();
} }
/** /**
* endTest method * endTest method
@ -1239,7 +1239,7 @@ class DboSourceTest extends CakeTestCase {
$test =& ConnectionManager::create('quoteTest', $config); $test =& ConnectionManager::create('quoteTest', $config);
$test->simulated = array(); $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');
$this->assertEqual($this->Model->escapeField(), '`Article`.`id`'); $this->assertEqual($this->Model->escapeField(), '`Article`.`id`');
@ -1277,11 +1277,11 @@ class DboSourceTest extends CakeTestCase {
*/ */
function testGenerateAssociationQuerySelfJoin() { function testGenerateAssociationQuerySelfJoin() {
$this->startTime = microtime(true); $this->startTime = microtime(true);
$this->Model = new Article2(); $this->Model =& new Article2();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
$this->_buildRelatedModels($this->Model->Category2); $this->_buildRelatedModels($this->Model->Category2);
$this->Model->Category2->ChildCat = new Category2(); $this->Model->Category2->ChildCat =& new Category2();
$this->Model->Category2->ParentCat = new Category2(); $this->Model->Category2->ParentCat =& new Category2();
$queryData = array(); $queryData = array();
@ -1305,7 +1305,7 @@ class DboSourceTest extends CakeTestCase {
$query = $this->testDb->generateAssociationQuery($this->Model->Category2, $null, null, null, null, $queryData, false, $null); $query = $this->testDb->generateAssociationQuery($this->Model->Category2, $null, null, null, null, $queryData, false, $null);
$this->assertPattern('/^SELECT\s+(.+)FROM(.+)`Category2`\.`group_id`\s+=\s+`Group`\.`id`\)\s+LEFT JOIN(.+)WHERE\s+1 = 1\s*$/', $query); $this->assertPattern('/^SELECT\s+(.+)FROM(.+)`Category2`\.`group_id`\s+=\s+`Group`\.`id`\)\s+LEFT JOIN(.+)WHERE\s+1 = 1\s*$/', $query);
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1366,10 +1366,10 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateInnerJoinAssociationQuery() { function testGenerateInnerJoinAssociationQuery() {
$this->Model = new TestModel9(); $this->Model =& new TestModel9();
$test =& ConnectionManager::create('test2', $this->__config); $test =& ConnectionManager::create('test2', $this->__config);
$this->Model->setDataSource('test2'); $this->Model->setDataSource('test2');
$this->Model->TestModel8 = new TestModel8(); $this->Model->TestModel8 =& new TestModel8();
$this->Model->TestModel8->setDataSource('test2'); $this->Model->TestModel8->setDataSource('test2');
$this->testDb->read($this->Model, array('recursive' => 1)); $this->testDb->read($this->Model, array('recursive' => 1));
@ -1389,7 +1389,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBinding() { function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBinding() {
$this->Model = new TestModel8(); $this->Model =& new TestModel8();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1416,7 +1416,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBinding() { function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBinding() {
$this->Model = new TestModel9(); $this->Model =& new TestModel9();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1442,7 +1442,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQuerySelfJoinWithConditions() { function testGenerateAssociationQuerySelfJoinWithConditions() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1462,7 +1462,7 @@ class DboSourceTest extends CakeTestCase {
$this->assertPattern('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result); $this->assertPattern('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE/', $result);
$this->assertPattern('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); $this->assertPattern('/\s+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result);
$this->Featured2 = new Featured2(); $this->Featured2 =& new Featured2();
$this->Featured2->schema(); $this->Featured2->schema();
$this->Featured2->bindModel(array( $this->Featured2->bindModel(array(
@ -1503,7 +1503,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasOne() { function testGenerateAssociationQueryHasOne() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1535,7 +1535,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasOneWithConditions() { function testGenerateAssociationQueryHasOneWithConditions() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1564,7 +1564,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryBelongsTo() { function testGenerateAssociationQueryBelongsTo() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1595,7 +1595,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryBelongsToWithConditions() { function testGenerateAssociationQueryBelongsToWithConditions() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1626,7 +1626,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasMany() { function testGenerateAssociationQueryHasMany() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1655,7 +1655,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasManyWithLimit() { function testGenerateAssociationQueryHasManyWithLimit() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1694,7 +1694,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasManyWithConditions() { function testGenerateAssociationQueryHasManyWithConditions() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1722,7 +1722,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasManyWithOffsetAndLimit() { function testGenerateAssociationQueryHasManyWithOffsetAndLimit() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1759,7 +1759,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasManyWithPageAndLimit() { function testGenerateAssociationQueryHasManyWithPageAndLimit() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1795,7 +1795,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasManyWithFields() { function testGenerateAssociationQueryHasManyWithFields() {
$this->Model = new TestModel5(); $this->Model =& new TestModel5();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1920,7 +1920,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasAndBelongsToMany() { function testGenerateAssociationQueryHasAndBelongsToMany() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1950,7 +1950,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasAndBelongsToManyWithConditions() { function testGenerateAssociationQueryHasAndBelongsToManyWithConditions() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -1978,7 +1978,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimit() { function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimit() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -2014,7 +2014,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit() { function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit() {
$this->Model = new TestModel4(); $this->Model =& new TestModel4();
$this->Model->schema(); $this->Model->schema();
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
@ -2058,7 +2058,7 @@ class DboSourceTest extends CakeTestCase {
} elseif (isset($assocData['className'])) { } elseif (isset($assocData['className'])) {
$className = $assocData['className']; $className = $assocData['className'];
} }
$model->$className = new $className(); $model->$className =& new $className();
$model->$className->schema(); $model->$className->schema();
} }
} }
@ -2631,7 +2631,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testConditionsWithModel() { function testConditionsWithModel() {
$this->Model = new Article2(); $this->Model =& new Article2();
$result = $this->testDb->conditions(array('Article2.viewed >=' => 0), true, true, $this->Model); $result = $this->testDb->conditions(array('Article2.viewed >=' => 0), true, true, $this->Model);
$expected = " WHERE `Article2`.`viewed` >= 0"; $expected = " WHERE `Article2`.`viewed` >= 0";
@ -3128,7 +3128,7 @@ class DboSourceTest extends CakeTestCase {
* @return void * @return void
*/ */
function testSchema() { function testSchema() {
$Schema = new CakeSchema(); $Schema =& new CakeSchema();
$Schema->tables = array('table' => array(), 'anotherTable' => array()); $Schema->tables = array('table' => array(), 'anotherTable' => array());
$this->expectError(); $this->expectError();

View file

@ -224,10 +224,10 @@ class DbAclTest extends DbAcl {
* @return void * @return void
*/ */
function __construct() { function __construct() {
$this->Aro = new DbAroTest(); $this->Aro =& new DbAroTest();
$this->Aro->Permission = new DbPermissionTest(); $this->Aro->Permission =& new DbPermissionTest();
$this->Aco = new DbAcoTest(); $this->Aco =& new DbAcoTest();
$this->Aro->Permission = new DbPermissionTest(); $this->Aro->Permission =& new DbPermissionTest();
} }
} }
/** /**

View file

@ -42,7 +42,7 @@ class ModelDeleteTest extends BaseModelTest {
function testDeleteHabtmReferenceWithConditions() { function testDeleteHabtmReferenceWithConditions() {
$this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio'); $this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio');
$Portfolio = new Portfolio(); $Portfolio =& new Portfolio();
$Portfolio->hasAndBelongsToMany['Item']['conditions'] = array('ItemsPortfolio.item_id >' => 1); $Portfolio->hasAndBelongsToMany['Item']['conditions'] = array('ItemsPortfolio.item_id >' => 1);
$result = $Portfolio->find('first', array( $result = $Portfolio->find('first', array(
@ -131,7 +131,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testDeleteArticleBLinks() { function testDeleteArticleBLinks() {
$this->loadFixtures('Article', 'ArticlesTag', 'Tag'); $this->loadFixtures('Article', 'ArticlesTag', 'Tag');
$TestModel = new ArticleB(); $TestModel =& new ArticleB();
$result = $TestModel->ArticlesTag->find('all'); $result = $TestModel->ArticlesTag->find('all');
$expected = array( $expected = array(
@ -160,8 +160,8 @@ class ModelDeleteTest extends BaseModelTest {
function testDeleteDependentWithConditions() { function testDeleteDependentWithConditions() {
$this->loadFixtures('Cd','Book','OverallFavorite'); $this->loadFixtures('Cd','Book','OverallFavorite');
$Cd = new Cd(); $Cd =& new Cd();
$OverallFavorite = new OverallFavorite(); $OverallFavorite =& new OverallFavorite();
$Cd->del(1); $Cd->del(1);
@ -187,7 +187,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testDel() { function testDel() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->del(2); $result = $TestModel->del(2);
$this->assertTrue($result); $this->assertTrue($result);
@ -232,7 +232,7 @@ class ModelDeleteTest extends BaseModelTest {
// 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');
$Uuid = new Uuid(); $Uuid =& new Uuid();
$data = array( $data = array(
'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3', 'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3',
'52C8865C-10EE-4302-AE6C-6E7D8E12E2C8', '52C8865C-10EE-4302-AE6C-6E7D8E12E2C8',
@ -266,7 +266,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testDeleteAll() { function testDeleteAll() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$TestModel = new Article(); $TestModel =& new Article();
$data = array('Article' => array( $data = array('Article' => array(
'user_id' => 2, 'user_id' => 2,
@ -407,7 +407,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testRecursiveDel() { function testRecursiveDel() {
$this->loadFixtures('Article', 'Comment', 'Attachment'); $this->loadFixtures('Article', 'Comment', 'Attachment');
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->del(2); $result = $TestModel->del(2);
$this->assertTrue($result); $this->assertTrue($result);
@ -442,7 +442,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testDependentExclusiveDelete() { function testDependentExclusiveDelete() {
$this->loadFixtures('Article', 'Comment'); $this->loadFixtures('Article', 'Comment');
$TestModel = new Article10(); $TestModel =& new Article10();
$result = $TestModel->find('all'); $result = $TestModel->find('all');
$this->assertEqual(count($result[0]['Comment']), 4); $this->assertEqual(count($result[0]['Comment']), 4);
@ -460,7 +460,7 @@ class ModelDeleteTest extends BaseModelTest {
*/ */
function testDeleteLinks() { function testDeleteLinks() {
$this->loadFixtures('Article', 'ArticlesTag', 'Tag'); $this->loadFixtures('Article', 'ArticlesTag', 'Tag');
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->ArticlesTag->find('all'); $result = $TestModel->ArticlesTag->find('all');
$expected = array( $expected = array(
@ -508,7 +508,7 @@ class ModelDeleteTest extends BaseModelTest {
function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() { function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies'); $this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
$ThePaper = new ThePaper(); $ThePaper =& new ThePaper();
$ThePaper->id = 1; $ThePaper->id = 1;
$ThePaper->save(array('Monkey' => array(2, 3))); $ThePaper->save(array('Monkey' => array(2, 3)));
@ -528,7 +528,7 @@ class ModelDeleteTest extends BaseModelTest {
)); ));
$this->assertEqual($result['Monkey'], $expected); $this->assertEqual($result['Monkey'], $expected);
$ThePaper = new ThePaper(); $ThePaper =& new ThePaper();
$ThePaper->id = 2; $ThePaper->id = 2;
$ThePaper->save(array('Monkey' => array(2, 3))); $ThePaper->save(array('Monkey' => array(2, 3)));

View file

@ -42,7 +42,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testPkInHabtmLinkModelArticleB() { function testPkInHabtmLinkModelArticleB() {
$this->loadFixtures('Article', 'Tag'); $this->loadFixtures('Article', 'Tag');
$TestModel2 = new ArticleB(); $TestModel2 =& new ArticleB();
$this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id'); $this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id');
} }
/** /**
@ -73,22 +73,22 @@ class ModelIntegrationTest extends BaseModelTest {
function testPkInHabtmLinkModel() { function testPkInHabtmLinkModel() {
//Test Nonconformant Models //Test Nonconformant Models
$this->loadFixtures('Content', 'ContentAccount', 'Account'); $this->loadFixtures('Content', 'ContentAccount', 'Account');
$TestModel = new Content(); $TestModel =& new Content();
$this->assertEqual($TestModel->ContentAccount->primaryKey, 'iContentAccountsId'); $this->assertEqual($TestModel->ContentAccount->primaryKey, 'iContentAccountsId');
//test conformant models with no PK in the join table //test conformant models with no PK in the join table
$this->loadFixtures('Article', 'Tag'); $this->loadFixtures('Article', 'Tag');
$TestModel2 = new Article(); $TestModel2 =& new Article();
$this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id'); $this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id');
//test conformant models with PK in join table //test conformant models with PK in join table
$this->loadFixtures('Item', 'Portfolio', 'ItemsPortfolio'); $this->loadFixtures('Item', 'Portfolio', 'ItemsPortfolio');
$TestModel3 = new Portfolio(); $TestModel3 =& new Portfolio();
$this->assertEqual($TestModel3->ItemsPortfolio->primaryKey, 'id'); $this->assertEqual($TestModel3->ItemsPortfolio->primaryKey, 'id');
//test conformant models with PK in join table - join table contains extra field //test conformant models with PK in join table - join table contains extra field
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB'); $this->loadFixtures('JoinA', 'JoinB', 'JoinAB');
$TestModel4 = new JoinA(); $TestModel4 =& new JoinA();
$this->assertEqual($TestModel4->JoinAsJoinB->primaryKey, 'id'); $this->assertEqual($TestModel4->JoinAsJoinB->primaryKey, 'id');
} }
@ -100,7 +100,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testDynamicBehaviorAttachment() { function testDynamicBehaviorAttachment() {
$this->loadFixtures('Apple'); $this->loadFixtures('Apple');
$TestModel = new Apple(); $TestModel =& new Apple();
$this->assertEqual($TestModel->Behaviors->attached(), array()); $this->assertEqual($TestModel->Behaviors->attached(), array());
$TestModel->Behaviors->attach('Tree', array('left' => 'left_field', 'right' => 'right_field')); $TestModel->Behaviors->attach('Tree', array('left' => 'left_field', 'right' => 'right_field'));
@ -148,7 +148,7 @@ class ModelIntegrationTest extends BaseModelTest {
} }
$this->loadFixtures('Article', 'Tag', 'ArticlesTag', 'User', 'Comment'); $this->loadFixtures('Article', 'Tag', 'ArticlesTag', 'User', 'Comment');
$TestModel = new Article(); $TestModel =& new Article();
$expected = array( $expected = array(
array( array(
@ -535,7 +535,7 @@ class ModelIntegrationTest extends BaseModelTest {
**/ **/
function testDeconstructFieldsTime() { function testDeconstructFieldsTime() {
$this->loadFixtures('Apple'); $this->loadFixtures('Apple');
$TestModel = new Apple(); $TestModel =& new Apple();
$data = array(); $data = array();
$data['Apple']['mytime']['hour'] = ''; $data['Apple']['mytime']['hour'] = '';
@ -621,7 +621,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testDeconstructFieldsDateTime() { function testDeconstructFieldsDateTime() {
$this->loadFixtures('Apple'); $this->loadFixtures('Apple');
$TestModel = new Apple(); $TestModel =& new Apple();
//test null/empty values first //test null/empty values first
$data['Apple']['created']['year'] = ''; $data['Apple']['created']['year'] = '';
@ -849,7 +849,7 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testInvalidAssociation() { function testInvalidAssociation() {
$TestModel = new ValidationTest1(); $TestModel =& new ValidationTest1();
$this->assertNull($TestModel->getAssociated('Foo')); $this->assertNull($TestModel->getAssociated('Foo'));
} }
/** /**
@ -875,7 +875,7 @@ class ModelIntegrationTest extends BaseModelTest {
**/ **/
function testResetOfExistsOnCreate() { function testResetOfExistsOnCreate() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$Article = new Article(); $Article =& new Article();
$Article->id = 1; $Article->id = 1;
$Article->saveField('title', 'Reset me'); $Article->saveField('title', 'Reset me');
$Article->delete(); $Article->delete();
@ -897,7 +897,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testPluginAssociations() { function testPluginAssociations() {
$this->loadFixtures('TestPluginArticle', 'User', 'TestPluginComment'); $this->loadFixtures('TestPluginArticle', 'User', 'TestPluginComment');
$TestModel = new TestPluginArticle(); $TestModel =& new TestPluginArticle();
$result = $TestModel->find('all'); $result = $TestModel->find('all');
$expected = array( $expected = array(
@ -1063,7 +1063,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testAutoConstructAssociations() { function testAutoConstructAssociations() {
$this->loadFixtures('User', 'ArticleFeatured'); $this->loadFixtures('User', 'ArticleFeatured');
$TestModel = new AssociationTest1(); $TestModel =& new AssociationTest1();
$result = $TestModel->hasAndBelongsToMany; $result = $TestModel->hasAndBelongsToMany;
$expected = array('AssociationTest2' => array( $expected = array('AssociationTest2' => array(
@ -1079,8 +1079,8 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
// Tests related to ticket https://trac.cakephp.org/ticket/5594 // Tests related to ticket https://trac.cakephp.org/ticket/5594
$TestModel = new ArticleFeatured(); $TestModel =& new ArticleFeatured();
$TestFakeModel = new ArticleFeatured(array('table' => false)); $TestFakeModel =& new ArticleFeatured(array('table' => false));
$expected = array( $expected = array(
'User' => array( 'User' => array(
@ -1195,7 +1195,7 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertEqual('test_suite', $TestModel->useDbConfig); $this->assertEqual('test_suite', $TestModel->useDbConfig);
//deprecated but test it anyway //deprecated but test it anyway
$NewVoid = new TheVoid(null, false, 'other'); $NewVoid =& new TheVoid(null, false, 'other');
$this->assertEqual('other', $NewVoid->useDbConfig); $this->assertEqual('other', $NewVoid->useDbConfig);
} }
/** /**
@ -1205,13 +1205,13 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testColumnTypeFetching() { function testColumnTypeFetching() {
$model = new Test(); $model =& new Test();
$this->assertEqual($model->getColumnType('id'), 'integer'); $this->assertEqual($model->getColumnType('id'), 'integer');
$this->assertEqual($model->getColumnType('notes'), 'text'); $this->assertEqual($model->getColumnType('notes'), 'text');
$this->assertEqual($model->getColumnType('updated'), 'datetime'); $this->assertEqual($model->getColumnType('updated'), 'datetime');
$this->assertEqual($model->getColumnType('unknown'), null); $this->assertEqual($model->getColumnType('unknown'), null);
$model = new Article(); $model =& new Article();
$this->assertEqual($model->getColumnType('User.created'), 'datetime'); $this->assertEqual($model->getColumnType('User.created'), 'datetime');
$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');
@ -1223,7 +1223,7 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testHabtmUniqueKey() { function testHabtmUniqueKey() {
$model = new Item(); $model =& new Item();
$this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']); $this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']);
} }
/** /**
@ -1233,17 +1233,17 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testIdentity() { function testIdentity() {
$TestModel = new Test(); $TestModel =& new Test();
$result = $TestModel->alias; $result = $TestModel->alias;
$expected = 'Test'; $expected = 'Test';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new TestAlias(); $TestModel =& new TestAlias();
$result = $TestModel->alias; $result = $TestModel->alias;
$expected = 'TestAlias'; $expected = 'TestAlias';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new Test(array('alias' => 'AnotherTest')); $TestModel =& new Test(array('alias' => 'AnotherTest'));
$result = $TestModel->alias; $result = $TestModel->alias;
$expected = 'AnotherTest'; $expected = 'AnotherTest';
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
@ -1256,7 +1256,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testWithAssociation() { function testWithAssociation() {
$this->loadFixtures('Something', 'SomethingElse', 'JoinThing'); $this->loadFixtures('Something', 'SomethingElse', 'JoinThing');
$TestModel = new Something(); $TestModel =& new Something();
$result = $TestModel->SomethingElse->find('all'); $result = $TestModel->SomethingElse->find('all');
$expected = array( $expected = array(
@ -1508,7 +1508,7 @@ class ModelIntegrationTest extends BaseModelTest {
function testFindSelfAssociations() { function testFindSelfAssociations() {
$this->loadFixtures('Person'); $this->loadFixtures('Person');
$TestModel = new Person(); $TestModel =& new Person();
$TestModel->recursive = 2; $TestModel->recursive = 2;
$result = $TestModel->read(null, 1); $result = $TestModel->read(null, 1);
$expected = array( $expected = array(
@ -1616,7 +1616,7 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testDynamicAssociations() { function testDynamicAssociations() {
$this->loadFixtures('Article', 'Comment'); $this->loadFixtures('Article', 'Comment');
$TestModel = new Article(); $TestModel =& new Article();
$TestModel->belongsTo = $TestModel->hasAndBelongsToMany = $TestModel->hasOne = array(); $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = $TestModel->hasOne = array();
$TestModel->hasMany['Comment'] = array_merge($TestModel->hasMany['Comment'], array( $TestModel->hasMany['Comment'] = array_merge($TestModel->hasMany['Comment'], array(
@ -1723,11 +1723,11 @@ class ModelIntegrationTest extends BaseModelTest {
*/ */
function testCreation() { function testCreation() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$TestModel = new Test(); $TestModel =& new Test();
$result = $TestModel->create(); $result = $TestModel->create();
$expected = array('Test' => array('notes' => 'write some notes here')); $expected = array('Test' => array('notes' => 'write some notes here'));
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->schema(); $result = $TestModel->schema();
if (isset($this->db->columns['primary_key']['length'])) { if (isset($this->db->columns['primary_key']['length'])) {
@ -1777,12 +1777,12 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->create(); $result = $TestModel->create();
$expected = array('Article' => array('published' => 'N')); $expected = array('Article' => array('published' => 'N'));
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$FeaturedModel = new Featured(); $FeaturedModel =& new Featured();
$data = array( $data = array(
'article_featured_id' => 1, 'article_featured_id' => 1,
'category_id' => 1, 'category_id' => 1,

View file

@ -89,8 +89,8 @@ class ModelReadTest extends BaseModelTest {
} }
$this->loadFixtures('Project', 'Product', 'Thread', 'Message', 'Bid'); $this->loadFixtures('Project', 'Product', 'Thread', 'Message', 'Bid');
$Thread = new Thread(); $Thread =& new Thread();
$Product = new Product(); $Product =& new Product();
$result = $Thread->find('all', array( $result = $Thread->find('all', array(
'group' => 'Thread.project_id', 'group' => 'Thread.project_id',
@ -245,7 +245,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testOldQuery() { function testOldQuery() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$Article = new Article(); $Article =& new Article();
$query = 'SELECT title FROM '; $query = 'SELECT title FROM ';
$query .= $this->db->fullTableName('articles'); $query .= $this->db->fullTableName('articles');
@ -280,7 +280,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testPreparedQuery() { function testPreparedQuery() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$Article = new Article(); $Article =& new Article();
$this->db->_queryCache = array(); $this->db->_queryCache = array();
$finalQuery = 'SELECT title, published FROM '; $finalQuery = 'SELECT title, published FROM ';
@ -361,7 +361,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testParameterMismatch() { function testParameterMismatch() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$Article = new Article(); $Article =& new Article();
$query = 'SELECT * FROM ' . $this->db->fullTableName('articles'); $query = 'SELECT * FROM ' . $this->db->fullTableName('articles');
$query .= ' WHERE ' . $this->db->fullTableName('articles'); $query .= ' WHERE ' . $this->db->fullTableName('articles');
@ -389,7 +389,7 @@ class ModelReadTest extends BaseModelTest {
} }
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$Article = new Article(); $Article =& new Article();
$query = 'SELECT * FROM ? WHERE ? = ? AND ? = ?'; $query = 'SELECT * FROM ? WHERE ? = ? AND ? = ?';
$param = array( $param = array(
@ -411,7 +411,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testRecursiveUnbind() { function testRecursiveUnbind() {
$this->loadFixtures('Apple', 'Sample'); $this->loadFixtures('Apple', 'Sample');
$TestModel = new Apple(); $TestModel =& new Apple();
$TestModel->recursive = 2; $TestModel->recursive = 2;
$result = $TestModel->find('all'); $result = $TestModel->find('all');
@ -3032,7 +3032,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindAllThreaded() { function testFindAllThreaded() {
$this->loadFixtures('Category'); $this->loadFixtures('Category');
$TestModel = new Category(); $TestModel =& new Category();
$result = $TestModel->find('threaded'); $result = $TestModel->find('threaded');
$expected = array( $expected = array(
@ -3508,7 +3508,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindNeighbors() { function testFindNeighbors() {
$this->loadFixtures('User', 'Article'); $this->loadFixtures('User', 'Article');
$TestModel = new Article(); $TestModel =& new Article();
$TestModel->id = 1; $TestModel->id = 1;
$result = $TestModel->find('neighbors', array('fields' => array('id'))); $result = $TestModel->find('neighbors', array('fields' => array('id')));
@ -3664,7 +3664,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindNeighboursLegacy() { function testFindNeighboursLegacy() {
$this->loadFixtures('User', 'Article'); $this->loadFixtures('User', 'Article');
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->findNeighbours(null, 'Article.id', '2'); $result = $TestModel->findNeighbours(null, 'Article.id', '2');
$expected = array( $expected = array(
@ -3714,7 +3714,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindCombinedRelations() { function testFindCombinedRelations() {
$this->loadFixtures('Apple', 'Sample'); $this->loadFixtures('Apple', 'Sample');
$TestModel = new Apple(); $TestModel =& new Apple();
$result = $TestModel->find('all'); $result = $TestModel->find('all');
@ -3990,13 +3990,13 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testSaveEmpty() { function testSaveEmpty() {
$this->loadFixtures('Thread'); $this->loadFixtures('Thread');
$TestModel = new Thread(); $TestModel =& new Thread();
$data = array(); $data = array();
$expected = $TestModel->save($data); $expected = $TestModel->save($data);
$this->assertFalse($expected); $this->assertFalse($expected);
} }
// function testBasicValidation() { // function testBasicValidation() {
// $TestModel = new ValidationTest1(); // $TestModel =& new ValidationTest1();
// $TestModel->testing = true; // $TestModel->testing = true;
// $TestModel->set(array('title' => '', 'published' => 1)); // $TestModel->set(array('title' => '', 'published' => 1));
// $this->assertEqual($TestModel->invalidFields(), array('title' => 'This field cannot be left blank')); // $this->assertEqual($TestModel->invalidFields(), array('title' => 'This field cannot be left blank'));
@ -4020,7 +4020,7 @@ class ModelReadTest extends BaseModelTest {
function testFindAllWithConditionInChildQuery() { function testFindAllWithConditionInChildQuery() {
$this->loadFixtures('Basket', 'FilmFile'); $this->loadFixtures('Basket', 'FilmFile');
$TestModel = new Basket(); $TestModel =& new Basket();
$recursive = 3; $recursive = 3;
$result = $TestModel->find('all', compact('conditions', 'recursive')); $result = $TestModel->find('all', compact('conditions', 'recursive'));
@ -4063,7 +4063,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindAllWithConditionsHavingMixedDataTypes() { function testFindAllWithConditionsHavingMixedDataTypes() {
$this->loadFixtures('Article'); $this->loadFixtures('Article');
$TestModel = new Article(); $TestModel =& new Article();
$expected = array( $expected = array(
array( array(
'Article' => array( 'Article' => array(
@ -4143,7 +4143,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testBindUnbind() { function testBindUnbind() {
$this->loadFixtures('User', 'Comment', 'FeatureSet'); $this->loadFixtures('User', 'Comment', 'FeatureSet');
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->hasMany; $result = $TestModel->hasMany;
$expected = array(); $expected = array();
@ -4547,7 +4547,7 @@ class ModelReadTest extends BaseModelTest {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel2 = new DeviceType(); $TestModel2 =& new DeviceType();
$expected = array( $expected = array(
'className' => 'FeatureSet', 'className' => 'FeatureSet',
@ -4602,7 +4602,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testBindMultipleTimes() { function testBindMultipleTimes() {
$this->loadFixtures('User', 'Comment', 'Article'); $this->loadFixtures('User', 'Comment', 'Article');
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->hasMany; $result = $TestModel->hasMany;
$expected = array(); $expected = array();
@ -4790,7 +4790,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testAssociationAfterFind() { function testAssociationAfterFind() {
$this->loadFixtures('Post', 'Author', 'Comment'); $this->loadFixtures('Post', 'Author', 'Comment');
$TestModel = new Post(); $TestModel =& new Post();
$result = $TestModel->find('all'); $result = $TestModel->find('all');
$expected = array( $expected = array(
array( array(
@ -4850,7 +4850,7 @@ class ModelReadTest extends BaseModelTest {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
unset($TestModel); unset($TestModel);
$Author = new Author(); $Author =& new Author();
$Author->Post->bindModel(array( $Author->Post->bindModel(array(
'hasMany' => array( 'hasMany' => array(
'Comment' => array( 'Comment' => array(
@ -4917,7 +4917,7 @@ class ModelReadTest extends BaseModelTest {
'DocumentDirectory' 'DocumentDirectory'
); );
$DeviceType = new DeviceType(); $DeviceType =& new DeviceType();
$DeviceType->recursive = 2; $DeviceType->recursive = 2;
$result = $DeviceType->read(null, 1); $result = $DeviceType->read(null, 1);
@ -5006,7 +5006,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testHabtmRecursiveBelongsTo() { function testHabtmRecursiveBelongsTo() {
$this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio', 'Syfile', 'Image'); $this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio', 'Syfile', 'Image');
$Portfolio = new Portfolio(); $Portfolio =& new Portfolio();
$result = $Portfolio->find(array('id' => 2), null, null, 3); $result = $Portfolio->find(array('id' => 2), null, null, 3);
$expected = array( $expected = array(
@ -5064,7 +5064,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testHabtmFinderQuery() { function testHabtmFinderQuery() {
$this->loadFixtures('Article', 'Tag', 'ArticlesTag'); $this->loadFixtures('Article', 'Tag', 'ArticlesTag');
$Article = new Article(); $Article =& new Article();
$sql = $this->db->buildStatement( $sql = $this->db->buildStatement(
array( array(
@ -5112,7 +5112,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testHabtmLimitOptimization() { function testHabtmLimitOptimization() {
$this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'ArticlesTag'); $this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'ArticlesTag');
$TestModel = new Article(); $TestModel =& new Article();
$TestModel->hasAndBelongsToMany['Tag']['limit'] = 2; $TestModel->hasAndBelongsToMany['Tag']['limit'] = 2;
$result = $TestModel->read(null, 2); $result = $TestModel->read(null, 2);
@ -5182,7 +5182,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testHasManyLimitOptimization() { function testHasManyLimitOptimization() {
$this->loadFixtures('Project', 'Thread', 'Message', 'Bid'); $this->loadFixtures('Project', 'Thread', 'Message', 'Bid');
$Project = new Project(); $Project =& new Project();
$Project->recursive = 3; $Project->recursive = 3;
$result = $Project->find('all'); $result = $Project->find('all');
@ -5296,7 +5296,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindAllRecursiveSelfJoin() { function testFindAllRecursiveSelfJoin() {
$this->loadFixtures('Home', 'AnotherArticle', 'Advertisement'); $this->loadFixtures('Home', 'AnotherArticle', 'Advertisement');
$TestModel = new Home(); $TestModel =& new Home();
$TestModel->recursive = 2; $TestModel->recursive = 2;
$result = $TestModel->find('all'); $result = $TestModel->find('all');
@ -5412,7 +5412,7 @@ class ModelReadTest extends BaseModelTest {
'MyProduct' 'MyProduct'
); );
$MyUser = new MyUser(); $MyUser =& new MyUser();
$MyUser->recursive = 2; $MyUser->recursive = 2;
$result = $MyUser->find('all'); $result = $MyUser->find('all');
@ -5473,7 +5473,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testReadFakeThread() { function testReadFakeThread() {
$this->loadFixtures('CategoryThread'); $this->loadFixtures('CategoryThread');
$TestModel = new CategoryThread(); $TestModel =& new CategoryThread();
$fullDebug = $this->db->fullDebug; $fullDebug = $this->db->fullDebug;
$this->db->fullDebug = true; $this->db->fullDebug = true;
@ -5537,7 +5537,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindFakeThread() { function testFindFakeThread() {
$this->loadFixtures('CategoryThread'); $this->loadFixtures('CategoryThread');
$TestModel = new CategoryThread(); $TestModel =& new CategoryThread();
$fullDebug = $this->db->fullDebug; $fullDebug = $this->db->fullDebug;
$this->db->fullDebug = true; $this->db->fullDebug = true;
@ -5601,7 +5601,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindAllFakeThread() { function testFindAllFakeThread() {
$this->loadFixtures('CategoryThread'); $this->loadFixtures('CategoryThread');
$TestModel = new CategoryThread(); $TestModel =& new CategoryThread();
$fullDebug = $this->db->fullDebug; $fullDebug = $this->db->fullDebug;
$this->db->fullDebug = true; $this->db->fullDebug = true;
@ -5821,7 +5821,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testConditionalNumerics() { function testConditionalNumerics() {
$this->loadFixtures('NumericArticle'); $this->loadFixtures('NumericArticle');
$NumericArticle = new NumericArticle(); $NumericArticle =& new NumericArticle();
$data = array('title' => '12345abcde'); $data = array('title' => '12345abcde');
$result = $NumericArticle->find($data); $result = $NumericArticle->find($data);
$this->assertTrue(!empty($result)); $this->assertTrue(!empty($result));
@ -5839,7 +5839,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindAll() { function testFindAll() {
$this->loadFixtures('User'); $this->loadFixtures('User');
$TestModel = new User(); $TestModel =& new User();
$TestModel->cacheQueries = false; $TestModel->cacheQueries = false;
$result = $TestModel->find('all'); $result = $TestModel->find('all');
@ -6069,7 +6069,7 @@ class ModelReadTest extends BaseModelTest {
function testGenerateFindList() { function testGenerateFindList() {
$this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User'); $this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User');
$TestModel = new Article(); $TestModel =& new Article();
$TestModel->displayField = 'title'; $TestModel->displayField = 'title';
$result = $TestModel->find('list', array( $result = $TestModel->find('list', array(
@ -6204,7 +6204,7 @@ class ModelReadTest extends BaseModelTest {
)); ));
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new Apple(); $TestModel =& new Apple();
$expected = array( $expected = array(
1 => 'Red Apple 1', 1 => 'Red Apple 1',
2 => 'Bright Red Apple', 2 => 'Bright Red Apple',
@ -6218,7 +6218,7 @@ class ModelReadTest extends BaseModelTest {
$this->assertEqual($TestModel->find('list'), $expected); $this->assertEqual($TestModel->find('list'), $expected);
$this->assertEqual($TestModel->Parent->find('list'), $expected); $this->assertEqual($TestModel->Parent->find('list'), $expected);
$TestModel = new Post(); $TestModel =& new Post();
$result = $TestModel->find('list', array( $result = $TestModel->find('list', array(
'fields' => 'Post.title' 'fields' => 'Post.title'
)); ));
@ -6299,7 +6299,7 @@ class ModelReadTest extends BaseModelTest {
)); ));
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->find('list', array( $result = $TestModel->find('list', array(
'fields' => array('User.user', 'User.password') 'fields' => array('User.user', 'User.password')
)); ));
@ -6311,7 +6311,7 @@ class ModelReadTest extends BaseModelTest {
); );
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$TestModel = new ModifiedAuthor(); $TestModel =& new ModifiedAuthor();
$result = $TestModel->find('list', array( $result = $TestModel->find('list', array(
'fields' => array('Author.id', 'Author.user') 'fields' => array('Author.id', 'Author.user')
)); ));
@ -6331,7 +6331,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindField() { function testFindField() {
$this->loadFixtures('User'); $this->loadFixtures('User');
$TestModel = new User(); $TestModel =& new User();
$TestModel->id = 1; $TestModel->id = 1;
$result = $TestModel->field('user'); $result = $TestModel->field('user');
@ -6360,7 +6360,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindUnique() { function testFindUnique() {
$this->loadFixtures('User'); $this->loadFixtures('User');
$TestModel = new User(); $TestModel =& new User();
$this->assertFalse($TestModel->isUnique(array( $this->assertFalse($TestModel->isUnique(array(
'user' => 'nate' 'user' => 'nate'
@ -6383,7 +6383,7 @@ class ModelReadTest extends BaseModelTest {
function testFindCount() { function testFindCount() {
$this->loadFixtures('User', 'Project'); $this->loadFixtures('User', 'Project');
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->find('count'); $result = $TestModel->find('count');
$this->assertEqual($result, 4); $this->assertEqual($result, 4);
@ -6412,7 +6412,7 @@ class ModelReadTest extends BaseModelTest {
return; return;
} }
$this->loadFixtures('Project'); $this->loadFixtures('Project');
$TestModel = new Project(); $TestModel =& new Project();
$TestModel->create(array('name' => 'project')) && $TestModel->save(); $TestModel->create(array('name' => 'project')) && $TestModel->save();
$TestModel->create(array('name' => 'project')) && $TestModel->save(); $TestModel->create(array('name' => 'project')) && $TestModel->save();
$TestModel->create(array('name' => 'project')) && $TestModel->save(); $TestModel->create(array('name' => 'project')) && $TestModel->save();
@ -6432,7 +6432,7 @@ class ModelReadTest extends BaseModelTest {
} }
$this->loadFixtures('Project'); $this->loadFixtures('Project');
$db = ConnectionManager::getDataSource('test_suite'); $db = ConnectionManager::getDataSource('test_suite');
$TestModel = new Project(); $TestModel =& new Project();
$result = $TestModel->find('count', array('conditions' => array( $result = $TestModel->find('count', array('conditions' => array(
$db->expression('Project.name = \'Project 3\'') $db->expression('Project.name = \'Project 3\'')
@ -6452,7 +6452,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testFindMagic() { function testFindMagic() {
$this->loadFixtures('User'); $this->loadFixtures('User');
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->findByUser('mariano'); $result = $TestModel->findByUser('mariano');
$expected = array( $expected = array(
@ -6483,7 +6483,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testRead() { function testRead() {
$this->loadFixtures('User', 'Article'); $this->loadFixtures('User', 'Article');
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->read(); $result = $TestModel->read();
$this->assertFalse($result); $this->assertFalse($result);
@ -6571,7 +6571,7 @@ class ModelReadTest extends BaseModelTest {
'Featured', 'Featured',
'ArticleFeatured' 'ArticleFeatured'
); );
$TestModel = new User(); $TestModel =& new User();
$result = $TestModel->bindModel(array('hasMany' => array('Article')), false); $result = $TestModel->bindModel(array('hasMany' => array('Article')), false);
$this->assertTrue($result); $this->assertTrue($result);
@ -6683,7 +6683,7 @@ class ModelReadTest extends BaseModelTest {
'Featured', 'Featured',
'Category' 'Category'
); );
$TestModel = new Article(); $TestModel =& new Article();
$result = $TestModel->find('all', array('conditions' => array('Article.user_id' => 1))); $result = $TestModel->find('all', array('conditions' => array('Article.user_id' => 1)));
$expected = array( $expected = array(
@ -6989,7 +6989,7 @@ class ModelReadTest extends BaseModelTest {
*/ */
function testRecursiveFindAllWithLimit() { function testRecursiveFindAllWithLimit() {
$this->loadFixtures('Article', 'User', 'Tag', 'ArticlesTag', 'Comment', 'Attachment'); $this->loadFixtures('Article', 'User', 'Tag', 'ArticlesTag', 'Comment', 'Attachment');
$TestModel = new Article(); $TestModel =& new Article();
$TestModel->hasMany['Comment']['limit'] = 2; $TestModel->hasMany['Comment']['limit'] = 2;

View file

@ -40,7 +40,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testValidationParams() { function testValidationParams() {
$TestModel = new ValidationTest1(); $TestModel =& new ValidationTest1();
$TestModel->validate['title'] = array( $TestModel->validate['title'] = array(
'rule' => 'customValidatorWithParams', 'rule' => 'customValidatorWithParams',
'required' => true 'required' => true
@ -81,7 +81,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void * @return void
*/ */
function testInvalidFieldsWithFieldListParams() { function testInvalidFieldsWithFieldListParams() {
$TestModel = new ValidationTest1(); $TestModel =& new ValidationTest1();
$TestModel->validate = $validate = array( $TestModel->validate = $validate = array(
'title' => array( 'title' => array(
'rule' => 'customValidator', 'rule' => 'customValidator',

Some files were not shown because too many files have changed in this diff Show more