diff --git a/Dockerfile.ubuntu-php b/Dockerfile.ubuntu-php index e92fffd1..cb5d7837 100644 --- a/Dockerfile.ubuntu-php +++ b/Dockerfile.ubuntu-php @@ -65,12 +65,8 @@ RUN chown -R www-data:www-data /var/www/cmc-sales \ # Set working directory WORKDIR /var/www/cmc-sales -# Copy CakePHP core and application -COPY cake/ /var/www/cmc-sales/cake/ +# Copy application (will be overridden by volume mount) 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 80 diff --git a/app/.DS_Store b/app/.DS_Store deleted file mode 100644 index 9e09c8d1..00000000 Binary files a/app/.DS_Store and /dev/null differ diff --git a/app/config/database.php b/app/config/database.php index def0e908..56058f83 100644 --- a/app/config/database.php +++ b/app/config/database.php @@ -2,6 +2,8 @@ //CakePHP is pretty awful. I was so foolish. + + class DATABASE_CONFIG { var $default = array( @@ -13,19 +15,4 @@ class DATABASE_CONFIG { 'database' => 'cmc', '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' => '', - ); - } - } } diff --git a/app/config/database_stg.php b/app/config/database_stg.php index e0888f2b..1ee8c813 100644 --- a/app/config/database_stg.php +++ b/app/config/database_stg.php @@ -5,10 +5,10 @@ var $default = array( 'driver' => 'mysql', 'persistent' => false, - 'host' => 'db-staging', - 'login' => 'cmc_staging', - 'password' => 'staging_password', - 'database' => 'cmc_staging', + 'host' => '172.17.0.1', + 'login' => 'staging', + 'password' => 'stagingmoopwoopVerySecure', + 'database' => 'staging', 'prefix' => '', ); } diff --git a/app/config/php7_compat.php b/app/config/php7_compat.php index 639f68a2..3bab09f6 100644 --- a/app/config/php7_compat.php +++ b/app/config/php7_compat.php @@ -93,12 +93,4 @@ if (!function_exists('mysql_connect')) { function mysql_real_escape_string($unescaped_string, $link_identifier = null) { 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'); - } } \ No newline at end of file diff --git a/app/webroot/.DS_Store b/app/webroot/.DS_Store deleted file mode 100644 index 3e71061e..00000000 Binary files a/app/webroot/.DS_Store and /dev/null differ diff --git a/app/webroot/test_setup.php b/app/webroot/test_setup.php deleted file mode 100644 index add5b512..00000000 --- a/app/webroot/test_setup.php +++ /dev/null @@ -1,111 +0,0 @@ -CakePHP Setup Test"; - -// Test 1: PHP Version -echo "

PHP Information

"; -echo "

PHP Version: " . PHP_VERSION . "

"; -echo "

Server API: " . php_sapi_name() . "

"; - -// Test 2: Required Extensions -echo "

PHP Extensions

"; -$extensions = ['mysql', 'mysqli', 'gd', 'curl', 'mbstring']; -foreach ($extensions as $ext) { - $loaded = extension_loaded($ext); - echo "

$ext: " . ($loaded ? '✓ Loaded' : '✗ Not Loaded') . "

"; -} - -// Test 3: CakePHP Constants -echo "

CakePHP Constants

"; -$constants = ['ROOT', 'APP_DIR', 'CAKE_CORE_INCLUDE_PATH', 'WWW_ROOT']; -foreach ($constants as $const) { - if (defined($const)) { - echo "

$const: " . constant($const) . "

"; - } else { - echo "

$const: ✗ Not defined

"; - } -} - -// Test 4: File System -echo "

File System

"; -$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 "

$path: " . - ($exists ? '✓ Exists' : '✗ Missing') . - ($readable ? ', ✓ Readable' : ', ✗ Not readable') . "

"; -} - -// Test 5: CakePHP Core -echo "

CakePHP Core Test

"; -$cake_bootstrap = '/var/www/cmc-sales/cake/bootstrap.php'; -if (file_exists($cake_bootstrap)) { - echo "

CakePHP Bootstrap: ✓ Found at $cake_bootstrap

"; - - // 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 "

Include Test: Ready to include CakePHP

"; - // Note: We don't actually include it here to avoid conflicts - - } catch (Exception $e) { - echo "

Include Test: ✗ Error - " . $e->getMessage() . "

"; - } -} else { - echo "

CakePHP Bootstrap: ✗ Not found

"; -} - -// Test 6: Database -echo "

Database Test

"; -$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 "

DB Host: $db_host

"; -echo "

DB User: $db_user

"; -echo "

DB Name: $db_name

"; - -if (function_exists('mysqli_connect')) { - $conn = @mysqli_connect($db_host, $db_user, $db_pass, $db_name); - if ($conn) { - echo "

Database Connection: ✓ Connected

"; - mysqli_close($conn); - } else { - echo "

Database Connection: ✗ Failed - " . mysqli_connect_error() . "

"; - } -} else { - echo "

Database Connection: ✗ MySQLi not available

"; -} - -echo "

Server Information

"; -echo "
";
-echo "Document Root: " . $_SERVER['DOCUMENT_ROOT'] . "\n";
-echo "Script Name: " . $_SERVER['SCRIPT_NAME'] . "\n";
-echo "Working Directory: " . getcwd() . "\n";
-echo "
"; - -echo "

Generated at: " . date('Y-m-d H:i:s') . "

"; -?> \ No newline at end of file diff --git a/cake/console/error.php b/cake/console/error.php index c47367a1..9c88a40b 100755 --- a/cake/console/error.php +++ b/cake/console/error.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.console */ -class ErrorHandler extends CakeObject { +class ErrorHandler extends Object { /** * Standard output stream. * diff --git a/cake/console/libs/console.php b/cake/console/libs/console.php index 5afd5ed4..19b07509 100755 --- a/cake/console/libs/console.php +++ b/cake/console/libs/console.php @@ -64,7 +64,7 @@ class ConsoleShell extends Shell { foreach ($this->models as $model) { $class = Inflector::camelize(r('.php', '', $model)); $this->models[$model] = $class; - $this->{$class} = new $class(); + $this->{$class} =& new $class(); } $this->out('Model classes:'); $this->out('--------------'); diff --git a/cake/console/libs/schema.php b/cake/console/libs/schema.php index 43c86b5e..36974eb5 100755 --- a/cake/console/libs/schema.php +++ b/cake/console/libs/schema.php @@ -79,7 +79,7 @@ class SchemaShell extends Shell { $connection = $this->params['connection']; } - $this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection')); + $this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection')); } /** * Override main @@ -138,7 +138,7 @@ class SchemaShell extends Shell { $content['file'] = $this->params['file']; if ($snapshot === true) { - $Folder = new Folder($this->Schema->path); + $Folder =& new Folder($this->Schema->path); $result = $Folder->read(); $numToUse = false; diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index e847fb53..eed6bff8 100755 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.console.libs */ -class Shell extends CakeObject { +class Shell extends Object { /** * An instance of the ShellDispatcher object that loaded this script * @@ -200,7 +200,7 @@ class Shell extends CakeObject { */ function _loadDbConfig() { if (config('database') && class_exists('DATABASE_CONFIG')) { - $this->DbConfig = new DATABASE_CONFIG(); + $this->DbConfig =& new DATABASE_CONFIG(); return true; } $this->err('Database config could not be loaded'); @@ -222,7 +222,7 @@ class Shell extends CakeObject { } if ($this->uses === true && App::import('Model', 'AppModel')) { - $this->AppModel = new AppModel(false, false, false); + $this->AppModel =& new AppModel(false, false, false); return true; } @@ -290,7 +290,7 @@ class Shell extends CakeObject { } else { $this->taskNames[] = $taskName; if (!PHP5) { - $this->{$taskName} = new $taskClass($this->Dispatch); + $this->{$taskName} =& new $taskClass($this->Dispatch); } else { $this->{$taskName} = new $taskClass($this->Dispatch); } diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index e5e6d852..736522a8 100755 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -252,7 +252,7 @@ class ControllerTask extends Shell { exit; } $actions = null; - $modelObj = new $currentModelName(); + $modelObj =& new $currentModelName(); $controllerPath = $this->_controllerPath($controllerName); $pluralName = $this->_pluralName($currentModelName); $singularName = Inflector::variable($currentModelName); diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index d61734a8..f7a0c302 100755 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -192,7 +192,7 @@ class ProjectTask extends Shell { * @access public */ function securitySalt($path) { - $File = new File($path . 'config' . DS . 'core.php'); + $File =& new File($path . 'config' . DS . 'core.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { if (!class_exists('Security')) { @@ -216,7 +216,7 @@ class ProjectTask extends Shell { */ function corePath($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(); 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); @@ -227,7 +227,7 @@ class ProjectTask extends Shell { return false; } - $File = new File($path . 'webroot' . DS . 'test.php'); + $File =& new File($path . 'webroot' . DS . 'test.php'); $contents = $File->read(); 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); @@ -248,7 +248,7 @@ class ProjectTask extends Shell { * @access public */ function cakeAdmin($name) { - $File = new File(CONFIGS . 'core.php'); + $File =& new File(CONFIGS . 'core.php'); $contents = $File->read(); 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); diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index bc3b9ad2..cd60df61 100755 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -290,7 +290,7 @@ class ViewTask extends Shell { $content = $this->getContent(); } $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(); if (empty($errors)) { $path = $Folder->slashTerm($Folder->pwd()); diff --git a/cake/dispatcher.php b/cake/dispatcher.php index d8765bf0..ca147f30 100755 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -37,7 +37,7 @@ App::import('Core', array('Router', 'Controller')); * @package cake * @subpackage cake.cake */ -class Dispatcher extends CakeObject { +class Dispatcher extends Object { /** * Base URL * @@ -456,7 +456,7 @@ class Dispatcher extends CakeObject { $params = $this->_restructureParams($params, true); } $this->params = $params; - $controller = new $ctrlClass(); + $controller =& new $ctrlClass(); } return $controller; } @@ -679,7 +679,7 @@ class Dispatcher extends CakeObject { App::import('Core', 'View'); } $controller = null; - $view = new View($controller, false); + $view =& new View($controller, false); return $view->renderCache($filename, getMicrotime()); } } diff --git a/cake/libs/cache.php b/cake/libs/cache.php index 6a3c2ce6..aabd2795 100755 --- a/cake/libs/cache.php +++ b/cake/libs/cache.php @@ -29,7 +29,7 @@ * @package cake * @subpackage cake.cake.libs */ -class Cache extends CakeObject { +class Cache extends Object { /** * Cache engine to use * @@ -68,7 +68,7 @@ class Cache extends CakeObject { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new Cache(); + $instance[0] =& new Cache(); } return $instance[0]; } @@ -148,7 +148,7 @@ class Cache extends CakeObject { if ($_this->__loadEngine($name) === false) { return false; } - $_this->_Engine[$name] = new $cacheClass(); + $_this->_Engine[$name] =& new $cacheClass(); } if ($_this->_Engine[$name]->init($settings)) { @@ -406,7 +406,7 @@ class Cache extends CakeObject { * @package cake * @subpackage cake.cake.libs */ -class CacheEngine extends CakeObject { +class CacheEngine extends Object { /** * settings of current engine instance * diff --git a/cake/libs/cache/file.php b/cake/libs/cache/file.php index fecf9794..abbd5a0e 100755 --- a/cake/libs/cache/file.php +++ b/cake/libs/cache/file.php @@ -86,7 +86,7 @@ class FileEngine extends CacheEngine { if (!class_exists('File')) { 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 === '\\') { diff --git a/cake/libs/cache/memcache.php b/cake/libs/cache/memcache.php index 5c4bbeb3..2d70a6e8 100755 --- a/cake/libs/cache/memcache.php +++ b/cake/libs/cache/memcache.php @@ -73,7 +73,7 @@ class MemcacheEngine extends CacheEngine { } if (!isset($this->__Memcache)) { $return = false; - $this->__Memcache = new Memcache(); + $this->__Memcache =& new Memcache(); foreach ($this->settings['servers'] as $server) { $parts = explode(':', $server); $host = $parts[0]; diff --git a/cake/libs/class_registry.php b/cake/libs/class_registry.php index 5b97257f..5ff5ec32 100755 --- a/cake/libs/class_registry.php +++ b/cake/libs/class_registry.php @@ -65,7 +65,7 @@ class ClassRegistry { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new ClassRegistry(); + $instance[0] =& new ClassRegistry(); } return $instance[0]; } @@ -137,7 +137,7 @@ class ClassRegistry { } if (class_exists($class) || App::import($type, $pluginPath . $class)) { - ${$class} = new $class($settings); + ${$class} =& new $class($settings); } elseif ($type === 'Model') { if ($plugin && class_exists($plugin . 'AppModel')) { $appModel = $plugin . 'AppModel'; @@ -145,7 +145,7 @@ class ClassRegistry { $appModel = 'AppModel'; } $settings['name'] = $class; - ${$class} = new $appModel($settings); + ${$class} =& new $appModel($settings); } if (!isset(${$class})) { diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 42c16de5..c9056d28 100755 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -31,7 +31,7 @@ * @subpackage cake.cake.libs * @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. * @@ -133,7 +133,7 @@ class Configure extends CakeObject { static function &getInstance($boot = true) { static $instance = array(); if (!$instance) { - $instance[0] = new Configure(); + $instance[0] =& new Configure(); $instance[0]->__loadBootstrap($boot); } return $instance[0]; @@ -223,7 +223,7 @@ class Configure extends CakeObject { require LIBS . 'folder.php'; } $items = array(); - $Folder = new Folder($path); + $Folder =& new Folder($path); $contents = $Folder->read(false, true); if (is_array($contents)) { @@ -717,7 +717,7 @@ class Configure extends CakeObject { * @package cake * @subpackage cake.cake.libs */ -class App extends CakeObject { +class App extends Object { /** * Paths to search for files. * @@ -903,7 +903,7 @@ class App extends CakeObject { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new App(); + $instance[0] =& new App(); $instance[0]->__map = Cache::read('file_map', '_cake_core_'); } return $instance[0]; @@ -943,7 +943,7 @@ class App extends CakeObject { if (!class_exists('Folder')) { require LIBS . 'folder.php'; } - $Folder = new Folder(); + $Folder =& new Folder(); $directories = $Folder->tree($path, false, 'dir'); $this->__paths[$path] = $directories; } diff --git a/cake/libs/controller/component.php b/cake/libs/controller/component.php index 4cb46a0e..c40571cd 100755 --- a/cake/libs/controller/component.php +++ b/cake/libs/controller/component.php @@ -28,7 +28,7 @@ * @subpackage cake.cake.libs.controller * @link http://book.cakephp.org/view/62/Components */ -class Component extends CakeObject { +class Component extends Object { /** * Contains various controller variable information (plugin, name, base). * @@ -234,9 +234,9 @@ class Component extends CakeObject { } } else { if ($componentCn === 'SessionComponent') { - $object->{$component} = new $componentCn($base); + $object->{$component} =& new $componentCn($base); } else { - $object->{$component} = new $componentCn(); + $object->{$component} =& new $componentCn(); } $object->{$component}->enabled = true; $this->_loaded[$component] =& $object->{$component}; diff --git a/cake/libs/controller/components/acl.php b/cake/libs/controller/components/acl.php index b2e4ad2d..d68c61f0 100755 --- a/cake/libs/controller/components/acl.php +++ b/cake/libs/controller/components/acl.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs.controller.components */ -class AclComponent extends CakeObject { +class AclComponent extends Object { /** * 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); } } - $this->_Instance = new $name(); + $this->_Instance =& new $name(); $this->_Instance->initialize($this); } /** @@ -157,7 +157,7 @@ class AclComponent extends CakeObject { * @subpackage cake.cake.libs.controller.components * @abstract */ -class AclBase extends CakeObject { +class AclBase extends Object { /** * This class should never be instantiated, just subclassed. * diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 0d0c65ca..1aa37e52 100755 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -36,7 +36,7 @@ App::import(array('Router', 'Security')); * @package cake * @subpackage cake.cake.libs.controller.components */ -class AuthComponent extends CakeObject { +class AuthComponent extends Object { /** * Maintains current user login state. * diff --git a/cake/libs/controller/components/cookie.php b/cake/libs/controller/components/cookie.php index 1e0a063d..56713f5c 100755 --- a/cake/libs/controller/components/cookie.php +++ b/cake/libs/controller/components/cookie.php @@ -37,7 +37,7 @@ App::import('Core', 'Security'); * @subpackage cake.cake.libs.controller.components * */ -class CookieComponent extends CakeObject { +class CookieComponent extends Object { /** * The name of the cookie. * diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index b45ae072..b2e2ea42 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -35,7 +35,7 @@ * */ App::import('Core', 'Multibyte'); -class EmailComponent extends CakeObject{ +class EmailComponent extends Object{ /** * Recipient of the email * @@ -671,7 +671,7 @@ class EmailComponent extends CakeObject{ function __smtp() { 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()) { $this->smtpError = $this->__smtpConnection->lastError(); diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 999e4ea2..efca6b2c 100755 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -36,7 +36,7 @@ if (!defined('REQUEST_MOBILE_UA')) { * @subpackage cake.cake.libs.controller.components * */ -class RequestHandlerComponent extends CakeObject { +class RequestHandlerComponent extends Object { /** * The layout that will be switched to for Ajax requests * diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index d5963a86..96d14025 100755 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -32,7 +32,7 @@ * @package cake * @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 * diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index 528c8d71..6a582bfc 100755 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -38,7 +38,7 @@ App::import('Core', array('Component', 'View')); * @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. * @@ -335,7 +335,7 @@ class Controller extends CakeObject { } $this->modelClass = Inflector::classify($this->name); $this->modelKey = Inflector::underscore($this->modelClass); - $this->Component = new Component(); + $this->Component =& new Component(); $childMethods = get_class_methods($this); $parentMethods = get_class_methods('Controller'); @@ -776,7 +776,7 @@ class Controller extends CakeObject { $this->set('cakeDebug', $this); } - $View = new $viewClass($this); + $View =& new $viewClass($this); if (!empty($this->modelNames)) { $models = array(); diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index cf4be9a2..165e2b56 100755 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -35,7 +35,7 @@ * @package cake * @subpackage cake.cake.libs.controller */ -class Scaffold extends CakeObject { +class Scaffold extends Object { /** * Controller object * diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php index 2079e4c1..f80d05c2 100755 --- a/cake/libs/debugger.php +++ b/cake/libs/debugger.php @@ -43,7 +43,7 @@ * @subpackage cake.cake.libs * @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. * @@ -105,7 +105,7 @@ class Debugger extends CakeObject { } if (!$instance) { - $instance[0] = new Debugger(); + $instance[0] =& new Debugger(); if (Configure::read() > 0) { Configure::version(); // Make sure the core config is loaded $instance[0]->helpPath = Configure::read('Cake.Debugger.HelpPath'); diff --git a/cake/libs/error.php b/cake/libs/error.php index 4647bba6..e8db8276 100755 --- a/cake/libs/error.php +++ b/cake/libs/error.php @@ -66,7 +66,7 @@ class CakeErrorController extends AppController { * @package cake * @subpackage cake.cake.libs */ -class ErrorHandler extends CakeObject { +class ErrorHandler extends Object { /** * Controller instance. * @@ -86,9 +86,9 @@ class ErrorHandler extends CakeObject { if ($__previousError != array($method, $messages)) { $__previousError = array($method, $messages); - $this->controller = new CakeErrorController(); + $this->controller =& new CakeErrorController(); } else { - $this->controller = new Controller(); + $this->controller =& new Controller(); $this->controller->viewPath = 'errors'; } diff --git a/cake/libs/file.php b/cake/libs/file.php index f00fd827..b57cb4c7 100755 --- a/cake/libs/file.php +++ b/cake/libs/file.php @@ -38,7 +38,7 @@ if (!class_exists('Folder')) { * @package cake * @subpackage cake.cake.libs */ -class File extends CakeObject { +class File extends Object { /** * Folder object of the File * @@ -93,7 +93,7 @@ class File extends CakeObject { */ function __construct($path, $create = false, $mode = 0755) { parent::__construct(); - $this->Folder = new Folder(dirname($path), $create, $mode); + $this->Folder =& new Folder(dirname($path), $create, $mode); if (!is_dir($path)) { $this->name = basename($path); } diff --git a/cake/libs/flay.php b/cake/libs/flay.php index 9362830f..ed23cf7f 100755 --- a/cake/libs/flay.php +++ b/cake/libs/flay.php @@ -39,7 +39,7 @@ if (!class_exists('Object')) { * @package cake * @subpackage cake.cake.libs */ -class Flay extends CakeObject{ +class Flay extends Object{ /** * Text to be parsed. * diff --git a/cake/libs/folder.php b/cake/libs/folder.php index 3b108a93..28f32672 100755 --- a/cake/libs/folder.php +++ b/cake/libs/folder.php @@ -37,7 +37,7 @@ if (!class_exists('Object')) { * @package cake * @subpackage cake.cake.libs */ -class Folder extends CakeObject { +class Folder extends Object { /** * Path to Folder. * diff --git a/cake/libs/i18n.php b/cake/libs/i18n.php index 31e04834..6e21ca5c 100755 --- a/cake/libs/i18n.php +++ b/cake/libs/i18n.php @@ -36,7 +36,7 @@ App::import('Core', 'l10n'); * @package cake * @subpackage cake.cake.libs */ -class I18n extends CakeObject { +class I18n extends Object { /** * Instance of the I10n class for localization * @@ -106,8 +106,8 @@ class I18n extends CakeObject { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new I18n(); - $instance[0]->l10n = new L10n(); + $instance[0] =& new I18n(); + $instance[0]->l10n =& new L10n(); } return $instance[0]; } diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 5caf467c..71f07b4e 100755 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -45,7 +45,7 @@ if (!class_exists('Set')) { * @subpackage cake.cake.libs * @link http://book.cakephp.org/view/491/Inflector */ -class Inflector extends CakeObject { +class Inflector extends Object { /** * Pluralized words. * @@ -128,7 +128,7 @@ class Inflector extends CakeObject { static $instance = array(); if (!$instance) { - $instance[0] = new Inflector(); + $instance[0] =& new Inflector(); if (file_exists(CONFIGS.'inflections.php')) { include(CONFIGS.'inflections.php'); $instance[0]->__pluralRules = $pluralRules; diff --git a/cake/libs/l10n.php b/cake/libs/l10n.php index 6cb8a3fe..95f66c25 100755 --- a/cake/libs/l10n.php +++ b/cake/libs/l10n.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs */ -class L10n extends CakeObject { +class L10n extends Object { /** * The language for current locale * diff --git a/cake/libs/magic_db.php b/cake/libs/magic_db.php index e039b7d9..73b16017 100755 --- a/cake/libs/magic_db.php +++ b/cake/libs/magic_db.php @@ -31,7 +31,7 @@ if (!class_exists('File')) { * @package cake.tests * @subpackage cake.tests.cases.libs */ -class MagicDb extends CakeObject { +class MagicDb extends Object { /** * 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) { $data = $magicDb; } else { - $File = new File($magicDb); + $File =& new File($magicDb); if (!$File->exists()) { return false; } @@ -158,7 +158,7 @@ class MagicDb extends CakeObject { } $matches = array(); - $MagicFileResource = new MagicFileResource($file); + $MagicFileResource =& new MagicFileResource($file); foreach ($this->db['database'] as $format) { $magic = $format[0]; $match = $MagicFileResource->test($magic); @@ -178,7 +178,7 @@ class MagicDb extends CakeObject { * @package cake.tests * @subpackage cake.tests.cases.libs */ -class MagicFileResource extends CakeObject{ +class MagicFileResource extends Object{ /** * undocumented variable * @@ -202,7 +202,7 @@ class MagicFileResource extends CakeObject{ */ function __construct($file) { if (file_exists($file)) { - $this->resource = new File($file); + $this->resource =& new File($file); } else { $this->resource = $file; } diff --git a/cake/libs/model/behavior.php b/cake/libs/model/behavior.php index 881b070e..fdbc64e3 100755 --- a/cake/libs/model/behavior.php +++ b/cake/libs/model/behavior.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs.model */ -class ModelBehavior extends CakeObject { +class ModelBehavior extends Object { /** * Contains configuration settings for use with individual model objects. This * is used because if multiple models use this Behavior, each will use the same @@ -204,7 +204,7 @@ class ModelBehavior extends CakeObject { * @package cake * @subpackage cake.cake.libs.model */ -class BehaviorCollection extends CakeObject { +class BehaviorCollection extends Object { /** * Stores a reference to the attached name * @@ -283,7 +283,7 @@ class BehaviorCollection extends CakeObject { if (PHP5) { $this->{$name} = new $class; } else { - $this->{$name} = new $class; + $this->{$name} =& new $class; } ClassRegistry::addObject($class, $this->{$name}); } diff --git a/cake/libs/model/connection_manager.php b/cake/libs/model/connection_manager.php index 68f304d1..32f16984 100755 --- a/cake/libs/model/connection_manager.php +++ b/cake/libs/model/connection_manager.php @@ -35,7 +35,7 @@ config('database'); * @package cake * @subpackage cake.cake.libs.model */ -class ConnectionManager extends CakeObject { +class ConnectionManager extends Object { /** * Holds a loaded instance of the Connections object * @@ -63,7 +63,7 @@ class ConnectionManager extends CakeObject { */ function __construct() { 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(); if (!$instance) { - $instance[0] = new ConnectionManager(); + $instance[0] =& new ConnectionManager(); } return $instance[0]; @@ -103,7 +103,7 @@ class ConnectionManager extends CakeObject { $conn = $connections[$name]; $class = $conn['classname']; $_this->loadDataSource($name); - $_this->_dataSources[$name] = new $class($_this->config->{$name}); + $_this->_dataSources[$name] =& new $class($_this->config->{$name}); $_this->_dataSources[$name]->configKeyName = $name; } else { trigger_error(sprintf(__("ConnectionManager::getDataSource - Non-existent data source %s", true), $name), E_USER_ERROR); diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index f9cfc515..b1b2baef 100755 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs.model.datasources */ -class DataSource extends CakeObject { +class DataSource extends Object { /** * Are we connected to the DataSource? * diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php index 1faa073b..d0368992 100755 --- a/cake/libs/model/schema.php +++ b/cake/libs/model/schema.php @@ -29,7 +29,7 @@ App::import('Model', 'ConnectionManager'); * @package cake * @subpackage cake.cake.libs.model */ -class CakeSchema extends CakeObject { +class CakeSchema extends Object { /** * Name of the App Schema * @@ -158,7 +158,7 @@ class CakeSchema extends CakeObject { } if (class_exists($class)) { - $Schema = new $class($options); + $Schema =& new $class($options); return $Schema; } @@ -354,7 +354,7 @@ class CakeSchema extends CakeObject { $out .="}\n"; - $File = new File($path . DS . $file, true); + $File =& new File($path . DS . $file, true); $header = '$Id'; $content = ""; $content = $File->prepare($content); diff --git a/cake/libs/multibyte.php b/cake/libs/multibyte.php index 9dc9c9b6..724b6592 100755 --- a/cake/libs/multibyte.php +++ b/cake/libs/multibyte.php @@ -241,7 +241,7 @@ if (!function_exists('mb_encode_mimeheader')) { * @package cake * @subpackage cake.cake.libs */ -class Multibyte extends CakeObject { +class Multibyte extends Object { /** * Holds the case folding values * @@ -274,7 +274,7 @@ class Multibyte extends CakeObject { static $instance = array(); if (!$instance) { - $instance[0] = new Multibyte(); + $instance[0] =& new Multibyte(); } return $instance[0]; } diff --git a/cake/libs/object.php b/cake/libs/object.php index 1519e76f..61c0896c 100755 --- a/cake/libs/object.php +++ b/cake/libs/object.php @@ -34,7 +34,7 @@ * @package cake * @subpackage cake.cake.libs */ -class CakeObject { +class 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 ?> \ No newline at end of file diff --git a/cake/libs/overloadable_php4.php b/cake/libs/overloadable_php4.php index 0a6ff9df..b60411c5 100755 --- a/cake/libs/overloadable_php4.php +++ b/cake/libs/overloadable_php4.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.libs */ -class Overloadable extends CakeObject { +class Overloadable extends Object { /** * Constructor. * @@ -88,7 +88,7 @@ Overloadable::overload('Overloadable'); * @package cake * @subpackage cake.cake.libs */ -class Overloadable2 extends CakeObject { +class Overloadable2 extends Object { /** * Constructor * diff --git a/cake/libs/overloadable_php5.php b/cake/libs/overloadable_php5.php index 347f7c9c..906b6b37 100755 --- a/cake/libs/overloadable_php5.php +++ b/cake/libs/overloadable_php5.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.libs */ -class Overloadable extends CakeObject { +class Overloadable extends Object { /** * Overload implementation. No need for implementation in PHP5. * @@ -60,7 +60,7 @@ class Overloadable extends CakeObject { * * @package cake */ -class Overloadable2 extends CakeObject { +class Overloadable2 extends Object { /** * Overload implementation. No need for implementation in PHP5. * diff --git a/cake/libs/router.php b/cake/libs/router.php index 65520c7c..0b2b3b61 100755 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -37,7 +37,7 @@ if (!class_exists('Object')) { * @package cake * @subpackage cake.cake.libs */ -class Router extends CakeObject { +class Router extends Object { /** * Array of routes * @@ -170,7 +170,7 @@ class Router extends CakeObject { static $instance = array(); if (!$instance) { - $instance[0] = new Router(); + $instance[0] =& new Router(); $instance[0]->__admin = Configure::read('Routing.admin'); } return $instance[0]; diff --git a/cake/libs/security.php b/cake/libs/security.php index fc610c1e..15ec7c1b 100755 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -32,7 +32,7 @@ * @package cake * @subpackage cake.cake.libs */ -class Security extends CakeObject { +class Security extends Object { /** * Default hash method * @@ -50,7 +50,7 @@ class Security extends CakeObject { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new Security; + $instance[0] =& new Security; } return $instance[0]; } diff --git a/cake/libs/session.php b/cake/libs/session.php index a2ae2511..c90318c9 100755 --- a/cake/libs/session.php +++ b/cake/libs/session.php @@ -46,7 +46,7 @@ if (!class_exists('Security')) { * @package cake * @subpackage cake.cake.libs */ -class CakeSession extends CakeObject { +class CakeSession extends Object { /** * True if the Session is still valid * diff --git a/cake/libs/set.php b/cake/libs/set.php index 8e54b15d..2afb7156 100755 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.libs */ -class Set extends CakeObject { +class Set extends Object { /** * Deprecated * diff --git a/cake/libs/socket.php b/cake/libs/socket.php index 487d0911..c5c945aa 100755 --- a/cake/libs/socket.php +++ b/cake/libs/socket.php @@ -31,7 +31,7 @@ App::import('Core', 'Validation'); * @package cake * @subpackage cake.cake.libs */ -class CakeSocket extends CakeObject { +class CakeSocket extends Object { /** * Object description * diff --git a/cake/libs/string.php b/cake/libs/string.php index 2f8950ea..286017bd 100755 --- a/cake/libs/string.php +++ b/cake/libs/string.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.libs */ -class String extends CakeObject { +class String extends Object { /** * Gets a reference to the String object instance * @@ -42,7 +42,7 @@ class String extends CakeObject { static $instance = array(); if (!$instance) { - $instance[0] = new String(); + $instance[0] =& new String(); } return $instance[0]; } diff --git a/cake/libs/validation.php b/cake/libs/validation.php index f519fec0..be0d20c2 100755 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -52,7 +52,7 @@ * @subpackage cake.cake.libs * @since CakePHP v 1.2.0.3830 */ -class Validation extends CakeObject { +class Validation extends Object { /** * Set the the value of methods $check param. * @@ -119,7 +119,7 @@ class Validation extends CakeObject { static $instance = array(); if (!$instance) { - $instance[0] = new Validation(); + $instance[0] =& new Validation(); } return $instance[0]; } diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 39814a0c..d8e60b12 100755 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -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->helpers = $this->helpers = unserialize(\'' . serialize($this->helpers) . '\'); $controller->base = $this->base = \'' . $this->base . '\'; diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index e372e9f2..15e25099 100755 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -136,7 +136,7 @@ class JsHelper extends Overloadable2 { } $func .= "'" . Router::url($url) . "'"; - $ajax = new AjaxHelper(); + $ajax =& new AjaxHelper(); $func .= ", " . $ajax->__optionsForAjax($options) . ")"; if (isset($options['before'])) { diff --git a/cake/libs/view/helpers/xml.php b/cake/libs/view/helpers/xml.php index bd8434dc..6377a526 100755 --- a/cake/libs/view/helpers/xml.php +++ b/cake/libs/view/helpers/xml.php @@ -46,7 +46,7 @@ class XmlHelper extends AppHelper { */ function __construct() { parent::__construct(); - $this->Xml = new Xml(); + $this->Xml =& new Xml(); $this->Xml->options(array('verifyNs' => false)); } /** @@ -155,7 +155,7 @@ class XmlHelper extends AppHelper { */ function serialize($data, $options = array()) { $options += array('attributes' => false, 'format' => 'attributes'); - $data = new Xml($data, $options); + $data =& new Xml($data, $options); return $data->toString($options + array('header' => false)); } } diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index a5d8d57d..1ed8c01c 100755 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -34,7 +34,7 @@ App::import('Core', array('Helper', 'ClassRegistry')); * @package cake * @subpackage cake.cake.libs.view */ -class View extends CakeObject { +class View extends Object { /** * Path parts for creating links in views. * @@ -745,7 +745,7 @@ class View extends CakeObject { return false; } } - $loaded[$helper] = new $helperCn($options); + $loaded[$helper] =& new $helperCn($options); $vars = array( 'base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin' ); diff --git a/cake/libs/xml.php b/cake/libs/xml.php index 7daa6684..0d91825b 100755 --- a/cake/libs/xml.php +++ b/cake/libs/xml.php @@ -34,7 +34,7 @@ App::import('Core', 'Set'); * @subpackage cake.cake.libs * @since CakePHP v .0.10.3.1400 */ -class XmlNode extends CakeObject { +class XmlNode extends Object { /** * Name of node * @@ -147,7 +147,7 @@ class XmlNode extends CakeObject { * @return object XmlNode */ function &createNode($name = null, $value = null, $namespace = false) { - $node = new XmlNode($name, $value, $namespace); + $node =& new XmlNode($name, $value, $namespace); $node->setParent($this); return $node; } @@ -161,7 +161,7 @@ class XmlNode extends CakeObject { * @return object XmlElement */ 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); return $element; } @@ -1398,7 +1398,7 @@ class XmlManager { static $instance = array(); if (!$instance) { - $instance[0] = new XmlManager(); + $instance[0] =& new XmlManager(); } return $instance[0]; } diff --git a/cake/tests/cases/console/cake.test.php b/cake/tests/cases/console/cake.test.php index 86e22f85..6eda913f 100755 --- a/cake/tests/cases/console/cake.test.php +++ b/cake/tests/cases/console/cake.test.php @@ -151,7 +151,7 @@ class ShellDispatcherTest extends UnitTestCase { * @return void */ function testParseParams() { - $Dispatcher = new TestShellDispatcher(); + $Dispatcher =& new TestShellDispatcher(); $params = array( '/cake/1.2.x.x/cake/console/cake.php', @@ -423,7 +423,7 @@ class ShellDispatcherTest extends UnitTestCase { * @return void */ function testBuildPaths() { - $Dispatcher = new TestShellDispatcher(); + $Dispatcher =& new TestShellDispatcher(); $result = $Dispatcher->shellPaths; $expected = array( @@ -444,13 +444,13 @@ class ShellDispatcherTest extends UnitTestCase { * @return void */ function testDispatch() { - $Dispatcher = new TestShellDispatcher(array('sample')); + $Dispatcher =& new TestShellDispatcher(array('sample')); $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); - $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); } /** @@ -460,7 +460,7 @@ class ShellDispatcherTest extends UnitTestCase { * @return void */ function testHelpCommand() { - $Dispatcher = new TestShellDispatcher(); + $Dispatcher =& new TestShellDispatcher(); $expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:"; $expected .= "\n\t example"; diff --git a/cake/tests/cases/console/libs/acl.test.php b/cake/tests/cases/console/libs/acl.test.php index 6f7f1154..f27a6943 100755 --- a/cake/tests/cases/console/libs/acl.test.php +++ b/cake/tests/cases/console/libs/acl.test.php @@ -84,8 +84,8 @@ class AclShellTest extends CakeTestCase { * @access public */ function startTest() { - $this->Dispatcher = new TestAclShellMockShellDispatcher(); - $this->Task = new MockAclShell($this->Dispatcher); + $this->Dispatcher =& new TestAclShellMockShellDispatcher(); + $this->Task =& new MockAclShell($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; $this->Task->params['datasource'] = 'test_suite'; } diff --git a/cake/tests/cases/console/libs/api.test.php b/cake/tests/cases/console/libs/api.test.php index cc60aecf..b5568fce 100755 --- a/cake/tests/cases/console/libs/api.test.php +++ b/cake/tests/cases/console/libs/api.test.php @@ -62,8 +62,8 @@ class ApiShellTest extends CakeTestCase { * @access public */ function startTest() { - $this->Dispatcher = new ApiShellMockShellDispatcher(); - $this->Shell = new MockApiShell($this->Dispatcher); + $this->Dispatcher =& new ApiShellMockShellDispatcher(); + $this->Shell =& new MockApiShell($this->Dispatcher); $this->Shell->Dispatch =& $this->Dispatcher; } /** diff --git a/cake/tests/cases/console/libs/schema.test.php b/cake/tests/cases/console/libs/schema.test.php index 48573fcf..063910db 100755 --- a/cake/tests/cases/console/libs/schema.test.php +++ b/cake/tests/cases/console/libs/schema.test.php @@ -124,8 +124,8 @@ class SchemaShellTest extends CakeTestCase { * @access public */ function startTest() { - $this->Dispatcher = new TestSchemaShellMockShellDispatcher(); - $this->Shell = new MockSchemaShell($this->Dispatcher); + $this->Dispatcher =& new TestSchemaShellMockShellDispatcher(); + $this->Shell =& new MockSchemaShell($this->Dispatcher); $this->Shell->Dispatch =& $this->Dispatcher; } @@ -193,9 +193,9 @@ class SchemaShellTest extends CakeTestCase { * @return void **/ 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(); - $file = new File(TMP . 'tests' . DS . 'i18n.php'); + $file =& new File(TMP . 'tests' . DS . 'i18n.php'); $file->write($contents); $this->Shell->params = array('name' => 'i18n'); @@ -204,7 +204,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->Schema->path = TMP . 'tests'; $this->Shell->dump(); - $sql = new File(TMP . 'tests' . DS . 'i18n.sql'); + $sql =& new File(TMP . 'tests' . DS . 'i18n.sql'); $contents = $sql->read(); $this->assertPattern('/DROP TABLE/', $contents); $this->assertPattern('/CREATE TABLE `i18n`/', $contents); @@ -228,7 +228,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->path = TMP; $this->Shell->params['file'] = 'schema.php'; $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('write', true); @@ -249,7 +249,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->args = array(); $this->Shell->setReturnValue('in', 'q'); - $this->Shell->Schema = new MockSchemaCakeSchema(); + $this->Shell->Schema =& new MockSchemaCakeSchema(); $this->Shell->Schema->path = TMP; $this->Shell->Schema->expectNever('read'); @@ -269,7 +269,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->setReturnValue('in', 'o'); $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->setReturnValue('read', array('schema data')); $this->Shell->Schema->setReturnValue('write', true); @@ -341,7 +341,7 @@ class SchemaShellTest extends CakeTestCase { $this->Shell->setReturnValue('in', 'y'); $this->Shell->run(); - $article = new Model(array('name' => 'Article', 'ds' => 'test_suite')); + $article =& new Model(array('name' => 'Article', 'ds' => 'test_suite')); $fields = $article->schema(); $this->assertTrue(isset($fields['summary'])); diff --git a/cake/tests/cases/console/libs/shell.test.php b/cake/tests/cases/console/libs/shell.test.php index c7114535..b832088e 100755 --- a/cake/tests/cases/console/libs/shell.test.php +++ b/cake/tests/cases/console/libs/shell.test.php @@ -95,8 +95,8 @@ class ShellTest extends CakeTestCase { * @access public */ function setUp() { - $this->Dispatcher = new TestShellMockShellDispatcher(); - $this->Shell = new TestShell($this->Dispatcher); + $this->Dispatcher =& new TestShellMockShellDispatcher(); + $this->Shell =& new TestShell($this->Dispatcher); } /** * tearDown method diff --git a/cake/tests/cases/console/libs/tasks/extract.test.php b/cake/tests/cases/console/libs/tasks/extract.test.php index 6ae11c64..d393a527 100755 --- a/cake/tests/cases/console/libs/tasks/extract.test.php +++ b/cake/tests/cases/console/libs/tasks/extract.test.php @@ -59,8 +59,8 @@ class ExtractTaskTest extends CakeTestCase { * @access public */ function setUp() { - $this->Dispatcher = new TestExtractTaskMockShellDispatcher(); - $this->Task = new ExtractTask($this->Dispatcher); + $this->Dispatcher =& new TestExtractTaskMockShellDispatcher(); + $this->Task =& new ExtractTask($this->Dispatcher); } /** * tearDown method diff --git a/cake/tests/cases/console/libs/tasks/test.test.php b/cake/tests/cases/console/libs/tasks/test.test.php index 0449893b..548f2960 100755 --- a/cake/tests/cases/console/libs/tasks/test.test.php +++ b/cake/tests/cases/console/libs/tasks/test.test.php @@ -63,8 +63,8 @@ class TestTaskTest extends CakeTestCase { * @access public */ function setUp() { - $this->Dispatcher = new TestTestTaskMockShellDispatcher(); - $this->Task = new MockTestTask($this->Dispatcher); + $this->Dispatcher =& new TestTestTaskMockShellDispatcher(); + $this->Task =& new MockTestTask($this->Dispatcher); $this->Task->Dispatch =& $this->Dispatcher; } /** diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index f761eaa0..613c8949 100755 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -544,7 +544,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testParseParamsWithoutZerosAndEmptyPost() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $test = $Dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3"); $this->assertIdentical($test['controller'], 'testcontroller'); $this->assertIdentical($test['action'], 'testaction'); @@ -561,7 +561,7 @@ class DispatcherTest extends CakeTestCase { */ function testParseParamsReturnsPostedData() { $_POST['testdata'] = "My Posted Content"; - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $test = $Dispatcher->parseParams("/"); $this->assertTrue($test['form'], "Parsed URL not returning post data"); $this->assertIdentical($test['form']['testdata'], "My Posted Content"); @@ -573,7 +573,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testParseParamsWithSingleZero() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $test = $Dispatcher->parseParams("/testcontroller/testaction/1/0/23"); $this->assertIdentical($test['controller'], 'testcontroller'); $this->assertIdentical($test['action'], 'testaction'); @@ -588,7 +588,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testParseParamsWithManySingleZeros() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $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'][1]); @@ -604,7 +604,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testParseParamsWithManyZerosInEachSectionOfUrl() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $test = $Dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000"); $this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0]); $this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1]); @@ -620,7 +620,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $test = $Dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400"); $this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0]); $this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1]); @@ -641,7 +641,7 @@ class DispatcherTest extends CakeTestCase { Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); $_GET = array('coffee' => 'life', 'sleep' => 'sissies'); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $uri = 'posts/home/?coffee=life&sleep=sissies'; $result = $Dispatcher->parseParams($uri); $this->assertPattern('/posts/', $result['controller']); @@ -649,7 +649,7 @@ class DispatcherTest extends CakeTestCase { $this->assertTrue(isset($result['url']['sleep'])); $this->assertTrue(isset($result['url']['coffee'])); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $uri = '/?coffee=life&sleep=sissy'; $result = $Dispatcher->parseParams($uri); $this->assertPattern('/pages/', $result['controller']); @@ -712,7 +712,7 @@ class DispatcherTest extends CakeTestCase { ), )); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $result = $Dispatcher->parseParams('/'); $expected = array( @@ -830,7 +830,7 @@ class DispatcherTest extends CakeTestCase { ) ) ); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $result = $Dispatcher->parseParams('/'); $expected = array( 'Document' => array( @@ -895,7 +895,7 @@ class DispatcherTest extends CakeTestCase { ) ); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $result = $Dispatcher->parseParams('/'); $expected = array( @@ -917,7 +917,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testGetUrl() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->base = '/app/webroot/index.php'; $uri = '/app/webroot/index.php/posts/add'; $result = $Dispatcher->getUrl($uri); @@ -933,7 +933,7 @@ class DispatcherTest extends CakeTestCase { $_GET['url'] = array(); Configure::write('App.base', '/control'); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->baseUrl(); $uri = '/control/students/browse'; $result = $Dispatcher->getUrl($uri); @@ -941,7 +941,7 @@ class DispatcherTest extends CakeTestCase { $this->assertEqual($expected, $result); $_GET['url'] = array(); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->base = ''; $uri = '/?/home'; $result = $Dispatcher->getUrl($uri); @@ -956,7 +956,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testBaseUrlAndWebrootWithModRewrite() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->base = false; $_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches'; @@ -1037,7 +1037,7 @@ class DispatcherTest extends CakeTestCase { Configure::write('App.base', '/control'); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $result = $Dispatcher->baseUrl(); $expected = '/control'; $this->assertEqual($expected, $result); @@ -1051,7 +1051,7 @@ class DispatcherTest extends CakeTestCase { $_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html'; $_SERVER['SCRIPT_FILENAME'] = '/var/www/abtravaff/html/newaffiliate/index.php'; $_SERVER['PHP_SELF'] = '/newaffiliate/index.php'; - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $result = $Dispatcher->baseUrl(); $expected = '/newaffiliate'; $this->assertEqual($expected, $result); @@ -1065,7 +1065,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testBaseUrlAndWebrootWithBaseUrl() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); Configure::write('App.dir', 'app'); @@ -1134,7 +1134,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testBaseUrlAndWebrootWithBase() { - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->base = '/app'; $result = $Dispatcher->baseUrl(); $expected = '/app'; @@ -1164,7 +1164,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testMissingController() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'some_controller/home/param:value/param2:value2'; $controller = $Dispatcher->dispatch($url, array('return' => 1)); @@ -1183,7 +1183,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testPrivate() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'some_pages/_protected/param:value/param2:value2'; @@ -1205,7 +1205,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testMissingAction() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'some_pages/home/param:value/param2:value2'; @@ -1220,7 +1220,7 @@ class DispatcherTest extends CakeTestCase { ))); $this->assertEqual($expected, $controller); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'some_pages/redirect/param:value/param2:value2'; @@ -1242,7 +1242,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testDispatch() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'pages/home/param:value/param2:value2'; @@ -1269,7 +1269,7 @@ class DispatcherTest extends CakeTestCase { unset($Dispatcher); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/timesheets/index.php'); $url = 'timesheets'; @@ -1296,7 +1296,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testDispatchWithArray() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('App.baseUrl','/index.php'); $url = 'pages/home/param:value/param2:value2'; @@ -1316,7 +1316,7 @@ class DispatcherTest extends CakeTestCase { */ function testAdminDispatch() { $_POST = array(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('Routing.admin', 'admin'); Configure::write('App.baseUrl','/cake/repo/branches/1.2.x.x/index.php'); $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'; Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Router::connect('/my_plugin/:controller/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display')); $Dispatcher->base = false; @@ -1397,7 +1397,7 @@ class DispatcherTest extends CakeTestCase { $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin', 'controller'=>'pages', 'action'=>'display')); $Dispatcher->base = false; @@ -1434,7 +1434,7 @@ class DispatcherTest extends CakeTestCase { $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/add/param:value/param2:value2'; @@ -1455,7 +1455,7 @@ class DispatcherTest extends CakeTestCase { Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; /* Simulates the Route for a real plugin, installed in APP/plugins */ @@ -1483,7 +1483,7 @@ class DispatcherTest extends CakeTestCase { Configure::write('Routing.admin', 'admin'); Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'admin/my_plugin/add/5/param:value/param2:value2'; @@ -1503,7 +1503,7 @@ class DispatcherTest extends CakeTestCase { Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $controller = $Dispatcher->dispatch('admin/articles_test', array('return' => 1)); @@ -1536,21 +1536,21 @@ class DispatcherTest extends CakeTestCase { Router::reload(); Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin')); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/my_plugin/add'; $controller = $Dispatcher->dispatch($url, array('return' => 1)); $this->assertFalse(isset($controller->params['pass'][0])); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/my_plugin/add/0'; $controller = $Dispatcher->dispatch($url, array('return' => 1)); $this->assertTrue(isset($controller->params['pass'][0])); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/add'; @@ -1558,14 +1558,14 @@ class DispatcherTest extends CakeTestCase { $this->assertFalse(isset($controller->params['pass'][0])); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/add/0'; $controller = $Dispatcher->dispatch($url, array('return' => 1)); $this->assertIdentical('0',$controller->params['pass'][0]); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $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'; Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/not_here/param:value/param2:value2'; @@ -1599,7 +1599,7 @@ class DispatcherTest extends CakeTestCase { $this->assertIdentical($expected, $controller); Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'my_plugin/param:value/param2:value2'; @@ -1627,7 +1627,7 @@ class DispatcherTest extends CakeTestCase { Router::reload(); Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'), array('controller', 'action')); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $Dispatcher->base = false; $url = 'test_dispatch_pages/admin_index/param:value/param2:value2'; @@ -1648,7 +1648,7 @@ class DispatcherTest extends CakeTestCase { * @return void **/ function testTestPluginDispatch() { - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); $_back = Configure::read('pluginPaths'); Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); $url = '/test_plugin/tests/index'; @@ -1668,7 +1668,7 @@ class DispatcherTest extends CakeTestCase { */ function testChangingParamsFromBeforeFilter() { $_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'; $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('vendorPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors'. DS)); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Configure::write('debug', 0); 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)); - $dispatcher = new Dispatcher(); + $dispatcher =& new Dispatcher(); $dispatcher->base = false; $url = '/'; @@ -1902,7 +1902,7 @@ class DispatcherTest extends CakeTestCase { Router::mapResources('Posts'); $_SERVER['REQUEST_METHOD'] = 'POST'; - $dispatcher = new Dispatcher(); + $dispatcher =& new Dispatcher(); $dispatcher->base = false; $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" ); - $dispatcher = new Dispatcher(); + $dispatcher =& new Dispatcher(); $result = $dispatcher->baseUrl(); $expected = '/index.php/h1 onclick=alert(xss);heya'; $this->assertEqual($result, $expected); @@ -1968,7 +1968,7 @@ class DispatcherTest extends CakeTestCase { * @return void */ function testEnvironmentDetection() { - $dispatcher = new Dispatcher(); + $dispatcher =& new Dispatcher(); $environments = array( 'IIS' => array( @@ -2077,7 +2077,7 @@ class DispatcherTest extends CakeTestCase { $_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php'; Router::reload(); - $Dispatcher = new TestDispatcher(); + $Dispatcher =& new TestDispatcher(); Router::connect('/myalias/:action/*', array('controller' => 'my_controller', 'action' => null)); $Dispatcher->base = false; diff --git a/cake/tests/cases/libs/cake_test_case.test.php b/cake/tests/cases/libs/cake_test_case.test.php index 56fa70d8..895eaaf4 100755 --- a/cake/tests/cases/libs/cake_test_case.test.php +++ b/cake/tests/cases/libs/cake_test_case.test.php @@ -78,8 +78,8 @@ class CakeTestCaseTest extends CakeTestCase { * @return void */ function setUp() { - $this->Case = new SubjectCakeTestCase(); - $reporter = new MockCakeHtmlReporter(); + $this->Case =& new SubjectCakeTestCase(); + $reporter =& new MockCakeHtmlReporter(); $this->Case->setReporter($reporter); $this->Reporter = $reporter; } @@ -265,7 +265,7 @@ class CakeTestCaseTest extends CakeTestCase { $this->assertEqual($result, array('var' => 'string')); $db =& ConnectionManager::getDataSource('test_suite'); - $fixture = new PostFixture(); + $fixture =& new PostFixture(); $fixture->create($db); $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); $db2 =& ConnectionManager::getDataSource('cake_test_case'); - $fixture = new PostFixture($db2); + $fixture =& new PostFixture($db2); $fixture->create($db2); $fixture->insert($db2); @@ -349,7 +349,7 @@ class CakeTestCaseTest extends CakeTestCase { ConnectionManager::create('cake_test_case', $config); $db =& ConnectionManager::getDataSource('cake_test_case'); - $fixture = new PostFixture($db); + $fixture =& new PostFixture($db); $fixture->create($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('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); - $Dispatcher = new CakeTestDispatcher(); - $Case = new CakeDispatcherMockTestCase(); + $Dispatcher =& new CakeTestDispatcher(); + $Case =& new CakeDispatcherMockTestCase(); $Case->expectOnce('startController'); $Case->expectOnce('endController'); diff --git a/cake/tests/cases/libs/cake_test_fixture.test.php b/cake/tests/cases/libs/cake_test_fixture.test.php index a3c64608..d5844bc6 100755 --- a/cake/tests/cases/libs/cake_test_fixture.test.php +++ b/cake/tests/cases/libs/cake_test_fixture.test.php @@ -125,7 +125,7 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function setUp() { - $this->criticDb = new FixtureMockDboSource(); + $this->criticDb =& new FixtureMockDboSource(); $this->criticDb->fullDebug = true; } /** @@ -144,23 +144,23 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function testInit() { - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); unset($Fixture->table); $Fixture->init(); $this->assertEqual($Fixture->table, 'fixture_tests'); $this->assertEqual($Fixture->primaryKey, 'id'); - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); $Fixture->primaryKey = 'my_random_key'; $Fixture->init(); $this->assertEqual($Fixture->primaryKey, 'my_random_key'); $this->_initDb(); - $Source = new CakeTestFixtureTestFixture(); + $Source =& new CakeTestFixtureTestFixture(); $Source->create($this->db); $Source->insert($this->db); - $Fixture = new CakeTestFixtureImportFixture(); + $Fixture =& new CakeTestFixtureImportFixture(); $expected = array('id', 'name', 'created'); $this->assertEqual(array_keys($Fixture->fields), $expected); @@ -174,7 +174,7 @@ class CakeTestFixtureTest extends CakeTestCase { $Fixture->init(); $this->assertEqual(count($Fixture->records), count($Source->records)); - $Fixture = new CakeTestFixtureImportFixture(); + $Fixture =& new CakeTestFixtureImportFixture(); $Fixture->fields = $Fixture->records = null; $Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'test_suite'); $Fixture->init(); @@ -201,13 +201,13 @@ class CakeTestFixtureTest extends CakeTestCase { ConnectionManager::create('new_test_suite', array_merge($testSuiteConfig, array('prefix' => 'new_' . $testSuiteConfig['prefix']))); $newTestSuiteDb =& ConnectionManager::getDataSource('new_test_suite'); - $Source = new CakeTestFixtureTestFixture(); + $Source =& new CakeTestFixtureTestFixture(); $Source->create($newTestSuiteDb); $Source->insert($newTestSuiteDb); $defaultDb->config = $newTestSuiteDb->config; - $Fixture = new CakeTestFixtureDefaultImportFixture(); + $Fixture =& new CakeTestFixtureDefaultImportFixture(); $Fixture->fields = $Fixture->records = null; $Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'new_test_suite'); $Fixture->init(); @@ -227,7 +227,7 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function testCreate() { - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); $this->criticDb->expectAtLeastOnce('execute'); $this->criticDb->expectAtLeastOnce('createSchema'); $return = $Fixture->create($this->criticDb); @@ -245,7 +245,7 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function testInsert() { - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); $this->criticDb->setReturnValue('insertMulti', true); $this->criticDb->expectAtLeastOnce('insertMulti'); @@ -260,7 +260,7 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function testDrop() { - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); $this->criticDb->setReturnValueAt(0, 'execute', true); $this->criticDb->expectAtLeastOnce('execute'); $this->criticDb->expectAtLeastOnce('dropSchema'); @@ -280,7 +280,7 @@ class CakeTestFixtureTest extends CakeTestCase { * @return void */ function testTruncate() { - $Fixture = new CakeTestFixtureTestFixture(); + $Fixture =& new CakeTestFixtureTestFixture(); $this->criticDb->expectAtLeastOnce('truncate'); $Fixture->truncate($this->criticDb); $this->assertTrue($this->criticDb->fullDebug); diff --git a/cake/tests/cases/libs/code_coverage_manager.test.php b/cake/tests/cases/libs/code_coverage_manager.test.php index ef18aff5..9a1e6c41 100755 --- a/cake/tests/cases/libs/code_coverage_manager.test.php +++ b/cake/tests/cases/libs/code_coverage_manager.test.php @@ -158,7 +158,7 @@ class CodeCoverageManagerTest extends CakeTestCase { * @package cake * @subpackage cake.tests.cases.libs */ - class Set extends CakeObject { + class Set extends Object { /** * Value of the Set object. * @@ -315,7 +315,7 @@ PHP; * @package cake * @subpackage cake.tests.cases.libs */ - class Set extends CakeObject { + class Set extends Object { /** * Value of the Set object. * diff --git a/cake/tests/cases/libs/controller/component.test.php b/cake/tests/cases/libs/controller/component.test.php index 4013c6b1..e3f78b28 100755 --- a/cake/tests/cases/libs/controller/component.test.php +++ b/cake/tests/cases/libs/controller/component.test.php @@ -72,7 +72,7 @@ if (!class_exists('AppController')) { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class ParamTestComponent extends CakeObject { +class ParamTestComponent extends Object { /** * name property * @@ -133,7 +133,7 @@ class ComponentTestController extends AppController { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class AppleComponent extends CakeObject { +class AppleComponent extends Object { /** * components property * @@ -165,7 +165,7 @@ class AppleComponent extends CakeObject { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class OrangeComponent extends CakeObject { +class OrangeComponent extends Object { /** * components property * @@ -202,7 +202,7 @@ class OrangeComponent extends CakeObject { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class BananaComponent extends CakeObject { +class BananaComponent extends Object { /** * testField property * @@ -227,7 +227,7 @@ class BananaComponent extends CakeObject { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class MutuallyReferencingOneComponent extends CakeObject { +class MutuallyReferencingOneComponent extends Object { /** * components property * @@ -242,7 +242,7 @@ class MutuallyReferencingOneComponent extends CakeObject { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class MutuallyReferencingTwoComponent extends CakeObject { +class MutuallyReferencingTwoComponent extends Object { /** * components property * @@ -257,7 +257,7 @@ class MutuallyReferencingTwoComponent extends CakeObject { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class SomethingWithEmailComponent extends CakeObject { +class SomethingWithEmailComponent extends Object { /** * components property * @@ -302,19 +302,19 @@ class ComponentTest extends CakeTestCase { * @return void */ function testLoadComponents() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('RequestHandler'); - $Component = new Component(); + $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->plugin = 'test_plugin'; $Controller->components = array('RequestHandler', 'TestPluginComponent'); - $Component = new Component(); + $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->RequestHandler, 'RequestHandlerComponent')); @@ -325,19 +325,19 @@ class ComponentTest extends CakeTestCase { )); $this->assertFalse(isset($Controller->TestPluginOtherComponent)); - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Security'); - $Component = new Component(); + $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); $this->assertTrue(is_a($Controller->Security->Session, 'SessionComponent')); - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Security', 'Cookie', 'RequestHandler'); - $Component = new Component(); + $Component =& new Component(); $Component->init($Controller); $this->assertTrue(is_a($Controller->Security, 'SecurityComponent')); @@ -351,7 +351,7 @@ class ComponentTest extends CakeTestCase { * @return void */ function testNestedComponentLoading() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Apple'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); @@ -370,7 +370,7 @@ class ComponentTest extends CakeTestCase { * @return void */ function testComponentStartup() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Apple'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); @@ -390,7 +390,7 @@ class ComponentTest extends CakeTestCase { * @return void */ function testMultipleComponentInitialize() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Orange', 'Banana'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); @@ -409,7 +409,7 @@ class ComponentTest extends CakeTestCase { return; } - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple'); $Controller->constructClasses(); @@ -424,7 +424,7 @@ class ComponentTest extends CakeTestCase { $this->assertEqual($Controller->ParamTest->flag, true); //Settings are merged from app controller and current controller. - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array( 'ParamTest' => array('test' => 'value'), 'Orange' => array('ripeness' => 'perfect') @@ -443,7 +443,7 @@ class ComponentTest extends CakeTestCase { * @return void **/ function testComponentParamsNoDuplication() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('Orange' => array('setting' => array('itemx'))); $Controller->constructClasses(); @@ -457,7 +457,7 @@ class ComponentTest extends CakeTestCase { * @return void */ function testMutuallyReferencingComponents() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('MutuallyReferencingOne'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); @@ -481,7 +481,7 @@ class ComponentTest extends CakeTestCase { * @return void */ function testSomethingReferencingEmailComponent() { - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->components = array('SomethingWithEmail'); $Controller->constructClasses(); $Controller->Component->initialize($Controller); @@ -510,7 +510,7 @@ class ComponentTest extends CakeTestCase { function testDoubleLoadingOfSessionComponent() { $this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController'); - $Controller = new ComponentTestController(); + $Controller =& new ComponentTestController(); $Controller->uses = array(); $Controller->components = array('Session'); $Controller->constructClasses(); diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index f33eeef0..755d7ae1 100755 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/cake/tests/cases/libs/controller/components/acl.test.php @@ -165,10 +165,10 @@ class DbAclTwoTest extends DbAcl { * @return void */ function __construct() { - $this->Aro = new AroTwoTest(); - $this->Aro->Permission = new PermissionTwoTest(); - $this->Aco = new AcoTwoTest(); - $this->Aro->Permission = new PermissionTwoTest(); + $this->Aro =& new AroTwoTest(); + $this->Aro->Permission =& new PermissionTwoTest(); + $this->Aco =& new AcoTwoTest(); + $this->Aro->Permission =& new PermissionTwoTest(); } } /** @@ -200,7 +200,7 @@ class AclComponentTest extends CakeTestCase { * @return void */ function startTest() { - $this->Acl = new AclComponent(); + $this->Acl =& new AclComponent(); } /** * before method diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 3bf3358f..481b2dd5 100755 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -445,7 +445,7 @@ class AuthTest extends CakeTestCase { Configure::write('Acl.database', 'test_suite'); Configure::write('Acl.classname', 'DbAcl'); - $this->Controller = new AuthTestController(); + $this->Controller =& new AuthTestController(); $this->Controller->Component->init($this->Controller); ClassRegistry::addObject('view', new View($this->Controller)); @@ -509,7 +509,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testLogin() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user['id'] = 1; $user['username'] = 'mariano'; $user['password'] = Security::hash(Configure::read('Security.salt') . 'cake'); @@ -580,7 +580,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testAuthorizeFalse() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user = $this->AuthUser->find(); $this->Controller->Session->write('Auth', $user); $this->Controller->Auth->userModel = 'AuthUser'; @@ -605,7 +605,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testAuthorizeController() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user = $this->AuthUser->find(); $this->Controller->Session->write('Auth', $user); $this->Controller->Auth->userModel = 'AuthUser'; @@ -628,7 +628,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testAuthorizeModel() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user = $this->AuthUser->find(); $this->Controller->Session->write('Auth', $user); @@ -653,7 +653,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testAuthorizeCrud() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user = $this->AuthUser->find(); $this->Controller->Session->write('Auth', $user); @@ -951,7 +951,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testEmptyUsernameOrPassword() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user['id'] = 1; $user['username'] = 'mariano'; $user['password'] = Security::hash(Configure::read('Security.salt') . 'cake'); @@ -981,7 +981,7 @@ class AuthTest extends CakeTestCase { * @return void */ function testInjection() { - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $this->AuthUser->id = 2; $this->AuthUser->saveField('password', Security::hash(Configure::read('Security.salt') . 'cake')); @@ -1086,7 +1086,7 @@ class AuthTest extends CakeTestCase { 'argSeparator' => ':', 'namedArgs' => array() ))); - $this->AuthUser = new AuthUser(); + $this->AuthUser =& new AuthUser(); $user = array( 'id' => 1, 'username' => 'felix', 'password' => Security::hash(Configure::read('Security.salt') . 'cake' @@ -1131,7 +1131,7 @@ class AuthTest extends CakeTestCase { function testCustomField() { Router::reload(); - $this->AuthUserCustomField = new AuthUserCustomField(); + $this->AuthUserCustomField =& new AuthUserCustomField(); $user = array( 'id' => 1, 'email' => 'harking@example.com', 'password' => Security::hash(Configure::read('Security.salt') . 'cake' @@ -1208,7 +1208,7 @@ class AuthTest extends CakeTestCase { } ob_start(); - $Dispatcher = new Dispatcher(); + $Dispatcher =& new Dispatcher(); $Dispatcher->dispatch('/ajax_auth/add', array('return' => 1)); $result = ob_get_clean(); $this->assertEqual("Ajax!\nthis is the test element", $result); diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index 44feb8db..8baf95e4 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -181,7 +181,7 @@ class EmailComponentTest extends CakeTestCase { $this->_appEncoding = Configure::read('App.encoding'); Configure::write('App.encoding', 'UTF-8'); - $this->Controller = new EmailTestController(); + $this->Controller =& new EmailTestController(); restore_error_handler(); @$this->Controller->Component->init($this->Controller); @@ -470,7 +470,7 @@ TEXTBLOC; $this->skipIf(!@fsockopen('localhost', 25), '%s No SMTP server running on localhost'); $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->assertTrue($this->Controller->EmailTest->getConnectionSocket()); diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php index fe2a2df9..f744f2dc 100755 --- a/cake/tests/cases/libs/controller/components/security.test.php +++ b/cake/tests/cases/libs/controller/components/security.test.php @@ -137,7 +137,7 @@ class SecurityComponentTest extends CakeTestCase { * @return void */ function setUp() { - $this->Controller = new SecurityTestController(); + $this->Controller =& new SecurityTestController(); $this->Controller->Component->init($this->Controller); $this->Controller->Security =& $this->Controller->TestSecurity; $this->Controller->Security->blackHoleCallback = 'fail'; diff --git a/cake/tests/cases/libs/controller/components/session.test.php b/cake/tests/cases/libs/controller/components/session.test.php index 25802217..b79f043c 100755 --- a/cake/tests/cases/libs/controller/components/session.test.php +++ b/cake/tests/cases/libs/controller/components/session.test.php @@ -107,20 +107,20 @@ class SessionComponentTest extends CakeTestCase { */ function testSessionAutoStart() { Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->__active); $this->assertFalse($Session->__started); $Session->startup(new SessionTestController()); Configure::write('Session.start', true); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertTrue($Session->__active); $this->assertFalse($Session->__started); $Session->startup(new SessionTestController()); $this->assertTrue(isset($_SESSION)); $Object = new Object(); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->start(); $expected = $Session->id(); @@ -137,14 +137,14 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionInitialize() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertEqual($Session->__bare, 0); $Session->initialize(new SessionTestController()); $this->assertEqual($Session->__bare, 0); - $sessionController = new SessionTestController(); + $sessionController =& new SessionTestController(); $sessionController->params['bare'] = 1; $Session->initialize($sessionController); $this->assertEqual($Session->__bare, 1); @@ -156,14 +156,14 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionActivate() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertTrue($Session->__active); $this->assertNull($Session->activate()); $this->assertTrue($Session->__active); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->__active); $this->assertNull($Session->activate()); $this->assertTrue($Session->__active); @@ -177,7 +177,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionValid() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertTrue($Session->valid()); @@ -185,17 +185,17 @@ class SessionComponentTest extends CakeTestCase { $this->assertFalse($Session->valid()); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->__active); $this->assertFalse($Session->valid()); Configure::write('Session.start', true); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->time = $Session->read('Config.time') + 1; $this->assertFalse($Session->valid()); Configure::write('Session.checkAgent', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->time = $Session->read('Config.time') + 1; $this->assertFalse($Session->valid()); Configure::write('Session.checkAgent', true); @@ -207,12 +207,12 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionError() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->error()); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->__active); $this->assertFalse($Session->error()); Configure::write('Session.start', true); @@ -224,7 +224,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionReadWrite() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->read('Test')); @@ -251,7 +251,7 @@ class SessionComponentTest extends CakeTestCase { $Session->del('Test'); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->write('Test', 'some value')); $Session->write('Test', 'some value'); $this->assertFalse($Session->read('Test')); @@ -264,7 +264,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionDel() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->del('Test')); @@ -272,7 +272,7 @@ class SessionComponentTest extends CakeTestCase { $this->assertTrue($Session->del('Test')); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->write('Test', 'some value'); $this->assertFalse($Session->del('Test')); Configure::write('Session.start', true); @@ -284,7 +284,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionDelete() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->delete('Test')); @@ -292,7 +292,7 @@ class SessionComponentTest extends CakeTestCase { $this->assertTrue($Session->delete('Test')); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->write('Test', 'some value'); $this->assertFalse($Session->delete('Test')); Configure::write('Session.start', true); @@ -304,7 +304,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionCheck() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertFalse($Session->check('Test')); @@ -313,7 +313,7 @@ class SessionComponentTest extends CakeTestCase { $Session->delete('Test'); Configure::write('Session.start', false); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->write('Test', 'some value'); $this->assertFalse($Session->check('Test')); Configure::write('Session.start', true); @@ -325,7 +325,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionFlash() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertNull($Session->read('Message.flash')); @@ -351,7 +351,7 @@ class SessionComponentTest extends CakeTestCase { */ function testSessionId() { unset($_SESSION); - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $this->assertNull($Session->id()); } /** @@ -361,7 +361,7 @@ class SessionComponentTest extends CakeTestCase { * @return void */ function testSessionDestroy() { - $Session = new SessionComponent(); + $Session =& new SessionComponent(); $Session->write('Test', 'some value'); $this->assertEqual($Session->read('Test'), 'some value'); diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 90baed20..8c7b3204 100755 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -328,7 +328,7 @@ class TestController extends AppController { * @package cake * @subpackage cake.tests.cases.libs.controller */ -class TestComponent extends CakeObject { +class TestComponent extends Object { /** * beforeRedirect method * @@ -380,7 +380,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testConstructClasses() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->modelClass = 'ControllerPost'; $Controller->passedArgs[] = '1'; $Controller->constructClasses(); @@ -388,7 +388,7 @@ class ControllerTest extends CakeTestCase { unset($Controller); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->passedArgs[] = '1'; $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)); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('TestPlugin.TestPluginPost'); $Controller->constructClasses(); @@ -422,7 +422,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testAliasName() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('NameTest'); $Controller->constructClasses(); @@ -439,7 +439,7 @@ class ControllerTest extends CakeTestCase { */ function testPersistent() { Configure::write('Cache.disable', false); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->modelClass = 'ControllerPost'; $Controller->persistModel = true; $Controller->constructClasses(); @@ -458,7 +458,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testPaginate() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->passedArgs[] = '1'; $Controller->params['url'] = array(); @@ -519,7 +519,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testPaginateExtraParams() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->passedArgs[] = '1'; $Controller->params['url'] = array(); @@ -551,7 +551,7 @@ class ControllerTest extends CakeTestCase { $this->assertEqual($Controller->ControllerPost->lastQuery['limit'], 12); $this->assertEqual($paging['options']['limit'], 12); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPaginateModel'); $Controller->params['url'] = array(); $Controller->constructClasses(); @@ -578,7 +578,7 @@ class ControllerTest extends CakeTestCase { * @access public */ function testPaginatePassedArgs() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPost'); $Controller->passedArgs[] = array('1', '2', '3'); $Controller->params['url'] = array(); @@ -610,7 +610,7 @@ class ControllerTest extends CakeTestCase { * @return void **/ function testPaginateSpecialType() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('ControllerPost', 'ControllerComment'); $Controller->passedArgs[] = '1'; $Controller->params['url'] = array(); @@ -631,7 +631,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testDefaultPaginateParams() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->modelClass = 'ControllerPost'; $Controller->params['url'] = array(); $Controller->paginate = array('order' => 'ControllerPost.id DESC'); @@ -648,7 +648,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testFlash() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->flash('this should work', '/flash'); $result = $Controller->output; @@ -678,7 +678,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testControllerSet() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->set('variable_with_underscores', null); $this->assertTrue(array_key_exists('variable_with_underscores', $Controller->viewVars)); @@ -713,7 +713,7 @@ class ControllerTest extends CakeTestCase { 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)); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->viewPath = 'posts'; $result = $Controller->render('index'); @@ -744,7 +744,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testToBeInheritedGuardmethods() { - $Controller = new Controller(); + $Controller =& new Controller(); $this->assertTrue($Controller->_beforeScaffold('')); $this->assertTrue($Controller->_afterScaffoldSave('')); $this->assertTrue($Controller->_afterScaffoldSaveError('')); @@ -806,8 +806,8 @@ class ControllerTest extends CakeTestCase { App::import('Helper', 'Cache'); foreach ($codes as $code => $msg) { - $MockController = new MockController(); - $MockController->Component = new Component(); + $MockController =& new MockController(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}")); $MockController->expectAt(1, 'header', array('Location: http://cakephp.org')); @@ -816,8 +816,8 @@ class ControllerTest extends CakeTestCase { $this->assertFalse($MockController->autoRender); } foreach ($codes as $code => $msg) { - $MockController = new MockController(); - $MockController->Component = new Component(); + $MockController =& new MockController(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}")); $MockController->expectAt(1, 'header', array('Location: http://cakephp.org')); @@ -826,24 +826,24 @@ class ControllerTest extends CakeTestCase { $this->assertFalse($MockController->autoRender); } - $MockController = new MockController(); - $MockController->Component = new Component(); + $MockController =& new MockController(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->expectAt(0, 'header', array('Location: http://www.example.org/users/login')); $MockController->expectCallCount('header', 1); $MockController->redirect('http://www.example.org/users/login', null, false); - $MockController = new MockController(); - $MockController->Component = new Component(); + $MockController =& new MockController(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); $MockController->expectAt(1, 'header', array('Location: http://www.example.org/users/login')); $MockController->expectCallCount('header', 2); $MockController->redirect('http://www.example.org/users/login', 301, false); - $MockController = new MockController(); + $MockController =& new MockController(); $MockController->components = array('MockTest'); - $MockController->Component = new Component(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->MockTest->setReturnValue('beforeRedirect', null); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); @@ -851,9 +851,9 @@ class ControllerTest extends CakeTestCase { $MockController->expectCallCount('header', 2); $MockController->redirect('http://cakephp.org', 301, false); - $MockController = new MockController(); + $MockController =& new MockController(); $MockController->components = array('MockTest'); - $MockController->Component = new Component(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org'); $MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently')); @@ -861,17 +861,17 @@ class ControllerTest extends CakeTestCase { $MockController->expectCallCount('header', 2); $MockController->redirect('http://cakephp.org', 301, false); - $MockController = new MockController(); + $MockController =& new MockController(); $MockController->components = array('MockTest'); - $MockController->Component = new Component(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->MockTest->setReturnValue('beforeRedirect', false); $MockController->expectNever('header'); $MockController->redirect('http://cakephp.org', 301, false); - $MockController = new MockController(); + $MockController =& new MockController(); $MockController->components = array('MockTest', 'MockTestB'); - $MockController->Component = new Component(); + $MockController->Component =& new Component(); $MockController->Component->init($MockController); $MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org'); $MockController->MockTestB->setReturnValue('beforeRedirect', 'http://bakery.cakephp.org'); @@ -891,7 +891,7 @@ class ControllerTest extends CakeTestCase { return; } - $TestController = new TestController(); + $TestController =& new TestController(); $TestController->constructClasses(); $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_assoc(Set::normalize($TestController->components), Set::normalize($components))), 0); - $TestController = new AnotherTestController(); + $TestController =& new AnotherTestController(); $TestController->constructClasses(); $appVars = get_class_vars('AppController'); @@ -927,7 +927,7 @@ class ControllerTest extends CakeTestCase { $this->assertFalse(isset($TestController->ControllerPost)); - $TestController = new ControllerCommentsController(); + $TestController =& new ControllerCommentsController(); $TestController->constructClasses(); $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')) { return; } - $TestController = new TestController(); + $TestController =& new TestController(); $expected = array('foo'); $TestController->components = array('Cookie' => $expected); $TestController->constructClasses(); @@ -963,7 +963,7 @@ class ControllerTest extends CakeTestCase { * @return void **/ function testMergeVarsNotGreedy() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->components = array(); $Controller->uses = array(); $Controller->constructClasses(); @@ -977,7 +977,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testReferer() { - $Controller = new Controller(); + $Controller =& new Controller(); $_SERVER['HTTP_REFERER'] = 'http://cakephp.org'; $result = $Controller->referer(null, false); $expected = 'http://cakephp.org'; @@ -1023,7 +1023,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testSetAction() { - $TestController = new TestController(); + $TestController =& new TestController(); $TestController->setAction('index', 1, 2); $expected = array('testId' => 1, 'test2Id' => 2); $this->assertidentical($TestController->data, $expected); @@ -1035,7 +1035,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testUnimplementedIsAuthorized() { - $TestController = new TestController(); + $TestController =& new TestController(); $TestController->isAuthorized(); $this->assertError(); } @@ -1046,7 +1046,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testValidateErrors() { - $TestController = new TestController(); + $TestController =& new TestController(); $TestController->constructClasses(); $this->assertFalse($TestController->validateErrors()); $this->assertEqual($TestController->validate(), 0); @@ -1067,7 +1067,7 @@ class ControllerTest extends CakeTestCase { * @return void */ function testPostConditions() { - $Controller = new Controller(); + $Controller =& new Controller(); $data = array( @@ -1132,7 +1132,7 @@ class ControllerTest extends CakeTestCase { */ function testRequestHandlerPrefers(){ Configure::write('debug', 2); - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->components = array("RequestHandler"); $Controller->modelClass='ControllerPost'; $Controller->params['url']['ext'] = 'rss'; diff --git a/cake/tests/cases/libs/controller/controller_merge_vars.test.php b/cake/tests/cases/libs/controller/controller_merge_vars.test.php index b7cf274c..b405d3ec 100755 --- a/cake/tests/cases/libs/controller/controller_merge_vars.test.php +++ b/cake/tests/cases/libs/controller/controller_merge_vars.test.php @@ -53,7 +53,7 @@ if (!class_exists('AppController')) { * * @package cake.tests.cases.libs.controller **/ -class MergeVarComponent extends CakeObject { +class MergeVarComponent extends Object { } @@ -139,7 +139,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { * @return void **/ function testComponentParamMergingNoDuplication() { - $Controller = new MergeVariablesController(); + $Controller =& new MergeVariablesController(); $Controller->constructClasses(); $expected = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false)); @@ -151,7 +151,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { * @return void **/ function testComponentMergingWithRedeclarations() { - $Controller = new MergeVariablesController(); + $Controller =& new MergeVariablesController(); $Controller->components['MergeVar'] = array('remote', 'redirect' => true); $Controller->constructClasses(); @@ -164,7 +164,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { * @return void **/ function testHelperSettingMergingNoDuplication() { - $Controller = new MergeVariablesController(); + $Controller =& new MergeVariablesController(); $Controller->constructClasses(); $expected = array('MergeVar' => array('format' => 'html', 'terse')); @@ -176,7 +176,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { * @return void **/ function testMergeVarsWithPlugin() { - $Controller = new MergePostsController(); + $Controller =& new MergePostsController(); $Controller->components = array('Email' => array('ports' => 'open')); $Controller->plugin = 'MergeVarPlugin'; $Controller->constructClasses(); @@ -194,7 +194,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { ); $this->assertEqual($Controller->helpers, $expected, 'Helpers are unexpected %s'); - $Controller = new MergePostsController(); + $Controller =& new MergePostsController(); $Controller->components = array(); $Controller->plugin = 'MergeVarPlugin'; $Controller->constructClasses(); @@ -212,7 +212,7 @@ class ControllerMergeVarsTestCase extends CakeTestCase { * @return void **/ function testMergeVarsNotGreedy() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->components = array(); $Controller->uses = array(); $Controller->constructClasses(); diff --git a/cake/tests/cases/libs/controller/pages_controller.test.php b/cake/tests/cases/libs/controller/pages_controller.test.php index 53aef113..66980e74 100755 --- a/cake/tests/cases/libs/controller/pages_controller.test.php +++ b/cake/tests/cases/libs/controller/pages_controller.test.php @@ -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)); - $Pages = new PagesController(); + $Pages =& new PagesController(); $Pages->viewPath = 'posts'; $Pages->display('index'); diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index c22822bd..72cab3eb 100755 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -262,7 +262,7 @@ class ScaffoldViewTest extends CakeTestCase { * @return void */ function startTest() { - $this->Controller = new ScaffoldMockController(); + $this->Controller =& new ScaffoldMockController(); } /** * endTest method @@ -284,7 +284,7 @@ class ScaffoldViewTest extends CakeTestCase { Configure::write('Routing.admin', 'admin'); $this->Controller->action = 'index'; - $ScaffoldView = new TestScaffoldView($this->Controller); + $ScaffoldView =& new TestScaffoldView($this->Controller); $result = $ScaffoldView->testGetFilename('index'); $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS . 'scaffolds' . DS . 'index.ctp'; $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('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)); - $Controller = new ScaffoldMockController(); + $Controller =& new ScaffoldMockController(); $Controller->scaffold = 'admin'; $Controller->viewPath = 'posts'; $Controller->action = 'admin_edit'; - $ScaffoldView = new TestScaffoldView($Controller); + $ScaffoldView =& new TestScaffoldView($Controller); $result = $ScaffoldView->testGetFilename('admin_edit'); $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' .DS . 'views' . DS . 'posts' . DS . 'scaffold.edit.ctp'; $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'; $this->assertEqual($result, $expected); - $Controller = new ScaffoldMockController(); + $Controller =& new ScaffoldMockController(); $Controller->scaffold = 'admin'; $Controller->viewPath = 'tests'; $Controller->plugin = 'test_plugin'; $Controller->action = 'admin_add'; - $ScaffoldView = new TestScaffoldView($Controller); + $ScaffoldView =& new TestScaffoldView($Controller); $result = $ScaffoldView->testGetFilename('admin_add'); $expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS .'test_plugin' . DS . 'views' . DS . 'tests' . DS . 'scaffold.edit.ctp'; @@ -595,7 +595,7 @@ class ScaffoldTest extends CakeTestCase { * @return void */ function startTest() { - $this->Controller = new ScaffoldMockController(); + $this->Controller =& new ScaffoldMockController(); } /** * endTest method @@ -634,7 +634,7 @@ class ScaffoldTest extends CakeTestCase { $this->Controller->controller = 'scaffold_mock'; $this->Controller->base = '/'; $this->Controller->constructClasses(); - $Scaffold = new TestScaffoldMock($this->Controller, $params); + $Scaffold =& new TestScaffoldMock($this->Controller, $params); $result = $Scaffold->getParams(); $this->assertEqual($result['action'], 'admin_edit'); } @@ -664,7 +664,7 @@ class ScaffoldTest extends CakeTestCase { $this->Controller->controller = 'scaffold_mock'; $this->Controller->base = '/'; $this->Controller->constructClasses(); - $Scaffold = new TestScaffoldMock($this->Controller, $params); + $Scaffold =& new TestScaffoldMock($this->Controller, $params); $result = $Scaffold->controller->viewVars; $this->assertEqual($result['singularHumanName'], 'Scaffold Mock'); diff --git a/cake/tests/cases/libs/error.test.php b/cake/tests/cases/libs/error.test.php index 550fb1ef..e3d233e1 100755 --- a/cake/tests/cases/libs/error.test.php +++ b/cake/tests/cases/libs/error.test.php @@ -36,7 +36,7 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { * @package cake * @subpackage cake.tests.cases.libs */ -class BlueberryComponent extends CakeObject { +class BlueberryComponent extends Object { /** * testName property * @@ -261,7 +261,7 @@ class ErrorHandlerTest extends CakeTestCase { $this->assertPattern("/'\/test_error'<\/strong>/", $result); ob_start(); - $TestErrorHandler = new TestErrorHandler('error404', array('message' => 'Page not found')); + $TestErrorHandler =& new TestErrorHandler('error404', array('message' => 'Page not found')); ob_get_clean(); ob_start(); $TestErrorHandler->error404(array( diff --git a/cake/tests/cases/libs/file.test.php b/cake/tests/cases/libs/file.test.php index ad668e1b..f0d64a7b 100755 --- a/cake/tests/cases/libs/file.test.php +++ b/cake/tests/cases/libs/file.test.php @@ -47,7 +47,7 @@ class FileTest extends CakeTestCase { */ function testBasic() { $file = __FILE__; - $this->File = new File($file); + $this->File =& new File($file); $result = $this->File->pwd(); $expecting = $file; @@ -209,7 +209,7 @@ class FileTest extends CakeTestCase { */ function testCreate() { $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; - $File = new File($tmpFile, true, 0777); + $File =& new File($tmpFile, true, 0777); $this->assertTrue($File->exists()); } /** @@ -219,7 +219,7 @@ class FileTest extends CakeTestCase { * @return void */ function testOpeningNonExistantFileCreatesIt() { - $someFile = new File(TMP . 'some_file.txt', false); + $someFile =& new File(TMP . 'some_file.txt', false); $this->assertTrue($someFile->open()); $this->assertEqual($someFile->read(), ''); $someFile->close(); @@ -252,7 +252,7 @@ class FileTest extends CakeTestCase { * @return void */ 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->readable()); $someFile->close(); @@ -265,7 +265,7 @@ class FileTest extends CakeTestCase { * @return void */ 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->writable()); $someFile->close(); @@ -278,7 +278,7 @@ class FileTest extends CakeTestCase { * @return void */ function testExecutable() { - $someFile = new File(TMP . 'some_file.txt', false); + $someFile =& new File(TMP . 'some_file.txt', false); $this->assertTrue($someFile->open()); $this->assertFalse($someFile->executable()); $someFile->close(); @@ -291,7 +291,7 @@ class FileTest extends CakeTestCase { * @return void */ function testLastAccess() { - $someFile = new File(TMP . 'some_file.txt', false); + $someFile =& new File(TMP . 'some_file.txt', false); $this->assertFalse($someFile->lastAccess()); $this->assertTrue($someFile->open()); $this->assertEqual($someFile->lastAccess(), time()); @@ -305,7 +305,7 @@ class FileTest extends CakeTestCase { * @return void */ function testLastChange() { - $someFile = new File(TMP . 'some_file.txt', false); + $someFile =& new File(TMP . 'some_file.txt', false); $this->assertFalse($someFile->lastChange()); $this->assertTrue($someFile->open('r+')); $this->assertEqual($someFile->lastChange(), time()); @@ -328,7 +328,7 @@ class FileTest extends CakeTestCase { unlink($tmpFile); } - $TmpFile = new File($tmpFile); + $TmpFile =& new File($tmpFile); $this->assertFalse(file_exists($tmpFile)); $this->assertFalse(is_resource($TmpFile->handle)); @@ -358,7 +358,7 @@ class FileTest extends CakeTestCase { unlink($tmpFile); } - $TmpFile = new File($tmpFile); + $TmpFile =& new File($tmpFile); $this->assertFalse(file_exists($tmpFile)); $fragments = array('CakePHP\'s', ' test suite', ' was here ...', ''); @@ -386,13 +386,13 @@ class FileTest extends CakeTestCase { if (!file_exists($tmpFile)) { touch($tmpFile); } - $TmpFile = new File($tmpFile); + $TmpFile =& new File($tmpFile); $this->assertTrue(file_exists($tmpFile)); $result = $TmpFile->delete(); $this->assertTrue($result); $this->assertFalse(file_exists($tmpFile)); - $TmpFile = new File('/this/does/not/exist'); + $TmpFile =& new File('/this/does/not/exist'); $result = $TmpFile->delete(); $this->assertFalse($result); } diff --git a/cake/tests/cases/libs/folder.test.php b/cake/tests/cases/libs/folder.test.php index a3915a09..6fad570d 100755 --- a/cake/tests/cases/libs/folder.test.php +++ b/cake/tests/cases/libs/folder.test.php @@ -40,7 +40,7 @@ class FolderTest extends CakeTestCase { */ function testBasic() { $path = dirname(__FILE__); - $Folder = new Folder($path); + $Folder =& new Folder($path); $result = $Folder->pwd(); $this->assertEqual($result, $path); @@ -66,7 +66,7 @@ class FolderTest extends CakeTestCase { $path = dirname(dirname(__FILE__)); $inside = dirname($path) . DS; - $Folder = new Folder($path); + $Folder =& new Folder($path); $result = $Folder->pwd(); $this->assertEqual($result, $path); @@ -91,7 +91,7 @@ class FolderTest extends CakeTestCase { */ function testOperations() { $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()); $this->assertTrue($result); @@ -150,7 +150,7 @@ class FolderTest extends CakeTestCase { $result = $Folder->delete(); $this->assertTrue($result); - $Folder = new Folder('non-existent'); + $Folder =& new Folder('non-existent'); $result = $Folder->pwd(); $this->assertNull($result); } @@ -164,7 +164,7 @@ class FolderTest extends CakeTestCase { $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'; - $Folder = new Folder($path); + $Folder =& new Folder($path); $subdir = 'test_folder_new'; $new = TMP . $subdir; @@ -174,7 +174,7 @@ class FolderTest extends CakeTestCase { $this->assertTrue($Folder->create($new . DS . 'test2')); $filePath = $new . DS . 'test1.php'; - $File = new File($filePath); + $File =& new File($filePath); $this->assertTrue($File->create()); $copy = TMP . 'test_folder_copy'; @@ -200,7 +200,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testZeroAsDirectory() { - $Folder = new Folder(TMP); + $Folder =& new Folder(TMP); $new = TMP . '0'; $this->assertTrue($Folder->create($new)); @@ -222,7 +222,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testFolderRead() { - $Folder = new Folder(TMP); + $Folder =& new Folder(TMP); $expected = array('cache', 'logs', 'sessions', 'tests'); $result = $Folder->read(true, true); @@ -240,7 +240,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testFolderTree() { - $Folder = new Folder(); + $Folder =& new Folder(); $expected = array( array( TEST_CAKE_CORE_INCLUDE_PATH . 'config', @@ -380,7 +380,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testInCakePath() { - $Folder = new Folder(); + $Folder =& new Folder(); $Folder->cd(ROOT); $path = 'C:\\path\\to\\file'; $result = $Folder->inCakePath($path); @@ -404,7 +404,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testFind() { - $Folder = new Folder(); + $Folder =& new Folder(); $Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config'); $result = $Folder->find(); $expected = array('config.php', 'paths.php'); @@ -456,7 +456,7 @@ class FolderTest extends CakeTestCase { * @return void */ function testFindRecursive() { - $Folder = new Folder(); + $Folder =& new Folder(); $Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH); $result = $Folder->findRecursive('(config|paths)\.php'); $expected = array( @@ -476,7 +476,7 @@ class FolderTest extends CakeTestCase { $Folder->cd(TMP); $Folder->mkdir($Folder->pwd() . DS . 'testme'); $Folder->cd('testme'); - $File = new File($Folder->pwd() . DS . 'paths.php'); + $File =& new File($Folder->pwd() . DS . 'paths.php'); $File->create(); $Folder->cd(TMP . 'sessions'); $result = $Folder->findRecursive('paths\.php'); @@ -484,7 +484,7 @@ class FolderTest extends CakeTestCase { $this->assertIdentical($result, $expected); $Folder->cd(TMP . 'testme'); - $File = new File($Folder->pwd() . DS . 'my.php'); + $File =& new File($Folder->pwd() . DS . 'my.php'); $File->create(); $Folder->cd($Folder->pwd() . '/../..'); @@ -515,7 +515,7 @@ class FolderTest extends CakeTestCase { * @return void */ 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')); $Folder->cd(TMP); $Folder->delete($Folder->pwd() . 'config_non_existant'); @@ -527,10 +527,10 @@ class FolderTest extends CakeTestCase { * @return void */ function testDirSize() { - $Folder = new Folder(TMP . 'config_non_existant', true); + $Folder =& new Folder(TMP . 'config_non_existant', true); $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->write('something here'); $File->close(); @@ -547,7 +547,7 @@ class FolderTest extends CakeTestCase { */ function testDelete() { $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 . 'file2'); @@ -593,35 +593,35 @@ class FolderTest extends CakeTestCase { touch($file1); touch($file2); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->copy($folder3); $this->assertTrue($result); $this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php')); - $Folder = new Folder($folder3); + $Folder =& new Folder($folder3); $Folder->delete(); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->copy($folder3); $this->assertTrue($result); $this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php')); - $Folder = new Folder($folder3); + $Folder =& new Folder($folder3); $Folder->delete(); new Folder($folder3, true); new Folder($folder3 . DS . 'folder2', true); file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched'); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->copy($folder3); $this->assertTrue($result); $this->assertTrue(file_exists($folder3 . DS . 'file1.php')); $this->assertEqual(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched'); - $Folder = new Folder($path); + $Folder =& new Folder($path); $Folder->delete(); } /** @@ -651,7 +651,7 @@ class FolderTest extends CakeTestCase { touch($file1); touch($file2); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->move($folder3); $this->assertTrue($result); $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($file2)); - $Folder = new Folder($folder3); + $Folder =& new Folder($folder3); $Folder->delete(); new Folder($folder1, true); @@ -669,7 +669,7 @@ class FolderTest extends CakeTestCase { touch($file1); touch($file2); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->move($folder3); $this->assertTrue($result); $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($file2)); - $Folder = new Folder($folder3); + $Folder =& new Folder($folder3); $Folder->delete(); new Folder($folder1, true); @@ -690,7 +690,7 @@ class FolderTest extends CakeTestCase { touch($file2); file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched'); - $Folder = new Folder($folder1); + $Folder =& new Folder($folder1); $result = $Folder->move($folder3); $this->assertTrue($result); $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($file2)); - $Folder = new Folder($path); + $Folder =& new Folder($path); $Folder->delete(); } } diff --git a/cake/tests/cases/libs/http_socket.test.php b/cake/tests/cases/libs/http_socket.test.php index c169ce27..b3fa948b 100755 --- a/cake/tests/cases/libs/http_socket.test.php +++ b/cake/tests/cases/libs/http_socket.test.php @@ -58,8 +58,8 @@ class HttpSocketTest extends CakeTestCase { Mock::generatePartial('HttpSocket', 'TestHttpSocketRequests', array('read', 'write', 'connect', 'request')); } - $this->Socket = new TestHttpSocket(); - $this->RequestSocket = new TestHttpSocketRequests(); + $this->Socket =& new TestHttpSocket(); + $this->RequestSocket =& new TestHttpSocketRequests(); } /** * We use this function to clean up after the test case was executed diff --git a/cake/tests/cases/libs/l10n.test.php b/cake/tests/cases/libs/l10n.test.php index 8a3a32bb..48df8fa3 100755 --- a/cake/tests/cases/libs/l10n.test.php +++ b/cake/tests/cases/libs/l10n.test.php @@ -39,7 +39,7 @@ class L10nTest extends CakeTestCase { * @return void */ function testGet() { - $l10n = new L10n(); + $l10n =& new L10n(); // Catalog Entry $l10n->get('en'); @@ -124,7 +124,7 @@ class L10nTest extends CakeTestCase { $__SERVER = $_SERVER; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca'; - $l10n = new L10n(); + $l10n =& new L10n(); $l10n->get(); $result = $l10n->language; $expected = 'English (Canadian)'; @@ -175,7 +175,7 @@ class L10nTest extends CakeTestCase { * @return void */ function testMap() { - $l10n = new L10n(); + $l10n =& new L10n(); $result = $l10n->map(array('afr', 'af')); $expected = array('afr' => 'af', 'af' => 'afr'); @@ -496,7 +496,7 @@ class L10nTest extends CakeTestCase { * @return void */ function testCatalog() { - $l10n = new L10n(); + $l10n =& new L10n(); $result = $l10n->catalog(array('af')); $expected = array( diff --git a/cake/tests/cases/libs/magic_db.test.php b/cake/tests/cases/libs/magic_db.test.php index e383faf1..3eba7eb4 100755 --- a/cake/tests/cases/libs/magic_db.test.php +++ b/cake/tests/cases/libs/magic_db.test.php @@ -43,7 +43,7 @@ class MagicDbTest extends UnitTestCase { * @access public */ function setUp() { - $this->Db = new MagicDb(); + $this->Db =& new MagicDb(); } /** * MagicDb::analyze should properly detect the file type and output additional info as requested. @@ -158,7 +158,7 @@ class MagicDbTest extends UnitTestCase { * @package cake * @subpackage cake.tests.cases.libs */ -class MagicDbTestData extends CakeObject { +class MagicDbTestData extends Object { /** * Base64 encoded data * diff --git a/cake/tests/cases/libs/model/behavior.test.php b/cake/tests/cases/libs/model/behavior.test.php index 374741a9..727316a2 100755 --- a/cake/tests/cases/libs/model/behavior.test.php +++ b/cake/tests/cases/libs/model/behavior.test.php @@ -983,7 +983,7 @@ class BehaviorTest extends CakeTestCase { * @return void */ function testBehaviorTrigger() { - $Apple = new Apple(); + $Apple =& new Apple(); $Apple->Behaviors->attach('Test'); $Apple->Behaviors->attach('Test2'); $Apple->Behaviors->attach('Test3'); @@ -1057,7 +1057,7 @@ class BehaviorTest extends CakeTestCase { * @return void **/ function testBehaviorAttachAndDetach() { - $Sample = new Sample(); + $Sample =& new Sample(); $Sample->actsAs = array('Test3' => array('bar'), 'Test2' => array('foo', 'bar')); $Sample->Behaviors->init($Sample->alias, $Sample->actsAs); $Sample->Behaviors->attach('Test2'); diff --git a/cake/tests/cases/libs/model/behaviors/acl.test.php b/cake/tests/cases/libs/model/behaviors/acl.test.php index f58a6730..3ca1974e 100755 --- a/cake/tests/cases/libs/model/behaviors/acl.test.php +++ b/cake/tests/cases/libs/model/behaviors/acl.test.php @@ -210,8 +210,8 @@ class AclBehaviorTestCase extends CakeTestCase { function startTest() { Configure::write('Acl.database', 'test_suite'); - $this->Aco = new Aco(); - $this->Aro = new Aro(); + $this->Aco =& new Aco(); + $this->Aro =& new Aro(); } /** * tearDown method @@ -230,12 +230,12 @@ class AclBehaviorTestCase extends CakeTestCase { * @access public */ function testSetup() { - $User = new AclUser(); + $User =& new AclUser(); $this->assertTrue(isset($User->Behaviors->Acl->settings['User'])); $this->assertEqual($User->Behaviors->Acl->settings['User']['type'], 'requester'); $this->assertTrue(is_object($User->Aro)); - $Post = new AclPost(); + $Post =& new AclPost(); $this->assertTrue(isset($Post->Behaviors->Acl->settings['Post'])); $this->assertEqual($Post->Behaviors->Acl->settings['Post']['type'], 'controlled'); $this->assertTrue(is_object($Post->Aco)); @@ -247,7 +247,7 @@ class AclBehaviorTestCase extends CakeTestCase { * @access public */ function testAfterSave() { - $Post = new AclPost(); + $Post =& new AclPost(); $data = array( 'Post' => array( 'author_id' => 1, @@ -271,7 +271,7 @@ class AclBehaviorTestCase extends CakeTestCase { ); $this->Aro->save($aroData); - $Person = new AclPerson(); + $Person =& new AclPerson(); $data = array( 'AclPerson' => array( 'name' => 'Trent', @@ -304,7 +304,7 @@ class AclBehaviorTestCase extends CakeTestCase { ) ); $this->Aro->save($aroData); - $Person = new AclPerson(); + $Person =& new AclPerson(); $data = array( 'AclPerson' => array( 'name' => 'Trent', @@ -349,7 +349,7 @@ class AclBehaviorTestCase extends CakeTestCase { * @access public */ function testNode() { - $Person = new AclPerson(); + $Person =& new AclPerson(); $aroData = array( 'Aro' => array( 'model' => 'AclPerson', diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index 58f0276b..ca16f318 100755 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -3123,7 +3123,7 @@ class ContainableBehaviorTest extends CakeTestCase { * @return void */ function testPaginate() { - $Controller = new Controller(); + $Controller =& new Controller(); $Controller->uses = array('Article'); $Controller->passedArgs[] = '1'; $Controller->params['url'] = array(); diff --git a/cake/tests/cases/libs/model/behaviors/translate.test.php b/cake/tests/cases/libs/model/behaviors/translate.test.php index 36b60180..3ec69f02 100755 --- a/cake/tests/cases/libs/model/behaviors/translate.test.php +++ b/cake/tests/cases/libs/model/behaviors/translate.test.php @@ -70,22 +70,22 @@ class TranslateBehaviorTest extends CakeTestCase { * @return void */ function testTranslateModel() { - $TestModel = new Tag(); + $TestModel =& new Tag(); $TestModel->translateTable = 'another_i18n'; $TestModel->Behaviors->attach('Translate', array('title')); $this->assertEqual($TestModel->translateModel()->name, 'I18nModel'); $this->assertEqual($TestModel->translateModel()->useTable, 'another_i18n'); - $TestModel = new User(); + $TestModel =& new User(); $TestModel->Behaviors->attach('Translate', array('title')); $this->assertEqual($TestModel->translateModel()->name, 'I18nModel'); $this->assertEqual($TestModel->translateModel()->useTable, 'i18n'); - $TestModel = new TranslatedArticle(); + $TestModel =& new TranslatedArticle(); $this->assertEqual($TestModel->translateModel()->name, 'TranslateArticleModel'); $this->assertEqual($TestModel->translateModel()->useTable, 'article_i18n'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $this->assertEqual($TestModel->translateModel()->name, 'TranslateTestModel'); $this->assertEqual($TestModel->translateModel()->useTable, 'i18n'); } @@ -98,7 +98,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleFalsePlain() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = false; $result = $TestModel->read(null, 1); @@ -122,7 +122,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleFalseAssociations() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = false; $TestModel->unbindTranslation(); $translations = array('title' => 'Title', 'content' => 'Content'); @@ -176,7 +176,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleSingle() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $result = $TestModel->read(null, 1); $expected = array( @@ -231,7 +231,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleSingleWithConditions() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated'))); $expected = array( @@ -270,7 +270,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleSingleAssociations() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $TestModel->unbindTranslation(); $translations = array('title' => 'Title', 'content' => 'Content'); @@ -330,7 +330,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testLocaleMultiple() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = array('deu', 'eng', 'cze'); $delete = array( array('locale' => 'deu'), @@ -393,7 +393,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testMissingTranslation() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'rus'; $result = $TestModel->read(null, 1); $this->assertFalse($result); @@ -420,7 +420,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testTranslatedFindList() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'deu'; $TestModel->displayField = 'title'; $result = $TestModel->find('list', array('recursive' => 1)); @@ -453,7 +453,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testReadSelectedFields() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $result = $TestModel->find('all', array('fields' => array('slug', 'TranslatedItem.content'))); $expected = array( @@ -488,7 +488,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testSaveCreate() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'spa'; $data = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4', 'content' => 'Contenido #4'); $TestModel->create($data); @@ -506,7 +506,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testSaveUpdate() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'spa'; $oldData = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4'); $TestModel->create($oldData); @@ -528,7 +528,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testMultipleCreate() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'deu'; $data = array( 'slug' => 'new_translated', @@ -566,7 +566,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testMultipleUpdate() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $TestModel->validate['title'] = 'notEmpty'; $data = array('TranslatedItem' => array( @@ -608,7 +608,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testMixedCreateUpdateWithArrayLocale() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = array('cze', 'deu'); $data = array('TranslatedItem' => array( 'id' => 1, @@ -647,7 +647,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testValidation() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $TestModel->locale = 'eng'; $TestModel->validate['title'] = '/Only this title/'; $data = array('TranslatedItem' => array( @@ -678,7 +678,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testAttachDetach() { $this->loadFixtures('Translate', 'TranslatedItem'); - $TestModel = new TranslatedItem(); + $TestModel =& new TranslatedItem(); $Behavior =& $this->Model->Behaviors->Translate; $TestModel->unbindTranslation(); @@ -728,7 +728,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testAnotherTranslateTable() { $this->loadFixtures('Translate', 'TranslatedItem', 'TranslateTable'); - $TestModel = new TranslatedItemWithTable(); + $TestModel =& new TranslatedItemWithTable(); $TestModel->locale = 'eng'; $result = $TestModel->read(null, 1); $expected = array( @@ -751,7 +751,7 @@ class TranslateBehaviorTest extends CakeTestCase { function testTranslateWithAssociations() { $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User', 'Comment', 'ArticlesTag', 'Tag'); - $TestModel = new TranslatedArticle(); + $TestModel =& new TranslatedArticle(); $TestModel->locale = 'eng'; $recursive = $TestModel->recursive; diff --git a/cake/tests/cases/libs/model/behaviors/tree.test.php b/cake/tests/cases/libs/model/behaviors/tree.test.php index 592d6de5..2d030cb4 100755 --- a/cake/tests/cases/libs/model/behaviors/tree.test.php +++ b/cake/tests/cases/libs/model/behaviors/tree.test.php @@ -60,7 +60,7 @@ class NumberTreeTest extends CakeTestCase { */ function testInitialize() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->find('count'); @@ -77,7 +77,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectInvalidLeft() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->findByName('1.1'); @@ -103,7 +103,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectInvalidRight() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->findByName('1.1'); @@ -129,7 +129,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectInvalidParent() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->findByName('1.1'); @@ -154,7 +154,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectNoneExistantParent() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->findByName('1.1'); @@ -177,7 +177,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRecoverFromMissingParent() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $result = $this->Tree->findByName('1.1'); @@ -200,7 +200,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectInvalidParents() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->updateAll(array($parentField => null)); @@ -222,7 +222,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectInvalidLftsRghts() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->updateAll(array($leftField => 0, $rightField => 0)); @@ -243,7 +243,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDetectEqualLftsRghts() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 3); $result = $this->Tree->findByName('1.1'); @@ -270,7 +270,7 @@ class NumberTreeTest extends CakeTestCase { */ function testAddOrphan() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null))); @@ -289,7 +289,7 @@ class NumberTreeTest extends CakeTestCase { */ function testAddMiddle() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data= $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); @@ -322,7 +322,7 @@ class NumberTreeTest extends CakeTestCase { */ function testAddInvalid() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -346,7 +346,7 @@ class NumberTreeTest extends CakeTestCase { */ function testAddNotIndexedByModel() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null)); @@ -365,7 +365,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMovePromote() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -391,7 +391,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveWithWhitelist() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -418,7 +418,7 @@ class NumberTreeTest extends CakeTestCase { */ function testInsertWithWhitelist() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->whitelist = array('name', $parentField); @@ -436,7 +436,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveBefore() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -464,7 +464,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveAfter() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -492,7 +492,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveDemoteInvalid() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -525,7 +525,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveInvalid() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -551,7 +551,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveSelfInvalid() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -577,7 +577,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveUpSuccess() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.2'), array('id')); @@ -598,7 +598,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveUpFail() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.1')); @@ -620,7 +620,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveUp2() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 10); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); @@ -650,7 +650,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveUpFirst() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 10); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); @@ -680,7 +680,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveDownSuccess() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); @@ -701,7 +701,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveDownFail() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.2')); @@ -722,7 +722,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveDownLast() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 10); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); @@ -752,7 +752,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveDown2() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 10); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); @@ -782,7 +782,7 @@ class NumberTreeTest extends CakeTestCase { */ function testSaveNoMove() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 10); $data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id')); @@ -812,7 +812,7 @@ class NumberTreeTest extends CakeTestCase { */ function testMoveToRootAndMoveUp() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(1, 1); $data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id')); $this->Tree->id = $data[$modelClass]['id']; @@ -836,7 +836,7 @@ class NumberTreeTest extends CakeTestCase { */ function testDelete() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -871,7 +871,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRemove() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); $result = $this->Tree->findByName('1.1'); @@ -903,7 +903,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRemoveLastTopParent() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -936,7 +936,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRemoveNoChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -970,7 +970,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRemoveAndDelete() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -1002,7 +1002,7 @@ class NumberTreeTest extends CakeTestCase { */ function testRemoveAndDeleteNoChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -1034,7 +1034,7 @@ class NumberTreeTest extends CakeTestCase { */ function testChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); @@ -1062,7 +1062,7 @@ class NumberTreeTest extends CakeTestCase { */ function testCountChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); @@ -1082,7 +1082,7 @@ class NumberTreeTest extends CakeTestCase { */ function testGetParentNode() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.2.2')); @@ -1100,7 +1100,7 @@ class NumberTreeTest extends CakeTestCase { */ function testGetPath() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1.2.2')); @@ -1120,7 +1120,7 @@ class NumberTreeTest extends CakeTestCase { */ function testNoAmbiguousColumn() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->bindModel(array('belongsTo' => array('Dummy' => array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); $this->Tree->initialize(2, 2); @@ -1152,7 +1152,7 @@ class NumberTreeTest extends CakeTestCase { */ function testReorderTree() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(3, 3); $nodes = $this->Tree->find('list', array('order' => $leftField)); @@ -1180,7 +1180,7 @@ class NumberTreeTest extends CakeTestCase { */ function testGenerateTreeListWithSelfJoin() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->bindModel(array('belongsTo' => array('Dummy' => array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); $this->Tree->initialize(2, 2); @@ -1197,7 +1197,7 @@ class NumberTreeTest extends CakeTestCase { */ function testArraySyntax() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(3, 3); $this->assertIdentical($this->Tree->childCount(2), $this->Tree->childCount(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 */ function testStringScope() { - $this->Tree = new FlagTree(); + $this->Tree =& new FlagTree(); $this->Tree->initialize(2, 3); $this->Tree->id = 1; @@ -1273,7 +1273,7 @@ class ScopedTreeTest extends NumberTreeTest { * @return void */ function testArrayScope() { - $this->Tree = new FlagTree(); + $this->Tree =& new FlagTree(); $this->Tree->initialize(2, 3); $this->Tree->id = 1; @@ -1309,7 +1309,7 @@ class ScopedTreeTest extends NumberTreeTest { * @return void */ function testMoveUpWithScope() { - $this->Ad = new Ad(); + $this->Ad =& new Ad(); $this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign')); $this->Ad->moveUp(6); @@ -1325,7 +1325,7 @@ class ScopedTreeTest extends NumberTreeTest { * @return void */ function testMoveDownWithScope() { - $this->Ad = new Ad(); + $this->Ad =& new Ad(); $this->Ad->Behaviors->attach('Tree', array('scope' => 'Campaign')); $this->Ad->moveDown(6); @@ -1342,7 +1342,7 @@ class ScopedTreeTest extends NumberTreeTest { * @return void */ function testTranslatingTree() { - $this->Tree = new FlagTree(); + $this->Tree =& new FlagTree(); $this->Tree->cacheQueries = false; $this->Tree->translateModel = 'TranslateTreeTestModel'; $this->Tree->Behaviors->attach('Translate', array('name')); @@ -1441,10 +1441,10 @@ class ScopedTreeTest extends NumberTreeTest { */ function testAliasesWithScopeInTwoTreeAssociations() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); - $this->TreeTwo = new NumberTreeTwo(); + $this->TreeTwo =& new NumberTreeTwo(); $record = $this->Tree->find('first'); @@ -1522,7 +1522,7 @@ class AfterTreeTest extends NumberTreeTest { * @return void */ 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)); $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() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -1620,7 +1620,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testMoveWithWhitelist() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $this->Tree->id = null; @@ -1647,7 +1647,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testRemoveNoChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -1681,7 +1681,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testRemoveAndDeleteNoChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $initialCount = $this->Tree->find('count'); @@ -1713,7 +1713,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testChildren() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->initialize(2, 2); $data = $this->Tree->find(array($modelClass . '.name' => '1. Root')); @@ -1741,7 +1741,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testNoAmbiguousColumn() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->bindModel(array('belongsTo' => array('Dummy' => array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); $this->Tree->initialize(2, 2); @@ -1773,7 +1773,7 @@ class UuidTreeTest extends NumberTreeTest { */ function testGenerateTreeListWithSelfJoin() { extract($this->settings); - $this->Tree = new $modelClass(); + $this->Tree =& new $modelClass(); $this->Tree->bindModel(array('belongsTo' => array('Dummy' => array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false); $this->Tree->initialize(2, 2); diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php index 447db40d..691a86c1 100755 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php @@ -371,7 +371,7 @@ class DboMysqlTest extends CakeTestCase { function testIndexOnMySQL4Output() { $name = $this->db->fullTableName('simple'); - $mockDbo = new QueryMockDboMysql($this); + $mockDbo =& new QueryMockDboMysql($this); $columnData = array( array('0' => array( 'Table' => 'with_compound_keys', @@ -512,7 +512,7 @@ class DboMysqlTest extends CakeTestCase { App::import('Core', 'Schema'); $this->db->cacheSources = $this->db->testing = false; - $schema1 = new CakeSchema(array( + $schema1 =& new CakeSchema(array( 'name' => 'AlterTest1', 'connection' => 'test_suite', 'altertest' => array( @@ -523,7 +523,7 @@ class DboMysqlTest extends CakeTestCase { ))); $this->db->query($this->db->createSchema($schema1)); - $schema2 = new CakeSchema(array( + $schema2 =& new CakeSchema(array( 'name' => 'AlterTest2', 'connection' => 'test_suite', 'altertest' => array( @@ -543,7 +543,7 @@ class DboMysqlTest extends CakeTestCase { $this->assertEqual($schema2->tables['altertest']['indexes'], $indexes); // Change three indexes, delete one and add another one - $schema3 = new CakeSchema(array( + $schema3 =& new CakeSchema(array( 'name' => 'AlterTest3', 'connection' => 'test_suite', 'altertest' => array( diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php index fabb5039..6b835890 100755 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php @@ -103,7 +103,7 @@ class DboOracleTest extends CakeTestCase { */ function testName() { $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'))); $e = 'foo.last_update_date'; diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php index aa2ddcac..aec59ba4 100755 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php @@ -415,7 +415,7 @@ class DboPostgresTest extends CakeTestCase { ªºnh˚ºO^∏…®[Ó“‚ÅfıÌ≥∫F!Eœ(π∑T6`¬tΩÆ0ì»rTÎ`»Ñ« ]≈åp˝)=¿Ô0∆öVÂmˇˆ„ø~¯ÁÔ∏b*fc»‡Îı„Ú}∆tœs∂Y∫ÜaÆ˙X∏~<ÿ·Ù vé1‹p¿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@È$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ëµ±ÿGû1coÔuñæ‘z®.õ∑7ÉÏÜÆ,°’H†ÍÉÌ∂7e º® íˆ⁄◊øNWK”ÂYµ‚ñé;µ¶gV-fl>µtË¥áßN2 ¯¶BaP-)eW.àôt^∏1›C∑Ö?L„&”5’4jvã–ª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')); $result = $model->find('first'); @@ -528,7 +528,7 @@ class DboPostgresTest extends CakeTestCase { * @return void */ function testAlterSchema() { - $Old = new CakeSchema(array( + $Old =& new CakeSchema(array( 'connection' => 'test_suite', 'name' => 'AlterPosts', 'alter_posts' => array( @@ -543,7 +543,7 @@ class DboPostgresTest extends CakeTestCase { )); $this->db->query($this->db->createSchema($Old)); - $New = new CakeSchema(array( + $New =& new CakeSchema(array( 'connection' => 'test_suite', 'name' => 'AlterPosts', 'alter_posts' => array( @@ -575,7 +575,7 @@ class DboPostgresTest extends CakeTestCase { function testAlterIndexes() { $this->db->cacheSources = false; - $schema1 = new CakeSchema(array( + $schema1 =& new CakeSchema(array( 'name' => 'AlterTest1', 'connection' => 'test_suite', 'altertest' => array( @@ -587,7 +587,7 @@ class DboPostgresTest extends CakeTestCase { )); $this->db->query($this->db->createSchema($schema1)); - $schema2 = new CakeSchema(array( + $schema2 =& new CakeSchema(array( 'name' => 'AlterTest2', 'connection' => 'test_suite', 'altertest' => array( @@ -609,7 +609,7 @@ class DboPostgresTest extends CakeTestCase { $this->assertEqual($schema2->tables['altertest']['indexes'], $indexes); // Change three indexes, delete one and add another one - $schema3 = new CakeSchema(array( + $schema3 =& new CakeSchema(array( 'name' => 'AlterTest3', 'connection' => 'test_suite', 'altertest' => array( diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_sqlite.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_sqlite.test.php index 1732ce19..2f1ea4ad 100755 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_sqlite.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_sqlite.test.php @@ -210,7 +210,7 @@ class DboSqliteTest extends CakeTestCase { * @return void **/ 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); $expected = array( 'id' => array( @@ -256,7 +256,7 @@ class DboSqliteTest extends CakeTestCase { function testDescribeWithUuidPrimaryKey() { $tableName = 'uuid_tests'; $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); $expected = array( 'type' => 'string', diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index 28a9d1d7..4da90c9b 100755 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -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->startQuote = '`'; $this->testDb->endQuote = '`'; Configure::write('debug', 1); $this->debug = Configure::read('debug'); - $this->Model = new TestModel(); + $this->Model =& new TestModel(); } /** * endTest method @@ -1239,7 +1239,7 @@ class DboSourceTest extends CakeTestCase { $test =& ConnectionManager::create('quoteTest', $config); $test->simulated = array(); - $this->Model = new Article2(array('alias' => 'Article', 'ds' => 'quoteTest')); + $this->Model =& new Article2(array('alias' => 'Article', 'ds' => 'quoteTest')); $this->Model->setDataSource('quoteTest'); $this->assertEqual($this->Model->escapeField(), '`Article`.`id`'); @@ -1277,11 +1277,11 @@ class DboSourceTest extends CakeTestCase { */ function testGenerateAssociationQuerySelfJoin() { $this->startTime = microtime(true); - $this->Model = new Article2(); + $this->Model =& new Article2(); $this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model->Category2); - $this->Model->Category2->ChildCat = new Category2(); - $this->Model->Category2->ParentCat = new Category2(); + $this->Model->Category2->ChildCat =& new Category2(); + $this->Model->Category2->ParentCat =& new Category2(); $queryData = array(); @@ -1305,7 +1305,7 @@ class DboSourceTest extends CakeTestCase { $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->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1366,10 +1366,10 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateInnerJoinAssociationQuery() { - $this->Model = new TestModel9(); + $this->Model =& new TestModel9(); $test =& ConnectionManager::create('test2', $this->__config); $this->Model->setDataSource('test2'); - $this->Model->TestModel8 = new TestModel8(); + $this->Model->TestModel8 =& new TestModel8(); $this->Model->TestModel8->setDataSource('test2'); $this->testDb->read($this->Model, array('recursive' => 1)); @@ -1389,7 +1389,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBinding() { - $this->Model = new TestModel8(); + $this->Model =& new TestModel8(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1416,7 +1416,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBinding() { - $this->Model = new TestModel9(); + $this->Model =& new TestModel9(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1442,7 +1442,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQuerySelfJoinWithConditions() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $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+WHERE\s+(?:\()?`TestModel4Parent`.`name`\s+!=\s+\'mariano\'(?:\))?\s*$/', $result); - $this->Featured2 = new Featured2(); + $this->Featured2 =& new Featured2(); $this->Featured2->schema(); $this->Featured2->bindModel(array( @@ -1503,7 +1503,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasOne() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1535,7 +1535,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasOneWithConditions() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1564,7 +1564,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryBelongsTo() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1595,7 +1595,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryBelongsToWithConditions() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1626,7 +1626,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasMany() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1655,7 +1655,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasManyWithLimit() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1694,7 +1694,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasManyWithConditions() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1722,7 +1722,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasManyWithOffsetAndLimit() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1759,7 +1759,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasManyWithPageAndLimit() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1795,7 +1795,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasManyWithFields() { - $this->Model = new TestModel5(); + $this->Model =& new TestModel5(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1920,7 +1920,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasAndBelongsToMany() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1950,7 +1950,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasAndBelongsToManyWithConditions() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -1978,7 +1978,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasAndBelongsToManyWithOffsetAndLimit() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -2014,7 +2014,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testGenerateAssociationQueryHasAndBelongsToManyWithPageAndLimit() { - $this->Model = new TestModel4(); + $this->Model =& new TestModel4(); $this->Model->schema(); $this->_buildRelatedModels($this->Model); @@ -2058,7 +2058,7 @@ class DboSourceTest extends CakeTestCase { } elseif (isset($assocData['className'])) { $className = $assocData['className']; } - $model->$className = new $className(); + $model->$className =& new $className(); $model->$className->schema(); } } @@ -2631,7 +2631,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testConditionsWithModel() { - $this->Model = new Article2(); + $this->Model =& new Article2(); $result = $this->testDb->conditions(array('Article2.viewed >=' => 0), true, true, $this->Model); $expected = " WHERE `Article2`.`viewed` >= 0"; @@ -3128,7 +3128,7 @@ class DboSourceTest extends CakeTestCase { * @return void */ function testSchema() { - $Schema = new CakeSchema(); + $Schema =& new CakeSchema(); $Schema->tables = array('table' => array(), 'anotherTable' => array()); $this->expectError(); diff --git a/cake/tests/cases/libs/model/db_acl.test.php b/cake/tests/cases/libs/model/db_acl.test.php index 57ba2b00..82d4d15a 100755 --- a/cake/tests/cases/libs/model/db_acl.test.php +++ b/cake/tests/cases/libs/model/db_acl.test.php @@ -224,10 +224,10 @@ class DbAclTest extends DbAcl { * @return void */ function __construct() { - $this->Aro = new DbAroTest(); - $this->Aro->Permission = new DbPermissionTest(); - $this->Aco = new DbAcoTest(); - $this->Aro->Permission = new DbPermissionTest(); + $this->Aro =& new DbAroTest(); + $this->Aro->Permission =& new DbPermissionTest(); + $this->Aco =& new DbAcoTest(); + $this->Aro->Permission =& new DbPermissionTest(); } } /** diff --git a/cake/tests/cases/libs/model/model_delete.test.php b/cake/tests/cases/libs/model/model_delete.test.php index cdaa97b4..6d30d2bd 100755 --- a/cake/tests/cases/libs/model/model_delete.test.php +++ b/cake/tests/cases/libs/model/model_delete.test.php @@ -42,7 +42,7 @@ class ModelDeleteTest extends BaseModelTest { function testDeleteHabtmReferenceWithConditions() { $this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio'); - $Portfolio = new Portfolio(); + $Portfolio =& new Portfolio(); $Portfolio->hasAndBelongsToMany['Item']['conditions'] = array('ItemsPortfolio.item_id >' => 1); $result = $Portfolio->find('first', array( @@ -131,7 +131,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testDeleteArticleBLinks() { $this->loadFixtures('Article', 'ArticlesTag', 'Tag'); - $TestModel = new ArticleB(); + $TestModel =& new ArticleB(); $result = $TestModel->ArticlesTag->find('all'); $expected = array( @@ -160,8 +160,8 @@ class ModelDeleteTest extends BaseModelTest { function testDeleteDependentWithConditions() { $this->loadFixtures('Cd','Book','OverallFavorite'); - $Cd = new Cd(); - $OverallFavorite = new OverallFavorite(); + $Cd =& new Cd(); + $OverallFavorite =& new OverallFavorite(); $Cd->del(1); @@ -187,7 +187,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testDel() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->del(2); $this->assertTrue($result); @@ -232,7 +232,7 @@ class ModelDeleteTest extends BaseModelTest { // make sure deleting a non-existent record doesn't break save() // ticket #6293 $this->loadFixtures('Uuid'); - $Uuid = new Uuid(); + $Uuid =& new Uuid(); $data = array( 'B607DAB9-88A2-46CF-B57C-842CA9E3B3B3', '52C8865C-10EE-4302-AE6C-6E7D8E12E2C8', @@ -266,7 +266,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testDeleteAll() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $data = array('Article' => array( 'user_id' => 2, @@ -407,7 +407,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testRecursiveDel() { $this->loadFixtures('Article', 'Comment', 'Attachment'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->del(2); $this->assertTrue($result); @@ -442,7 +442,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testDependentExclusiveDelete() { $this->loadFixtures('Article', 'Comment'); - $TestModel = new Article10(); + $TestModel =& new Article10(); $result = $TestModel->find('all'); $this->assertEqual(count($result[0]['Comment']), 4); @@ -460,7 +460,7 @@ class ModelDeleteTest extends BaseModelTest { */ function testDeleteLinks() { $this->loadFixtures('Article', 'ArticlesTag', 'Tag'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->ArticlesTag->find('all'); $expected = array( @@ -508,7 +508,7 @@ class ModelDeleteTest extends BaseModelTest { function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() { $this->loadFixtures('Apple', 'Device', 'ThePaperMonkies'); - $ThePaper = new ThePaper(); + $ThePaper =& new ThePaper(); $ThePaper->id = 1; $ThePaper->save(array('Monkey' => array(2, 3))); @@ -528,7 +528,7 @@ class ModelDeleteTest extends BaseModelTest { )); $this->assertEqual($result['Monkey'], $expected); - $ThePaper = new ThePaper(); + $ThePaper =& new ThePaper(); $ThePaper->id = 2; $ThePaper->save(array('Monkey' => array(2, 3))); diff --git a/cake/tests/cases/libs/model/model_integration.test.php b/cake/tests/cases/libs/model/model_integration.test.php index 475101f5..e213187b 100755 --- a/cake/tests/cases/libs/model/model_integration.test.php +++ b/cake/tests/cases/libs/model/model_integration.test.php @@ -42,7 +42,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testPkInHabtmLinkModelArticleB() { $this->loadFixtures('Article', 'Tag'); - $TestModel2 = new ArticleB(); + $TestModel2 =& new ArticleB(); $this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id'); } /** @@ -73,22 +73,22 @@ class ModelIntegrationTest extends BaseModelTest { function testPkInHabtmLinkModel() { //Test Nonconformant Models $this->loadFixtures('Content', 'ContentAccount', 'Account'); - $TestModel = new Content(); + $TestModel =& new Content(); $this->assertEqual($TestModel->ContentAccount->primaryKey, 'iContentAccountsId'); //test conformant models with no PK in the join table $this->loadFixtures('Article', 'Tag'); - $TestModel2 = new Article(); + $TestModel2 =& new Article(); $this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id'); //test conformant models with PK in join table $this->loadFixtures('Item', 'Portfolio', 'ItemsPortfolio'); - $TestModel3 = new Portfolio(); + $TestModel3 =& new Portfolio(); $this->assertEqual($TestModel3->ItemsPortfolio->primaryKey, 'id'); //test conformant models with PK in join table - join table contains extra field $this->loadFixtures('JoinA', 'JoinB', 'JoinAB'); - $TestModel4 = new JoinA(); + $TestModel4 =& new JoinA(); $this->assertEqual($TestModel4->JoinAsJoinB->primaryKey, 'id'); } @@ -100,7 +100,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testDynamicBehaviorAttachment() { $this->loadFixtures('Apple'); - $TestModel = new Apple(); + $TestModel =& new Apple(); $this->assertEqual($TestModel->Behaviors->attached(), array()); $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'); - $TestModel = new Article(); + $TestModel =& new Article(); $expected = array( array( @@ -535,7 +535,7 @@ class ModelIntegrationTest extends BaseModelTest { **/ function testDeconstructFieldsTime() { $this->loadFixtures('Apple'); - $TestModel = new Apple(); + $TestModel =& new Apple(); $data = array(); $data['Apple']['mytime']['hour'] = ''; @@ -621,7 +621,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testDeconstructFieldsDateTime() { $this->loadFixtures('Apple'); - $TestModel = new Apple(); + $TestModel =& new Apple(); //test null/empty values first $data['Apple']['created']['year'] = ''; @@ -849,7 +849,7 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testInvalidAssociation() { - $TestModel = new ValidationTest1(); + $TestModel =& new ValidationTest1(); $this->assertNull($TestModel->getAssociated('Foo')); } /** @@ -875,7 +875,7 @@ class ModelIntegrationTest extends BaseModelTest { **/ function testResetOfExistsOnCreate() { $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $Article->id = 1; $Article->saveField('title', 'Reset me'); $Article->delete(); @@ -897,7 +897,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testPluginAssociations() { $this->loadFixtures('TestPluginArticle', 'User', 'TestPluginComment'); - $TestModel = new TestPluginArticle(); + $TestModel =& new TestPluginArticle(); $result = $TestModel->find('all'); $expected = array( @@ -1063,7 +1063,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testAutoConstructAssociations() { $this->loadFixtures('User', 'ArticleFeatured'); - $TestModel = new AssociationTest1(); + $TestModel =& new AssociationTest1(); $result = $TestModel->hasAndBelongsToMany; $expected = array('AssociationTest2' => array( @@ -1079,8 +1079,8 @@ class ModelIntegrationTest extends BaseModelTest { $this->assertEqual($result, $expected); // Tests related to ticket https://trac.cakephp.org/ticket/5594 - $TestModel = new ArticleFeatured(); - $TestFakeModel = new ArticleFeatured(array('table' => false)); + $TestModel =& new ArticleFeatured(); + $TestFakeModel =& new ArticleFeatured(array('table' => false)); $expected = array( 'User' => array( @@ -1195,7 +1195,7 @@ class ModelIntegrationTest extends BaseModelTest { $this->assertEqual('test_suite', $TestModel->useDbConfig); //deprecated but test it anyway - $NewVoid = new TheVoid(null, false, 'other'); + $NewVoid =& new TheVoid(null, false, 'other'); $this->assertEqual('other', $NewVoid->useDbConfig); } /** @@ -1205,13 +1205,13 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testColumnTypeFetching() { - $model = new Test(); + $model =& new Test(); $this->assertEqual($model->getColumnType('id'), 'integer'); $this->assertEqual($model->getColumnType('notes'), 'text'); $this->assertEqual($model->getColumnType('updated'), 'datetime'); $this->assertEqual($model->getColumnType('unknown'), null); - $model = new Article(); + $model =& new Article(); $this->assertEqual($model->getColumnType('User.created'), 'datetime'); $this->assertEqual($model->getColumnType('Tag.id'), 'integer'); $this->assertEqual($model->getColumnType('Article.id'), 'integer'); @@ -1223,7 +1223,7 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testHabtmUniqueKey() { - $model = new Item(); + $model =& new Item(); $this->assertFalse($model->hasAndBelongsToMany['Portfolio']['unique']); } /** @@ -1233,17 +1233,17 @@ class ModelIntegrationTest extends BaseModelTest { * @return void */ function testIdentity() { - $TestModel = new Test(); + $TestModel =& new Test(); $result = $TestModel->alias; $expected = 'Test'; $this->assertEqual($result, $expected); - $TestModel = new TestAlias(); + $TestModel =& new TestAlias(); $result = $TestModel->alias; $expected = 'TestAlias'; $this->assertEqual($result, $expected); - $TestModel = new Test(array('alias' => 'AnotherTest')); + $TestModel =& new Test(array('alias' => 'AnotherTest')); $result = $TestModel->alias; $expected = 'AnotherTest'; $this->assertEqual($result, $expected); @@ -1256,7 +1256,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testWithAssociation() { $this->loadFixtures('Something', 'SomethingElse', 'JoinThing'); - $TestModel = new Something(); + $TestModel =& new Something(); $result = $TestModel->SomethingElse->find('all'); $expected = array( @@ -1508,7 +1508,7 @@ class ModelIntegrationTest extends BaseModelTest { function testFindSelfAssociations() { $this->loadFixtures('Person'); - $TestModel = new Person(); + $TestModel =& new Person(); $TestModel->recursive = 2; $result = $TestModel->read(null, 1); $expected = array( @@ -1616,7 +1616,7 @@ class ModelIntegrationTest extends BaseModelTest { */ function testDynamicAssociations() { $this->loadFixtures('Article', 'Comment'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = $TestModel->hasOne = array(); $TestModel->hasMany['Comment'] = array_merge($TestModel->hasMany['Comment'], array( @@ -1723,11 +1723,11 @@ class ModelIntegrationTest extends BaseModelTest { */ function testCreation() { $this->loadFixtures('Article'); - $TestModel = new Test(); + $TestModel =& new Test(); $result = $TestModel->create(); $expected = array('Test' => array('notes' => 'write some notes here')); $this->assertEqual($result, $expected); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->schema(); if (isset($this->db->columns['primary_key']['length'])) { @@ -1777,12 +1777,12 @@ class ModelIntegrationTest extends BaseModelTest { $this->assertEqual($result, $expected); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->create(); $expected = array('Article' => array('published' => 'N')); $this->assertEqual($result, $expected); - $FeaturedModel = new Featured(); + $FeaturedModel =& new Featured(); $data = array( 'article_featured_id' => 1, 'category_id' => 1, diff --git a/cake/tests/cases/libs/model/model_read.test.php b/cake/tests/cases/libs/model/model_read.test.php index ae163386..a2fd76f8 100755 --- a/cake/tests/cases/libs/model/model_read.test.php +++ b/cake/tests/cases/libs/model/model_read.test.php @@ -89,8 +89,8 @@ class ModelReadTest extends BaseModelTest { } $this->loadFixtures('Project', 'Product', 'Thread', 'Message', 'Bid'); - $Thread = new Thread(); - $Product = new Product(); + $Thread =& new Thread(); + $Product =& new Product(); $result = $Thread->find('all', array( 'group' => 'Thread.project_id', @@ -245,7 +245,7 @@ class ModelReadTest extends BaseModelTest { */ function testOldQuery() { $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $query = 'SELECT title FROM '; $query .= $this->db->fullTableName('articles'); @@ -280,7 +280,7 @@ class ModelReadTest extends BaseModelTest { */ function testPreparedQuery() { $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $this->db->_queryCache = array(); $finalQuery = 'SELECT title, published FROM '; @@ -361,7 +361,7 @@ class ModelReadTest extends BaseModelTest { */ function testParameterMismatch() { $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $query = 'SELECT * FROM ' . $this->db->fullTableName('articles'); $query .= ' WHERE ' . $this->db->fullTableName('articles'); @@ -389,7 +389,7 @@ class ModelReadTest extends BaseModelTest { } $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $query = 'SELECT * FROM ? WHERE ? = ? AND ? = ?'; $param = array( @@ -411,7 +411,7 @@ class ModelReadTest extends BaseModelTest { */ function testRecursiveUnbind() { $this->loadFixtures('Apple', 'Sample'); - $TestModel = new Apple(); + $TestModel =& new Apple(); $TestModel->recursive = 2; $result = $TestModel->find('all'); @@ -3032,7 +3032,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindAllThreaded() { $this->loadFixtures('Category'); - $TestModel = new Category(); + $TestModel =& new Category(); $result = $TestModel->find('threaded'); $expected = array( @@ -3508,7 +3508,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindNeighbors() { $this->loadFixtures('User', 'Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->id = 1; $result = $TestModel->find('neighbors', array('fields' => array('id'))); @@ -3664,7 +3664,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindNeighboursLegacy() { $this->loadFixtures('User', 'Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->findNeighbours(null, 'Article.id', '2'); $expected = array( @@ -3714,7 +3714,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindCombinedRelations() { $this->loadFixtures('Apple', 'Sample'); - $TestModel = new Apple(); + $TestModel =& new Apple(); $result = $TestModel->find('all'); @@ -3990,13 +3990,13 @@ class ModelReadTest extends BaseModelTest { */ function testSaveEmpty() { $this->loadFixtures('Thread'); - $TestModel = new Thread(); + $TestModel =& new Thread(); $data = array(); $expected = $TestModel->save($data); $this->assertFalse($expected); } // function testBasicValidation() { - // $TestModel = new ValidationTest1(); + // $TestModel =& new ValidationTest1(); // $TestModel->testing = true; // $TestModel->set(array('title' => '', 'published' => 1)); // $this->assertEqual($TestModel->invalidFields(), array('title' => 'This field cannot be left blank')); @@ -4020,7 +4020,7 @@ class ModelReadTest extends BaseModelTest { function testFindAllWithConditionInChildQuery() { $this->loadFixtures('Basket', 'FilmFile'); - $TestModel = new Basket(); + $TestModel =& new Basket(); $recursive = 3; $result = $TestModel->find('all', compact('conditions', 'recursive')); @@ -4063,7 +4063,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindAllWithConditionsHavingMixedDataTypes() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $expected = array( array( 'Article' => array( @@ -4143,7 +4143,7 @@ class ModelReadTest extends BaseModelTest { */ function testBindUnbind() { $this->loadFixtures('User', 'Comment', 'FeatureSet'); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->hasMany; $expected = array(); @@ -4547,7 +4547,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEqual($result, $expected); - $TestModel2 = new DeviceType(); + $TestModel2 =& new DeviceType(); $expected = array( 'className' => 'FeatureSet', @@ -4602,7 +4602,7 @@ class ModelReadTest extends BaseModelTest { */ function testBindMultipleTimes() { $this->loadFixtures('User', 'Comment', 'Article'); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->hasMany; $expected = array(); @@ -4790,7 +4790,7 @@ class ModelReadTest extends BaseModelTest { */ function testAssociationAfterFind() { $this->loadFixtures('Post', 'Author', 'Comment'); - $TestModel = new Post(); + $TestModel =& new Post(); $result = $TestModel->find('all'); $expected = array( array( @@ -4850,7 +4850,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEqual($result, $expected); unset($TestModel); - $Author = new Author(); + $Author =& new Author(); $Author->Post->bindModel(array( 'hasMany' => array( 'Comment' => array( @@ -4917,7 +4917,7 @@ class ModelReadTest extends BaseModelTest { 'DocumentDirectory' ); - $DeviceType = new DeviceType(); + $DeviceType =& new DeviceType(); $DeviceType->recursive = 2; $result = $DeviceType->read(null, 1); @@ -5006,7 +5006,7 @@ class ModelReadTest extends BaseModelTest { */ function testHabtmRecursiveBelongsTo() { $this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio', 'Syfile', 'Image'); - $Portfolio = new Portfolio(); + $Portfolio =& new Portfolio(); $result = $Portfolio->find(array('id' => 2), null, null, 3); $expected = array( @@ -5064,7 +5064,7 @@ class ModelReadTest extends BaseModelTest { */ function testHabtmFinderQuery() { $this->loadFixtures('Article', 'Tag', 'ArticlesTag'); - $Article = new Article(); + $Article =& new Article(); $sql = $this->db->buildStatement( array( @@ -5112,7 +5112,7 @@ class ModelReadTest extends BaseModelTest { */ function testHabtmLimitOptimization() { $this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'ArticlesTag'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->hasAndBelongsToMany['Tag']['limit'] = 2; $result = $TestModel->read(null, 2); @@ -5182,7 +5182,7 @@ class ModelReadTest extends BaseModelTest { */ function testHasManyLimitOptimization() { $this->loadFixtures('Project', 'Thread', 'Message', 'Bid'); - $Project = new Project(); + $Project =& new Project(); $Project->recursive = 3; $result = $Project->find('all'); @@ -5296,7 +5296,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindAllRecursiveSelfJoin() { $this->loadFixtures('Home', 'AnotherArticle', 'Advertisement'); - $TestModel = new Home(); + $TestModel =& new Home(); $TestModel->recursive = 2; $result = $TestModel->find('all'); @@ -5412,7 +5412,7 @@ class ModelReadTest extends BaseModelTest { 'MyProduct' ); - $MyUser = new MyUser(); + $MyUser =& new MyUser(); $MyUser->recursive = 2; $result = $MyUser->find('all'); @@ -5473,7 +5473,7 @@ class ModelReadTest extends BaseModelTest { */ function testReadFakeThread() { $this->loadFixtures('CategoryThread'); - $TestModel = new CategoryThread(); + $TestModel =& new CategoryThread(); $fullDebug = $this->db->fullDebug; $this->db->fullDebug = true; @@ -5537,7 +5537,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindFakeThread() { $this->loadFixtures('CategoryThread'); - $TestModel = new CategoryThread(); + $TestModel =& new CategoryThread(); $fullDebug = $this->db->fullDebug; $this->db->fullDebug = true; @@ -5601,7 +5601,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindAllFakeThread() { $this->loadFixtures('CategoryThread'); - $TestModel = new CategoryThread(); + $TestModel =& new CategoryThread(); $fullDebug = $this->db->fullDebug; $this->db->fullDebug = true; @@ -5821,7 +5821,7 @@ class ModelReadTest extends BaseModelTest { */ function testConditionalNumerics() { $this->loadFixtures('NumericArticle'); - $NumericArticle = new NumericArticle(); + $NumericArticle =& new NumericArticle(); $data = array('title' => '12345abcde'); $result = $NumericArticle->find($data); $this->assertTrue(!empty($result)); @@ -5839,7 +5839,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindAll() { $this->loadFixtures('User'); - $TestModel = new User(); + $TestModel =& new User(); $TestModel->cacheQueries = false; $result = $TestModel->find('all'); @@ -6069,7 +6069,7 @@ class ModelReadTest extends BaseModelTest { function testGenerateFindList() { $this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->displayField = 'title'; $result = $TestModel->find('list', array( @@ -6204,7 +6204,7 @@ class ModelReadTest extends BaseModelTest { )); $this->assertEqual($result, $expected); - $TestModel = new Apple(); + $TestModel =& new Apple(); $expected = array( 1 => 'Red Apple 1', 2 => 'Bright Red Apple', @@ -6218,7 +6218,7 @@ class ModelReadTest extends BaseModelTest { $this->assertEqual($TestModel->find('list'), $expected); $this->assertEqual($TestModel->Parent->find('list'), $expected); - $TestModel = new Post(); + $TestModel =& new Post(); $result = $TestModel->find('list', array( 'fields' => 'Post.title' )); @@ -6299,7 +6299,7 @@ class ModelReadTest extends BaseModelTest { )); $this->assertEqual($result, $expected); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->find('list', array( 'fields' => array('User.user', 'User.password') )); @@ -6311,7 +6311,7 @@ class ModelReadTest extends BaseModelTest { ); $this->assertEqual($result, $expected); - $TestModel = new ModifiedAuthor(); + $TestModel =& new ModifiedAuthor(); $result = $TestModel->find('list', array( 'fields' => array('Author.id', 'Author.user') )); @@ -6331,7 +6331,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindField() { $this->loadFixtures('User'); - $TestModel = new User(); + $TestModel =& new User(); $TestModel->id = 1; $result = $TestModel->field('user'); @@ -6360,7 +6360,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindUnique() { $this->loadFixtures('User'); - $TestModel = new User(); + $TestModel =& new User(); $this->assertFalse($TestModel->isUnique(array( 'user' => 'nate' @@ -6383,7 +6383,7 @@ class ModelReadTest extends BaseModelTest { function testFindCount() { $this->loadFixtures('User', 'Project'); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->find('count'); $this->assertEqual($result, 4); @@ -6412,7 +6412,7 @@ class ModelReadTest extends BaseModelTest { return; } $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(); @@ -6432,7 +6432,7 @@ class ModelReadTest extends BaseModelTest { } $this->loadFixtures('Project'); $db = ConnectionManager::getDataSource('test_suite'); - $TestModel = new Project(); + $TestModel =& new Project(); $result = $TestModel->find('count', array('conditions' => array( $db->expression('Project.name = \'Project 3\'') @@ -6452,7 +6452,7 @@ class ModelReadTest extends BaseModelTest { */ function testFindMagic() { $this->loadFixtures('User'); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->findByUser('mariano'); $expected = array( @@ -6483,7 +6483,7 @@ class ModelReadTest extends BaseModelTest { */ function testRead() { $this->loadFixtures('User', 'Article'); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->read(); $this->assertFalse($result); @@ -6571,7 +6571,7 @@ class ModelReadTest extends BaseModelTest { 'Featured', 'ArticleFeatured' ); - $TestModel = new User(); + $TestModel =& new User(); $result = $TestModel->bindModel(array('hasMany' => array('Article')), false); $this->assertTrue($result); @@ -6683,7 +6683,7 @@ class ModelReadTest extends BaseModelTest { 'Featured', 'Category' ); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->find('all', array('conditions' => array('Article.user_id' => 1))); $expected = array( @@ -6989,7 +6989,7 @@ class ModelReadTest extends BaseModelTest { */ function testRecursiveFindAllWithLimit() { $this->loadFixtures('Article', 'User', 'Tag', 'ArticlesTag', 'Comment', 'Attachment'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->hasMany['Comment']['limit'] = 2; diff --git a/cake/tests/cases/libs/model/model_validation.test.php b/cake/tests/cases/libs/model/model_validation.test.php index 0911c933..b4dcf22f 100755 --- a/cake/tests/cases/libs/model/model_validation.test.php +++ b/cake/tests/cases/libs/model/model_validation.test.php @@ -40,7 +40,7 @@ class ModelValidationTest extends BaseModelTest { * @return void */ function testValidationParams() { - $TestModel = new ValidationTest1(); + $TestModel =& new ValidationTest1(); $TestModel->validate['title'] = array( 'rule' => 'customValidatorWithParams', 'required' => true @@ -81,7 +81,7 @@ class ModelValidationTest extends BaseModelTest { * @return void */ function testInvalidFieldsWithFieldListParams() { - $TestModel = new ValidationTest1(); + $TestModel =& new ValidationTest1(); $TestModel->validate = $validate = array( 'title' => array( 'rule' => 'customValidator', diff --git a/cake/tests/cases/libs/model/model_write.test.php b/cake/tests/cases/libs/model/model_write.test.php index c41b981d..3d023ce1 100755 --- a/cake/tests/cases/libs/model/model_write.test.php +++ b/cake/tests/cases/libs/model/model_write.test.php @@ -95,7 +95,7 @@ class ModelWriteTest extends BaseModelTest { function testSaveDateAsFirstEntry() { $this->loadFixtures('Article'); - $Article = new Article(); + $Article =& new Article(); $data = array( 'Article' => array( @@ -124,7 +124,7 @@ class ModelWriteTest extends BaseModelTest { */ function testUnderscoreFieldSave() { $this->loadFixtures('UnderscoreField'); - $UnderscoreField = new UnderscoreField(); + $UnderscoreField =& new UnderscoreField(); $currentCount = $UnderscoreField->find('count'); $this->assertEqual($currentCount, 3); @@ -152,7 +152,7 @@ class ModelWriteTest extends BaseModelTest { $this->skipIf($this->db->config['driver'] == 'sqlite'); $this->loadFixtures('Uuid'); - $TestModel = new Uuid(); + $TestModel =& new Uuid(); $TestModel->save(array('title' => 'Test record')); $result = $TestModel->findByTitle('Test record'); @@ -174,7 +174,7 @@ class ModelWriteTest extends BaseModelTest { '%s SQLite uses loose typing, this operation is unsupported' ); $this->loadFixtures('DataTest'); - $TestModel = new DataTest(); + $TestModel =& new DataTest(); $TestModel->create(array()); $TestModel->save(); @@ -190,7 +190,7 @@ class ModelWriteTest extends BaseModelTest { */ function testNonNumericHabtmJoinKey() { $this->loadFixtures('Post', 'Tag', 'PostsTag'); - $Post = new Post(); + $Post =& new Post(); $Post->bind('Tag', array('type' => 'hasAndBelongsToMany')); $Post->Tag->primaryKey = 'tag'; @@ -287,7 +287,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testAllowSimulatedFields() { - $TestModel = new ValidationTest1(); + $TestModel =& new ValidationTest1(); $TestModel->create(array( 'title' => 'foo', @@ -316,7 +316,7 @@ class ModelWriteTest extends BaseModelTest { Configure::write('Cache.disable', false); $this->loadFixtures('OverallFavorite'); - $OverallFavorite = new OverallFavorite(); + $OverallFavorite =& new OverallFavorite(); touch(CACHE . 'views' . DS . 'some_dir_overallfavorites_index.php'); touch(CACHE . 'views' . DS . 'some_dir_overall_favorites_index.php'); @@ -345,8 +345,8 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveWithCounterCache() { $this->loadFixtures('Syfile', 'Item'); - $TestModel = new Syfile(); - $TestModel2 = new Item(); + $TestModel =& new Syfile(); + $TestModel2 =& new Item(); $result = $TestModel->findById(1); $this->assertIdentical($result['Syfile']['item_count'], null); @@ -486,11 +486,11 @@ class ModelWriteTest extends BaseModelTest { $this->loadFixtures('CategoryThread'); $this->db->query('ALTER TABLE '. $this->db->fullTableName('category_threads') . " ADD COLUMN child_count INTEGER"); - $Category = new CategoryThread(); + $Category =& new CategoryThread(); $result = $Category->updateAll(array('CategoryThread.name' => "'updated'"), array('CategoryThread.parent_id' => 5)); $this->assertTrue($result); - $Category = new CategoryThread(); + $Category =& new CategoryThread(); $Category->belongsTo['ParentCategory']['counterCache'] = 'child_count'; $Category->updateCounterCache(array('parent_id' => 5)); $result = Set::extract($Category->find('all', array('conditions' => array('CategoryThread.id' => 5))), '{n}.CategoryThread.child_count'); @@ -505,8 +505,8 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveWithCounterCacheScope() { $this->loadFixtures('Syfile', 'Item'); - $TestModel = new Syfile(); - $TestModel2 = new Item(); + $TestModel =& new Syfile(); + $TestModel2 =& new Item(); $TestModel2->belongsTo['Syfile']['counterCache'] = true; $TestModel2->belongsTo['Syfile']['counterScope'] = array('published' => true); @@ -543,7 +543,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testValidatesBackwards() { - $TestModel = new TestValidate(); + $TestModel =& new TestValidate(); $TestModel->validate = array( 'user_id' => VALID_NUMBER, @@ -608,7 +608,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testValidates() { - $TestModel = new TestValidate(); + $TestModel =& new TestValidate(); $TestModel->validate = array( 'user_id' => 'numeric', @@ -961,7 +961,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveField() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->id = 1; $result = $TestModel->saveField('title', 'New First Article'); @@ -1012,7 +1012,7 @@ class ModelWriteTest extends BaseModelTest { $this->assertFalse($result); $this->loadFixtures('Node', 'Dependency'); - $Node = new Node(); + $Node =& new Node(); $Node->set('id', 1); $result = $Node->read(); $this->assertEqual(Set::extract('/ParentNode/name', $result), array('Second')); @@ -1037,7 +1037,7 @@ class ModelWriteTest extends BaseModelTest { 'ArticlesTag', 'Attachment' ); - $TestModel = new User(); + $TestModel =& new User(); $data = array('User' => array( 'user' => 'user', @@ -1047,7 +1047,7 @@ class ModelWriteTest extends BaseModelTest { $this->assertFalse($result); $this->assertTrue(!empty($TestModel->validationErrors)); - $TestModel = new Article(); + $TestModel =& new Article(); $data = array('Article' => array( 'user_id' => '', @@ -1250,7 +1250,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveWithSet() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); // Create record we will be updating later @@ -1377,7 +1377,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveWithNonExistentFields() { $this->loadFixtures('Article'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->recursive = -1; $data = array( @@ -1445,7 +1445,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveHabtm() { $this->loadFixtures('Article', 'User', 'Comment', 'Tag', 'ArticlesTag'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->findById(2); $expected = array( @@ -1916,7 +1916,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveHabtmCustomKeys() { $this->loadFixtures('Story', 'StoriesTag', 'Tag'); - $Story = new Story(); + $Story =& new Story(); $data = array( 'Story' => array('story' => '1'), @@ -1966,7 +1966,7 @@ class ModelWriteTest extends BaseModelTest { */ function testHabtmSaveKeyResolution() { $this->loadFixtures('Apple', 'Device', 'ThePaperMonkies'); - $ThePaper = new ThePaper(); + $ThePaper =& new ThePaper(); $ThePaper->id = 1; $ThePaper->save(array('Monkey' => array(2, 3))); @@ -2055,7 +2055,7 @@ class ModelWriteTest extends BaseModelTest { */ function testCreationOfEmptyRecord() { $this->loadFixtures('Author'); - $TestModel = new Author(); + $TestModel =& new Author(); $this->assertEqual($TestModel->find('count'), 4); $TestModel->deleteAll(true, false, false); @@ -2073,7 +2073,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testCreateWithPKFiltering() { - $TestModel = new Article(); + $TestModel =& new Article(); $data = array( 'id' => 5, 'user_id' => 2, @@ -2170,8 +2170,8 @@ class ModelWriteTest extends BaseModelTest { */ function testCreationWithMultipleData() { $this->loadFixtures('Article', 'Comment'); - $Article = new Article(); - $Comment = new Comment(); + $Article =& new Article(); + $Comment =& new Comment(); $articles = $Article->find('all', array( 'fields' => array('id','title'), @@ -2341,8 +2341,8 @@ class ModelWriteTest extends BaseModelTest { */ function testCreationWithMultipleDataSameModel() { $this->loadFixtures('Article'); - $Article = new Article(); - $SecondaryArticle = new Article(); + $Article =& new Article(); + $SecondaryArticle =& new Article(); $result = $Article->field('title', array('id' => 1)); $this->assertEqual($result, 'First Article'); @@ -2399,8 +2399,8 @@ class ModelWriteTest extends BaseModelTest { */ function testCreationWithMultipleDataSameModelManualInstances() { $this->loadFixtures('PrimaryModel'); - $Primary = new PrimaryModel(); - $Secondary = new PrimaryModel(); + $Primary =& new PrimaryModel(); + $Secondary =& new PrimaryModel(); $result = $Primary->field('primary_name', array('id' => 1)); $this->assertEqual($result, 'Primary Name Existing'); @@ -2437,7 +2437,7 @@ class ModelWriteTest extends BaseModelTest { */ function testRecordExists() { $this->loadFixtures('User'); - $TestModel = new User(); + $TestModel =& new User(); $this->assertFalse($TestModel->exists()); $TestModel->read(null, 1); @@ -2447,7 +2447,7 @@ class ModelWriteTest extends BaseModelTest { $TestModel->id = 4; $this->assertTrue($TestModel->exists()); - $TestModel = new TheVoid(); + $TestModel =& new TheVoid(); $this->assertFalse($TestModel->exists()); $TestModel->id = 5; $this->assertFalse($TestModel->exists()); @@ -2460,7 +2460,7 @@ class ModelWriteTest extends BaseModelTest { */ function testUpdateExisting() { $this->loadFixtures('User', 'Article', 'Comment'); - $TestModel = new User(); + $TestModel =& new User(); $TestModel->create(); $TestModel->save(array( @@ -2481,8 +2481,8 @@ class ModelWriteTest extends BaseModelTest { $this->assertEqual($result['User']['user'], 'updated user'); $this->assertEqual($result['User']['password'], 'some password'); - $Article = new Article(); - $Comment = new Comment(); + $Article =& new Article(); + $Comment =& new Comment(); $data = array( 'Comment' => array( 'id' => 1, @@ -2507,7 +2507,7 @@ class ModelWriteTest extends BaseModelTest { */ function testUpdateMultiple() { $this->loadFixtures('Comment', 'Article', 'User', 'CategoryThread'); - $TestModel = new Comment(); + $TestModel =& new Comment(); $result = Set::extract($TestModel->find('all'), '{n}.Comment.user_id'); $expected = array('2', '4', '1', '1', '1', '2'); $this->assertEqual($result, $expected); @@ -2540,7 +2540,7 @@ class ModelWriteTest extends BaseModelTest { */ function testHabtmUuidWithUuidId() { $this->loadFixtures('Uuidportfolio', 'Uuiditem', 'UuiditemsUuidportfolio'); - $TestModel = new Uuidportfolio(); + $TestModel =& new Uuidportfolio(); $data = array('Uuidportfolio' => array('name' => 'Portfolio 3')); $data['Uuiditem']['Uuiditem'] = array('483798c8-c7cc-430e-8cf9-4fcc40cf8569'); @@ -2558,7 +2558,7 @@ class ModelWriteTest extends BaseModelTest { **/ function testHabtmSavingWithNoPrimaryKeyUuidJoinTable() { $this->loadFixtures('UuidTag', 'Fruit', 'FruitsUuidTag'); - $Fruit = new Fruit(); + $Fruit =& new Fruit(); $data = array( 'Fruit' => array( 'color' => 'Red', @@ -2581,7 +2581,7 @@ class ModelWriteTest extends BaseModelTest { **/ function testHabtmSavingWithNoPrimaryKeyUuidJoinTableNoWith() { $this->loadFixtures('UuidTag', 'Fruit', 'FruitsUuidTag'); - $Fruit = new FruitNoWith(); + $Fruit =& new FruitNoWith(); $data = array( 'Fruit' => array( 'color' => 'Red', @@ -2606,7 +2606,7 @@ class ModelWriteTest extends BaseModelTest { */ function testHabtmUuidWithNumericId() { $this->loadFixtures('Uuidportfolio', 'Uuiditem', 'UuiditemsUuidportfolioNumericid'); - $TestModel = new Uuiditem(); + $TestModel =& new Uuiditem(); $data = array('Uuiditem' => array('name' => 'Item 7', 'published' => 0)); $data['Uuidportfolio']['Uuidportfolio'] = array('480af662-eb8c-47d3-886b-230540cf8569'); @@ -2742,7 +2742,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAll() { $this->loadFixtures('Post', 'Author', 'Comment', 'Attachment'); - $TestModel = new Post(); + $TestModel =& new Post(); $result = $TestModel->find('all'); $this->assertEqual(count($result), 3); @@ -2827,7 +2827,7 @@ class ModelWriteTest extends BaseModelTest { ))); $this->assertEqual($result, $expected); - $TestModel = new Comment(); + $TestModel =& new Comment(); $ts = date('Y-m-d H:i:s'); $result = $TestModel->saveAll(array( 'Comment' => array( @@ -2894,7 +2894,7 @@ class ModelWriteTest extends BaseModelTest { 'comment' => 'Article comment', 'user_id' => 1 ))); - $Article = new Article(); + $Article =& new Article(); $result = $Article->saveAll($data); $this->assertTrue($result); @@ -2927,7 +2927,7 @@ class ModelWriteTest extends BaseModelTest { ) ); - $Something = new Something(); + $Something =& new Something(); $result = $Something->saveAll($data); $this->assertTrue($result); $result = $Something->read(); @@ -3079,7 +3079,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllAtomic() { $this->loadFixtures('Article', 'User'); - $TestModel = new Article(); + $TestModel =& new Article(); $result = $TestModel->saveAll(array( 'Article' => array( @@ -3152,7 +3152,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllHasMany() { $this->loadFixtures('Article', 'Comment'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array(); $result = $TestModel->saveAll(array( @@ -3228,7 +3228,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllHasManyValidation() { $this->loadFixtures('Article', 'Comment'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array(); $TestModel->Comment->validate = array('comment' => 'notEmpty'); @@ -3268,7 +3268,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllTransaction() { $this->loadFixtures('Post', 'Author', 'Comment', 'Attachment'); - $TestModel = new Post(); + $TestModel =& new Post(); $TestModel->validate = array('title' => 'notEmpty'); $data = array( @@ -3465,7 +3465,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllValidation() { $this->loadFixtures('Post', 'Author', 'Comment', 'Attachment'); - $TestModel = new Post(); + $TestModel =& new Post(); $data = array( array( @@ -3656,7 +3656,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testSaveAllValidationOnly() { - $TestModel = new Comment(); + $TestModel =& new Comment(); $TestModel->Attachment->validate = array('attachment' => 'notEmpty'); $data = array( @@ -3671,7 +3671,7 @@ class ModelWriteTest extends BaseModelTest { $result = $TestModel->saveAll($data, array('validate' => 'only')); $this->assertFalse($result); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->validate = array('title' => 'notEmpty'); $result = $TestModel->saveAll( array( @@ -3708,7 +3708,7 @@ class ModelWriteTest extends BaseModelTest { * @return void */ function testSaveAllValidateFirst() { - $model = new Article(); + $model =& new Article(); $model->deleteAll(true); $model->Comment->validate = array('comment' => 'notEmpty'); @@ -3787,7 +3787,7 @@ class ModelWriteTest extends BaseModelTest { */ function testUpdateWithCalculation() { $this->loadFixtures('DataTest'); - $model = new DataTest(); + $model =& new DataTest(); $result = $model->saveAll(array( array('count' => 5, 'float' => 1.1), array('count' => 3, 'float' => 1.2), @@ -3815,7 +3815,7 @@ class ModelWriteTest extends BaseModelTest { */ function testSaveAllHasManyValidationOnly() { $this->loadFixtures('Article', 'Comment'); - $TestModel = new Article(); + $TestModel =& new Article(); $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array(); $TestModel->Comment->validate = array('comment' => 'notEmpty'); @@ -3892,7 +3892,7 @@ class ModelWriteTest extends BaseModelTest { */ function testFindAllForeignKey() { $this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll'); - $ProductUpdateAll = new ProductUpdateAll(); + $ProductUpdateAll =& new ProductUpdateAll(); $conditions = array('Group.name' => 'group one'); @@ -3956,7 +3956,7 @@ class ModelWriteTest extends BaseModelTest { */ function testProductUpdateAll() { $this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll'); - $ProductUpdateAll = new ProductUpdateAll(); + $ProductUpdateAll =& new ProductUpdateAll(); $conditions = array('Group.name' => 'group one'); @@ -4002,7 +4002,7 @@ class ModelWriteTest extends BaseModelTest { */ function testProductUpdateAllWithoutForeignKey() { $this->loadFixtures('ProductUpdateAll', 'GroupUpdateAll'); - $ProductUpdateAll = new ProductUpdateAll(); + $ProductUpdateAll =& new ProductUpdateAll(); $conditions = array('Group.name' => 'group one'); diff --git a/cake/tests/cases/libs/model/schema.test.php b/cake/tests/cases/libs/model/schema.test.php index 209c5d24..fc35f5c1 100755 --- a/cake/tests/cases/libs/model/schema.test.php +++ b/cake/tests/cases/libs/model/schema.test.php @@ -480,7 +480,7 @@ class CakeSchemaTest extends CakeTestCase { $db =& ConnectionManager::getDataSource('test_suite'); $db->cacheSources = false; - $Schema = new CakeSchema(array( + $Schema =& new CakeSchema(array( 'connection' => 'test_suite', 'testdescribes' => array( 'id' => array('type' => 'integer', 'key' => 'primary'), diff --git a/cake/tests/cases/libs/object.test.php b/cake/tests/cases/libs/object.test.php index 896c47be..743d88da 100755 --- a/cake/tests/cases/libs/object.test.php +++ b/cake/tests/cases/libs/object.test.php @@ -154,7 +154,7 @@ class RequestActionPersistentController extends Controller { * @package cake * @subpackage cake.tests.cases.libs */ -class TestObject extends CakeObject { +class TestObject extends Object { /** * firstName property * @@ -392,7 +392,7 @@ class ObjectTest extends CakeTestCase { @unlink(CACHE . 'persistent' . DS . 'testmodel.php'); - $model = new ObjectTestModel(); + $model =& new ObjectTestModel(); $expected = ClassRegistry::keys(); ClassRegistry::flush(); diff --git a/cake/tests/cases/libs/sanitize.test.php b/cake/tests/cases/libs/sanitize.test.php index 3048613f..1899f16c 100755 --- a/cake/tests/cases/libs/sanitize.test.php +++ b/cake/tests/cases/libs/sanitize.test.php @@ -405,7 +405,7 @@ class SanitizeTest extends CakeTestCase { function testFormatColumns() { $this->loadFixtures('DataTest', 'Article'); - $this->DataTest = new SanitizeDataTest(array('alias' => 'DataTest')); + $this->DataTest =& new SanitizeDataTest(array('alias' => 'DataTest')); $data = array('DataTest' => array( 'id' => 'z', 'count' => '12a', @@ -424,7 +424,7 @@ class SanitizeTest extends CakeTestCase { $result = $this->DataTest->data; $this->assertEqual($result, $expected); - $this->Article = new SanitizeArticle(array('alias' => 'Article')); + $this->Article =& new SanitizeArticle(array('alias' => 'Article')); $data = array('Article' => array( 'id' => 'ZB', 'user_id' => '12', diff --git a/cake/tests/cases/libs/session.test.php b/cake/tests/cases/libs/session.test.php index ca208b0c..f74d626f 100755 --- a/cake/tests/cases/libs/session.test.php +++ b/cake/tests/cases/libs/session.test.php @@ -63,7 +63,7 @@ class SessionTest extends CakeTestCase { * @return void */ function setUp() { - $this->Session = new CakeSession(); + $this->Session =& new CakeSession(); $this->Session->start(); $this->Session->_checkValid(); } diff --git a/cake/tests/cases/libs/test_manager.test.php b/cake/tests/cases/libs/test_manager.test.php index 2c4c4129..b8eb5de2 100755 --- a/cake/tests/cases/libs/test_manager.test.php +++ b/cake/tests/cases/libs/test_manager.test.php @@ -41,8 +41,8 @@ class TestManagerTest extends CakeTestCase { * @access public */ function setUp() { - $this->Sut = new TestManager(); - $this->Reporter = new CakeHtmlReporter(); + $this->Sut =& new TestManager(); + $this->Reporter =& new CakeHtmlReporter(); } /** * testRunAllTests method @@ -51,11 +51,11 @@ class TestManagerTest extends CakeTestCase { * @access public */ function testRunAllTests() { - $folder = new Folder($this->Sut->_getTestsPath()); + $folder =& new Folder($this->Sut->_getTestsPath()); $extension = str_replace('.', '\.', TestManager::getExtension('test')); $out = $folder->findRecursive('.*' . $extension); - $reporter = new CakeHtmlReporter(); + $reporter =& new CakeHtmlReporter(); $list = TestManager::runAllTests($reporter, true); $this->assertEqual(count($out), count($list)); diff --git a/cake/tests/cases/libs/view/helpers/ajax.test.php b/cake/tests/cases/libs/view/helpers/ajax.test.php index 2d32d45a..439846e0 100755 --- a/cake/tests/cases/libs/view/helpers/ajax.test.php +++ b/cake/tests/cases/libs/view/helpers/ajax.test.php @@ -166,12 +166,12 @@ class AjaxHelperTest extends CakeTestCase { */ function setUp() { Router::reload(); - $this->Ajax = new TestAjaxHelper(); - $this->Ajax->Html = new HtmlHelper(); - $this->Ajax->Form = new FormHelper(); - $this->Ajax->Javascript = new JavascriptHelper(); + $this->Ajax =& new TestAjaxHelper(); + $this->Ajax->Html =& new HtmlHelper(); + $this->Ajax->Form =& new FormHelper(); + $this->Ajax->Javascript =& new JavascriptHelper(); $this->Ajax->Form->Html =& $this->Ajax->Html; - $view = new View(new AjaxTestController()); + $view =& new View(new AjaxTestController()); ClassRegistry::addObject('view', $view); ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest()); } @@ -832,7 +832,7 @@ class AjaxHelperTest extends CakeTestCase { */ function testAfterRender() { $oldXUpdate = env('HTTP_X_UPDATE'); - $this->Ajax->Javascript = new TestJavascriptHelper(); + $this->Ajax->Javascript =& new TestJavascriptHelper(); $_SERVER['HTTP_X_UPDATE'] = 'secondDiv myDiv anotherDiv'; $result = $this->Ajax->div('myDiv'); diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index c82f7b04..af00110f 100755 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -601,10 +601,10 @@ class FormHelperTest extends CakeTestCase { parent::setUp(); Router::reload(); - $this->Form = new FormHelper(); - $this->Form->Html = new HtmlHelper(); - $this->Controller = new ContactTestController(); - $this->View = new View($this->Controller); + $this->Form =& new FormHelper(); + $this->Form->Html =& new HtmlHelper(); + $this->Controller =& new ContactTestController(); + $this->View =& new View($this->Controller); ClassRegistry::addObject('view', $view); ClassRegistry::addObject('Contact', new Contact()); @@ -4348,11 +4348,11 @@ class FormHelperTest extends CakeTestCase { **/ function testFileUploadOnOtherModel() { ClassRegistry::removeObject('view'); - $controller = new Controller(); + $controller =& new Controller(); $controller->name = 'ValidateUsers'; $controller->uses = array('ValidateUser'); $controller->constructClasses(); - $view = new View($controller, true); + $view =& new View($controller, true); $this->Form->create('ValidateUser', array('type' => 'file')); $result = $this->Form->file('ValidateProfile.city'); diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index cfeee928..52dd5cba 100755 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -90,8 +90,8 @@ class HtmlHelperTest extends CakeTestCase { * @return void */ function setUp() { - $this->Html = new HtmlHelper(); - $view = new View(new TheHtmlTestController()); + $this->Html =& new HtmlHelper(); + $view =& new View(new TheHtmlTestController()); ClassRegistry::addObject('view', $view); $this->_appEncoding = Configure::read('App.encoding'); $this->_asset = Configure::read('Asset'); diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php index 84c6a5cf..7ebad00e 100755 --- a/cake/tests/cases/libs/view/helpers/javascript.test.php +++ b/cake/tests/cases/libs/view/helpers/javascript.test.php @@ -114,10 +114,10 @@ class JavascriptTest extends CakeTestCase { * @return void */ function startTest() { - $this->Javascript = new JavascriptHelper(); - $this->Javascript->Html = new HtmlHelper(); - $this->Javascript->Form = new FormHelper(); - $this->View = new TheView(new TheJsTestController()); + $this->Javascript =& new JavascriptHelper(); + $this->Javascript->Html =& new HtmlHelper(); + $this->Javascript->Form =& new FormHelper(); + $this->View =& new TheView(new TheJsTestController()); ClassRegistry::addObject('view', $this->View); } /** @@ -140,10 +140,10 @@ class JavascriptTest extends CakeTestCase { * @return void */ function testConstruct() { - $Javascript = new JavascriptHelper(array('safe')); + $Javascript =& new JavascriptHelper(array('safe')); $this->assertTrue($Javascript->safe); - $Javascript = new JavascriptHelper(array('safe' => false)); + $Javascript =& new JavascriptHelper(array('safe' => false)); $this->assertFalse($Javascript->safe); } /** diff --git a/cake/tests/cases/libs/view/helpers/number.test.php b/cake/tests/cases/libs/view/helpers/number.test.php index 20d667a4..ccc54540 100755 --- a/cake/tests/cases/libs/view/helpers/number.test.php +++ b/cake/tests/cases/libs/view/helpers/number.test.php @@ -46,7 +46,7 @@ class NumberHelperTest extends CakeTestCase { * @return void */ function setUp() { - $this->Number = new NumberHelper(); + $this->Number =& new NumberHelper(); } /** * tearDown method diff --git a/cake/tests/cases/libs/view/helpers/paginator.test.php b/cake/tests/cases/libs/view/helpers/paginator.test.php index 319d69d9..3b8817ab 100755 --- a/cake/tests/cases/libs/view/helpers/paginator.test.php +++ b/cake/tests/cases/libs/view/helpers/paginator.test.php @@ -60,11 +60,11 @@ class PaginatorHelperTest extends CakeTestCase { ) ) ); - $this->Paginator->Html = new HtmlHelper(); - $this->Paginator->Ajax = new AjaxHelper(); - $this->Paginator->Ajax->Html = new HtmlHelper(); - $this->Paginator->Ajax->Javascript = new JavascriptHelper(); - $this->Paginator->Ajax->Form = new FormHelper(); + $this->Paginator->Html =& new HtmlHelper(); + $this->Paginator->Ajax =& new AjaxHelper(); + $this->Paginator->Ajax->Html =& new HtmlHelper(); + $this->Paginator->Ajax->Javascript =& new JavascriptHelper(); + $this->Paginator->Ajax->Form =& new FormHelper(); Configure::write('Routing.admin', ''); Router::reload(); diff --git a/cake/tests/cases/libs/view/helpers/rss.test.php b/cake/tests/cases/libs/view/helpers/rss.test.php index 6b73692b..0f49570f 100755 --- a/cake/tests/cases/libs/view/helpers/rss.test.php +++ b/cake/tests/cases/libs/view/helpers/rss.test.php @@ -39,8 +39,8 @@ class RssHelperTest extends CakeTestCase { * @return void */ function setUp() { - $this->Rss = new RssHelper(); - $this->Rss->Time = new TimeHelper(); + $this->Rss =& new RssHelper(); + $this->Rss->Time =& new TimeHelper(); $this->Rss->beforeRender(); $manager =& XmlManager::getInstance(); diff --git a/cake/tests/cases/libs/view/helpers/xml.test.php b/cake/tests/cases/libs/view/helpers/xml.test.php index 721e8b90..c7b1bae7 100755 --- a/cake/tests/cases/libs/view/helpers/xml.test.php +++ b/cake/tests/cases/libs/view/helpers/xml.test.php @@ -34,7 +34,7 @@ App::import('Helper', 'Xml'); * @package cake * @subpackage cake.tests.cases.libs.view.helpers */ -class TestXml extends CakeObject { +class TestXml extends Object { /** * content property * @@ -76,7 +76,7 @@ class XmlHelperTest extends CakeTestCase { * @return void */ function setUp() { - $this->Xml = new XmlHelper(); + $this->Xml =& new XmlHelper(); $this->Xml->beforeRender(); $manager =& XmlManager::getInstance(); $manager->namespaces = array(); diff --git a/cake/tests/cases/libs/view/theme.test.php b/cake/tests/cases/libs/view/theme.test.php index ce3cafe6..eeb5dd88 100755 --- a/cake/tests/cases/libs/view/theme.test.php +++ b/cake/tests/cases/libs/view/theme.test.php @@ -123,7 +123,7 @@ class TestThemeView extends ThemeView { * @return void */ function cakeError($method, $messages) { - $error = new ThemeViewTestErrorHandler($method, $messages); + $error =& new ThemeViewTestErrorHandler($method, $messages); return $error; } } diff --git a/cake/tests/cases/libs/view/view.test.php b/cake/tests/cases/libs/view/view.test.php index 62d1454a..103a4b73 100755 --- a/cake/tests/cases/libs/view/view.test.php +++ b/cake/tests/cases/libs/view/view.test.php @@ -164,7 +164,7 @@ class TestView extends View { * @return void */ function cakeError($method, $messages) { - $error = new ViewTestErrorHandler($method, $messages); + $error =& new ViewTestErrorHandler($method, $messages); return $error; } } @@ -541,7 +541,7 @@ class ViewTest extends CakeTestCase { **/ function testHelperCallbackTriggering() { $this->PostsController->helpers = array('Html', 'CallbackMock'); - $View = new TestView($this->PostsController); + $View =& new TestView($this->PostsController); $loaded = array(); $View->loaded = $View->loadHelpers($loaded, $this->PostsController->helpers); $View->loaded['CallbackMock']->expectOnce('beforeRender'); @@ -558,7 +558,7 @@ class ViewTest extends CakeTestCase { */ function testBeforeLayout() { $this->PostsController->helpers = array('TestAfter', 'Html'); - $View = new View($this->PostsController); + $View =& new View($this->PostsController); $out = $View->render('index'); $this->assertEqual($View->loaded['testAfter']->property, 'Valuation'); } @@ -572,7 +572,7 @@ class ViewTest extends CakeTestCase { $this->PostsController->helpers = array('TestAfter', 'Html'); $this->PostsController->set('variable', 'values'); - $View = new View($this->PostsController); + $View =& new View($this->PostsController); ClassRegistry::addObject('afterView', $View); $content = 'This is my view output'; diff --git a/cake/tests/cases/libs/xml.test.php b/cake/tests/cases/libs/xml.test.php index bb15e96e..acff6c89 100755 --- a/cake/tests/cases/libs/xml.test.php +++ b/cake/tests/cases/libs/xml.test.php @@ -39,7 +39,7 @@ class XmlTest extends CakeTestCase { * @return void */ function setUp() { - $manager = new XmlManager(); + $manager =& new XmlManager(); $manager->namespaces = array(); } /** @@ -111,7 +111,7 @@ class XmlTest extends CakeTestCase { array('Status' => array('id' => 2)) ) ); - $result = new Xml($data, array('format' => 'tags')); + $result =& new Xml($data, array('format' => 'tags')); $expected = '12'; $this->assertIdentical($result->toString(), $expected); @@ -123,27 +123,27 @@ class XmlTest extends CakeTestCase { * @return void **/ function testSerializationOfBooleanAndBooleanishValues() { - $xml = new Xml(array('data' => array('example' => false))); + $xml =& new Xml(array('data' => array('example' => false))); $result = $xml->toString(false); $expected = ''; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); - $xml = new Xml(array('data' => array('example' => true))); + $xml =& new Xml(array('data' => array('example' => true))); $result = $xml->toString(false); $expected = ''; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); - $xml = new Xml(array('data' => array('example' => null))); + $xml =& new Xml(array('data' => array('example' => null))); $result = $xml->toString(false); $expected = ''; $this->assertEqual($result, $expected, 'Boolean values incorrectly handled. %s'); - $xml = new Xml(array('data' => array('example' => 0))); + $xml =& new Xml(array('data' => array('example' => 0))); $result = $xml->toString(false); $expected = ''; $this->assertEqual($result, $expected, 'Boolean-ish values incorrectly handled. %s'); - $xml = new Xml(array('data' => array('example' => 1))); + $xml =& new Xml(array('data' => array('example' => 1))); $result = $xml->toString(false); $expected = ''; $this->assertEqual($result, $expected, 'Boolean-ish values incorrectly handled. %s'); @@ -334,7 +334,7 @@ class XmlTest extends CakeTestCase { * @return void */ function testCloneNode() { - $node = new XmlNode('element', 'myValue'); + $node =& new XmlNode('element', 'myValue'); $twin =& $node->cloneNode(); $this->assertEqual($node, $twin); } @@ -359,7 +359,7 @@ class XmlTest extends CakeTestCase { 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); - $xml = new Xml($input, array('format' => 'tags')); + $xml =& new Xml($input, array('format' => 'tags')); $node =& $xml->children[0]->children[0]; $nextSibling =& $node->nextSibling(); @@ -392,7 +392,7 @@ class XmlTest extends CakeTestCase { 'Industry' => array('id' => 2, 'name' => 'Education'), ) ); - $xml = new Xml($input, array('format' => 'tags')); + $xml =& new Xml($input, array('format' => 'tags')); $node =& $xml->children[0]->children[1]; $prevSibling =& $node->previousSibling(); @@ -407,7 +407,7 @@ class XmlTest extends CakeTestCase { * @return void */ function testAddAndRemoveAttributes() { - $node = new XmlElement('myElement', 'superValue'); + $node =& new XmlElement('myElement', 'superValue'); $this->assertTrue(empty($node->attributes)); $attrs = array( @@ -418,12 +418,12 @@ class XmlTest extends CakeTestCase { $node->addAttribute($attrs); $this->assertEqual($node->attributes, $attrs); - $node = new XmlElement('myElement', 'superValue'); + $node =& new XmlElement('myElement', 'superValue'); $node->addAttribute('test', 'value'); $this->assertTrue(isset($node->attributes['test'])); - $node = new XmlElement('myElement', 'superValue'); - $obj = new StdClass(); + $node =& new XmlElement('myElement', 'superValue'); + $obj =& new StdClass(); $obj->class = 'info'; $obj->id = 'primaryInfoBox'; $node->addAttribute($obj); @@ -774,7 +774,7 @@ class XmlTest extends CakeTestCase { varchar(45) '; - $xml = new XML($filledValue); + $xml =& new XML($filledValue); $expected = array( 'Method' => array( 'name' => 'set_user_settings', @@ -798,7 +798,7 @@ class XmlTest extends CakeTestCase { '; - $xml = new XML($emptyValue); + $xml =& new XML($emptyValue); $expected = array( 'Method' => array( 'name' => 'set_user_settings', diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index 13e172a4..f642e36a 100755 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -239,7 +239,7 @@ class CakeTestCase extends UnitTestCase { $this->_actionFixtures = array(); foreach ($models as $model) { - $fixture = new CakeTestFixture($this->db); + $fixture =& new CakeTestFixture($this->db); $fixture->name = $model['model'] . 'Test'; $fixture->table = $model['table']; @@ -335,7 +335,7 @@ class CakeTestCase extends UnitTestCase { $return = $params['return']; $params = array_diff_key($params, array('data' => null, 'method' => null, 'return' => null)); - $dispatcher = new CakeTestDispatcher(); + $dispatcher =& new CakeTestDispatcher(); $dispatcher->testCase($this); if ($return != 'result') { @@ -770,7 +770,7 @@ class CakeTestCase extends UnitTestCase { if (isset($fixtureFile)) { require_once($fixtureFile); $fixtureClass = Inflector::camelize($fixture) . 'Fixture'; - $this->_fixtures[$this->fixtures[$index]] = new $fixtureClass($this->db); + $this->_fixtures[$this->fixtures[$index]] =& new $fixtureClass($this->db); $this->_fixtureClassMap[Inflector::camelize($fixture)] = $this->fixtures[$index]; } } diff --git a/cake/tests/lib/cake_test_fixture.php b/cake/tests/lib/cake_test_fixture.php index faba01fa..cd12f9a3 100755 --- a/cake/tests/lib/cake_test_fixture.php +++ b/cake/tests/lib/cake_test_fixture.php @@ -30,7 +30,7 @@ * @package cake * @subpackage cake.cake.tests.lib */ -class CakeTestFixture extends CakeObject { +class CakeTestFixture extends Object { /** * Name of the object * @@ -81,7 +81,7 @@ class CakeTestFixture extends CakeObject { ClassRegistry::config(array('ds' => 'test_suite')); ClassRegistry::flush(); } elseif (isset($import['table'])) { - $model = new Model(null, $import['table'], $import['connection']); + $model =& new Model(null, $import['table'], $import['connection']); $db =& ConnectionManager::getDataSource($import['connection']); $db->cacheSources = false; $model->useDbConfig = $import['connection']; diff --git a/cake/tests/lib/code_coverage_manager.php b/cake/tests/lib/code_coverage_manager.php index 511b9c9d..1000c675 100755 --- a/cake/tests/lib/code_coverage_manager.php +++ b/cake/tests/lib/code_coverage_manager.php @@ -78,7 +78,7 @@ class CodeCoverageManager { function &getInstance() { static $instance = array(); if (!$instance) { - $instance[0] = new CodeCoverageManager(); + $instance[0] =& new CodeCoverageManager(); } return $instance[0]; } @@ -477,10 +477,10 @@ class CodeCoverageManager { break; } } - $testManager = new TestManager(); + $testManager =& new TestManager(); $testFile = str_replace(array('/', $testManager->_testExtension), array(DS, '.php'), $file); - $folder = new Folder(); + $folder =& new Folder(); $folder->cd(ROOT . DS . CAKE_TESTS_LIB); $contents = $folder->ls(); @@ -506,7 +506,7 @@ class CodeCoverageManager { */ function __testObjectFilesFromGroupFile($groupFile, $isApp = true) { $manager = CodeCoverageManager::getInstance(); - $testManager = new TestManager(); + $testManager =& new TestManager(); $path = TESTS . 'groups'; diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index c49e19b2..d614ed6d 100755 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -77,15 +77,15 @@ class TestManager { * @access public */ function runAllTests(&$reporter, $testing = false) { - $manager = new TestManager(); + $manager =& new TestManager(); $testCases =& $manager->_getTestFileList($manager->_getTestsPath()); if ($manager->appTest) { - $test = new GroupTest('All App Tests'); + $test =& new GroupTest('All App Tests'); } else if ($manager->pluginTest) { - $test = new GroupTest('All ' . Inflector::humanize($manager->pluginTest) . ' Plugin Tests'); + $test =& new GroupTest('All ' . Inflector::humanize($manager->pluginTest) . ' Plugin Tests'); } else { - $test = new GroupTest('All Core Tests'); + $test =& new GroupTest('All Core Tests'); } if ($testing) { @@ -107,7 +107,7 @@ class TestManager { * @access public */ function runTestCase($testCaseFile, &$reporter, $testing = false) { - $manager = new TestManager(); + $manager =& new TestManager(); $testCaseFileWithPath = $manager->_getTestsPath() . DS . $testCaseFile; @@ -120,7 +120,7 @@ class TestManager { return true; } - $test = new GroupTest("Individual test case: " . $testCaseFile); + $test =& new GroupTest("Individual test case: " . $testCaseFile); $test->addTestFile($testCaseFileWithPath); return $test->run($reporter); } @@ -133,7 +133,7 @@ class TestManager { * @access public */ function runGroupTest($groupTestName, &$reporter) { - $manager = new TestManager(); + $manager =& new TestManager(); $filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension; if (!file_exists($filePath)) { @@ -141,7 +141,7 @@ class TestManager { } require_once $filePath; - $test = new GroupTest($groupTestName . ' group test'); + $test =& new GroupTest($groupTestName . ' group test'); foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) { $testCase = new $groupTest(); $test->addTestCase($testCase); @@ -160,7 +160,7 @@ class TestManager { * @access public */ function addTestCasesFromDirectory(&$groupTest, $directory = '.') { - $manager = new TestManager(); + $manager =& new TestManager(); $testCases =& $manager->_getTestFileList($directory); foreach ($testCases as $testCase) { $groupTest->addTestFile($testCase); @@ -175,7 +175,7 @@ class TestManager { * @access public */ function addTestFile(&$groupTest, $file) { - $manager = new TestManager(); + $manager =& new TestManager(); if (file_exists($file.'.test.php')) { $file .= '.test.php'; @@ -190,7 +190,7 @@ class TestManager { * @access public */ function &getTestCaseList() { - $manager = new TestManager(); + $manager =& new TestManager(); $return = $manager->_getTestCaseList($manager->_getTestsPath()); return $return; } @@ -222,7 +222,7 @@ class TestManager { * @access public */ function &getGroupTestList() { - $manager = new TestManager(); + $manager =& new TestManager(); $return = $manager->_getTestGroupList($manager->_getTestsPath('groups')); return $return; } @@ -360,7 +360,7 @@ class TestManager { * @access public */ function getExtension($type = 'test') { - $manager = new TestManager(); + $manager =& new TestManager(); if ($type == 'test') { return $manager->_testExtension; } @@ -380,7 +380,7 @@ class CliTestManager extends TestManager { * @access public */ function &getGroupTestList() { - $manager = new CliTestManager(); + $manager =& new CliTestManager(); $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); $buffer = "Available Group Test:\n"; @@ -395,7 +395,7 @@ class CliTestManager extends TestManager { * @access public */ function &getTestCaseList() { - $manager = new CliTestManager(); + $manager =& new CliTestManager(); $testCases =& $manager->_getTestCaseList($manager->_getTestsPath()); $buffer = "Available Test Cases:\n"; @@ -438,7 +438,7 @@ class TextTestManager extends TestManager { * @access public */ function &getGroupTestList() { - $manager = new TextTestManager(); + $manager =& new TextTestManager(); $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); $buffer = "Core Test Groups:\n"; @@ -465,7 +465,7 @@ class TextTestManager extends TestManager { * @access public */ function &getTestCaseList() { - $manager = new TextTestManager(); + $manager =& new TextTestManager(); $testCases =& $manager->_getTestCaseList($manager->_getTestsPath()); $buffer = "Core Test Cases:\n"; @@ -526,7 +526,7 @@ class HtmlTestManager extends TestManager { */ function &getGroupTestList() { $urlExtra = ''; - $manager = new HtmlTestManager(); + $manager =& new HtmlTestManager(); $groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups')); $buffer = "

Core Test Groups:

\n
    "; @@ -554,7 +554,7 @@ class HtmlTestManager extends TestManager { */ function &getTestCaseList() { $urlExtra = ''; - $manager = new HtmlTestManager(); + $manager =& new HtmlTestManager(); $testCases =& $manager->_getTestCaseList($manager->_getTestsPath()); $buffer = "

    Core Test Cases:

    \n
      "; @@ -599,10 +599,10 @@ if (function_exists('caketestsgetreporter')) { switch (CAKE_TEST_OUTPUT) { case CAKE_TEST_OUTPUT_HTML: require_once CAKE_TESTS_LIB . 'cake_reporter.php'; - $Reporter = new CakeHtmlReporter(); + $Reporter =& new CakeHtmlReporter(); break; default: - $Reporter = new TextReporter(); + $Reporter =& new TextReporter(); break; } } @@ -732,7 +732,7 @@ if (function_exists('caketestsgetreporter')) { if (!class_exists('dispatcher')) { require CAKE . 'dispatcher.php'; } - $dispatch = new Dispatcher(); + $dispatch =& new Dispatcher(); $dispatch->baseUrl(); define('BASE', $dispatch->webroot); $baseUrl = BASE; diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php index c10ec835..ab3cb7b2 100755 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php @@ -24,7 +24,7 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -class OtherComponentComponent extends CakeObject { +class OtherComponentComponent extends Object { } ?> \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php index 3fd81a56..6a80527d 100755 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php @@ -24,7 +24,7 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -class PluginsComponentComponent extends CakeObject { +class PluginsComponentComponent extends Object { var $components = array('TestPlugin.OtherComponent'); } ?> \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php index 0e6690a2..23a462bf 100755 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php @@ -24,7 +24,7 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -class TestPluginComponentComponent extends CakeObject { +class TestPluginComponentComponent extends Object { var $components = array('TestPlugin.TestPluginOtherComponent'); } ?> \ No newline at end of file diff --git a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php index ac480a7a..560e0702 100755 --- a/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php +++ b/cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php @@ -24,7 +24,7 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */ -class TestPluginOtherComponentComponent extends CakeObject { +class TestPluginOtherComponentComponent extends Object { } ?> \ No newline at end of file diff --git a/conf/nginx-proxy.conf b/conf/nginx-proxy.conf index ba92a2c6..e1652854 100644 --- a/conf/nginx-proxy.conf +++ b/conf/nginx-proxy.conf @@ -44,14 +44,14 @@ http { ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; - # Upstream servers (using external container names) + # Upstream servers upstream cmc_staging { - server cmc-nginx-staging:80; + server nginx-staging:80; keepalive 32; } upstream cmc_production { - server cmc-nginx-production:80; + server nginx-production:80; keepalive 32; } diff --git a/docker-compose.caddy-staging-ubuntu.yml b/docker-compose.caddy-staging-ubuntu.yml index 538e571c..08635661 100644 --- a/docker-compose.caddy-staging-ubuntu.yml +++ b/docker-compose.caddy-staging-ubuntu.yml @@ -12,21 +12,9 @@ services: ports: - "127.0.0.1:8091:80" volumes: - # Mount specific app directories while preserving cake core - - ./app/config:/var/www/cmc-sales/app/config - - ./app/controllers:/var/www/cmc-sales/app/controllers - - ./app/models:/var/www/cmc-sales/app/models - - ./app/views:/var/www/cmc-sales/app/views - - ./app/vendors:/var/www/cmc-sales/app/vendors - - ./app/webroot/css:/var/www/cmc-sales/app/webroot/css - - ./app/webroot/js:/var/www/cmc-sales/app/webroot/js - - ./app/webroot/img:/var/www/cmc-sales/app/webroot/img + - ./app:/var/www/cmc-sales/app - staging_pdf_data:/var/www/cmc-sales/app/webroot/pdf - staging_attachments_data:/var/www/cmc-sales/app/webroot/attachments_files - # Mount cake directory to ensure CakePHP core is available - - ./cake:/var/www/cmc-sales/cake - - ./vendors:/var/www/cmc-sales/vendors - - ./index.php:/var/www/cmc-sales/index.php restart: unless-stopped environment: - APP_ENV=staging diff --git a/docker-compose.proxy.yml b/docker-compose.proxy.yml new file mode 100644 index 00000000..616270ab --- /dev/null +++ b/docker-compose.proxy.yml @@ -0,0 +1,68 @@ +# Main reverse proxy for both staging and production +version: '3.8' + +services: + nginx-proxy: + image: nginx:latest + container_name: cmc-nginx-proxy + ports: + - "80:80" + - "443:443" + volumes: + - ./conf/nginx-proxy.conf:/etc/nginx/nginx.conf + - lego_certificates:/etc/ssl/certs:ro + - lego_acme_challenge:/var/www/acme-challenge:ro + restart: unless-stopped + depends_on: + - nginx-staging + - nginx-production + networks: + - proxy-network + - cmc-staging-network + - cmc-production-network + + lego: + image: goacme/lego:latest + container_name: cmc-lego + volumes: + - lego_certificates:/data/certificates + - lego_accounts:/data/accounts + - lego_acme_challenge:/data/acme-challenge + - ./scripts:/scripts:ro + environment: + - LEGO_DISABLE_CNAME=true + command: sleep infinity + restart: unless-stopped + networks: + - proxy-network + + # Import staging services + nginx-staging: + extends: + file: docker-compose.staging.yml + service: nginx-staging + networks: + - proxy-network + - cmc-staging-network + + # Import production services + nginx-production: + extends: + file: docker-compose.production.yml + service: nginx-production + networks: + - proxy-network + - cmc-production-network + +volumes: + lego_certificates: + lego_accounts: + lego_acme_challenge: + +networks: + proxy-network: + driver: bridge + cmc-staging-network: + external: true + cmc-production-network: + external: true \ No newline at end of file diff --git a/index.php b/index.php index 7e3c92de..c6a3a1b1 100755 --- a/index.php +++ b/index.php @@ -52,12 +52,6 @@ require CORE_PATH . 'cake' . DS . 'basics.php'; $TIME_START = getMicrotime(); require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php'; - - // Load PHP 7 compatibility early - if (file_exists(APP_DIR . DS . 'config' . DS . 'php7_compat.php')) { - require APP_DIR . DS . 'config' . DS . 'php7_compat.php'; - } - require LIBS . 'object.php'; require LIBS . 'inflector.php'; require LIBS . 'configure.php'; diff --git a/scripts/backup-db.sh b/scripts/backup-db.sh deleted file mode 100755 index 9094d9db..00000000 --- a/scripts/backup-db.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Database backup script for CMC Sales -# Usage: ./scripts/backup-db.sh [staging|production] - -set -e - -ENVIRONMENT=${1:-production} -BACKUP_DIR="/var/backups/cmc-sales" -DATE=$(date +%Y%m%d-%H%M%S) - -# Create backup directory if it doesn't exist -mkdir -p "$BACKUP_DIR" - -case $ENVIRONMENT in - staging) - CONTAINER="cmc-db-staging" - DB_NAME="cmc_staging" - DB_USER="cmc_staging" - BACKUP_FILE="$BACKUP_DIR/backup_staging_${DATE}.sql.gz" - ;; - production) - CONTAINER="cmc-db-production" - DB_NAME="cmc" - DB_USER="cmc" - BACKUP_FILE="$BACKUP_DIR/backup_production_${DATE}.sql.gz" - ;; - *) - echo "Usage: $0 [staging|production]" - exit 1 - ;; -esac - -echo "Creating backup for $ENVIRONMENT environment..." -echo "Container: $CONTAINER" -echo "Database: $DB_NAME" -echo "Output: $BACKUP_FILE" - -# Create backup -docker exec -e MYSQL_PWD="$(docker exec $CONTAINER printenv | grep MYSQL_PASSWORD | cut -d= -f2)" \ - $CONTAINER \ - mysqldump --single-transaction --routines --triggers --user=$DB_USER $DB_NAME | \ - gzip > "$BACKUP_FILE" - -# Verify backup was created -if [ -f "$BACKUP_FILE" ]; then - BACKUP_SIZE=$(stat -f%z "$BACKUP_FILE" 2>/dev/null || stat -c%s "$BACKUP_FILE" 2>/dev/null) - echo "Backup created successfully: $BACKUP_FILE (${BACKUP_SIZE} bytes)" - - # Clean up old backups (keep last 7 days) - find "$BACKUP_DIR" -name "backup_${ENVIRONMENT}_*.sql.gz" -type f -mtime +7 -delete - echo "Old backups cleaned up (kept last 7 days)" -else - echo "ERROR: Backup file was not created!" - exit 1 -fi \ No newline at end of file diff --git a/scripts/debug-php-container.sh b/scripts/debug-php-container.sh deleted file mode 100755 index 324dd1df..00000000 --- a/scripts/debug-php-container.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# Debug script for PHP container segfault issues - -echo "=== PHP Container Debug Script ===" -echo "" - -# Check if container exists -echo "1. Checking for existing containers..." -docker ps -a | grep cmc-php-staging - -# Get detailed logs -echo "" -echo "2. Getting container logs..." -docker logs cmc-php-staging --tail 50 2>&1 | tee php-debug.log - -# Check container exit status -echo "" -echo "3. Checking container exit status..." -docker inspect cmc-php-staging --format='{{.State.ExitCode}} {{.State.Error}}' 2>/dev/null || echo "Container not found" - -# Try running with different commands to isolate the issue -echo "" -echo "4. Testing different startup commands..." - -# Test 1: Just run bash -echo " Test 1: Running bash shell..." -docker run --rm -it --name cmc-php-test1 \ - --platform linux/amd64 \ - -v $(pwd):/debug \ - ghcr.io/kzrl/ubuntu:lucid \ - bash -c "echo 'Container started successfully'" - -# Test 2: Check Apache installation -echo "" -echo " Test 2: Testing with Apache installation..." -docker run --rm -it --name cmc-php-test2 \ - --platform linux/amd64 \ - -e DEBIAN_FRONTEND=noninteractive \ - ghcr.io/kzrl/ubuntu:lucid \ - bash -c "sed -i 's/archive/old-releases/' /etc/apt/sources.list && apt-get update && apt-get -y install apache2 && echo 'Apache installed successfully'" - -# Test 3: Build with alternative command -echo "" -echo "5. Building with debug mode..." -docker build --platform linux/amd64 --progress=plain -t cmc-php-debug -f Dockerfile.debug . 2>&1 | tee build-debug.log - -echo "" -echo "Debug information saved to:" -echo " - php-debug.log" -echo " - build-debug.log" -echo "" -echo "Common segfault causes:" -echo " 1. Platform incompatibility (ARM vs x86)" -echo " 2. Corrupted base image" -echo " 3. Memory issues" -echo " 4. Incompatible package versions" \ No newline at end of file diff --git a/scripts/deploy-staging-caddy.sh b/scripts/deploy-staging-caddy.sh deleted file mode 100755 index 438394f0..00000000 --- a/scripts/deploy-staging-caddy.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash - -# Deployment script for staging environment with Caddy and containers -# This script deploys the containerized staging environment - -set -e - -echo "=== CMC Sales Staging Deployment with Caddy ===" -echo "" - -# Check if running as root for Caddy operations -if [ "$EUID" -eq 0 ]; then - SUDO="" -else - SUDO="sudo" - echo "Note: You may be prompted for sudo password for Caddy operations" -fi - -# 1. Check prerequisites -echo "Checking prerequisites..." - -# Check if Caddy is installed -if ! command -v caddy &> /dev/null; then - echo "ERROR: Caddy is not installed. Please run ./scripts/install-caddy.sh first" - exit 1 -fi - -# Check if Docker is installed -if ! command -v docker &> /dev/null; then - echo "ERROR: Docker is not installed" - exit 1 -fi - -# Check if docker-compose is available -if ! docker compose version &> /dev/null; then - echo "ERROR: Docker Compose is not available" - exit 1 -fi - -# 2. Create necessary directories -echo "Creating directories..." -$SUDO mkdir -p /var/log/caddy -$SUDO chown caddy:caddy /var/log/caddy - -# 3. Stop existing services if running -echo "Checking for existing services..." -if docker ps | grep -q "cmc-.*-staging"; then - echo "Stopping existing staging containers..." - docker compose -f docker-compose.caddy-staging.yml down -fi - -# 4. Build and start containers -echo "Building and starting staging containers..." -docker compose -f docker-compose.caddy-staging.yml build --no-cache -docker compose -f docker-compose.caddy-staging.yml up -d - -# Wait for containers to be ready -echo "Waiting for containers to be ready..." -sleep 10 - -# 5. Check container health -echo "Checking container health..." -docker ps --filter "name=staging" - -# Test internal endpoints -echo "" -echo "Testing internal endpoints..." -echo -n "PHP container: " -curl -s -o /dev/null -w "%{http_code}" http://localhost:8091 || echo "Failed" -echo "" -echo -n "Go container: " -curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/api/v1/health || echo "Failed" -echo "" - -# 6. Deploy Caddy configuration -echo "Deploying Caddy configuration..." - -# Backup existing Caddyfile -if [ -f /etc/caddy/Caddyfile ]; then - $SUDO cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.backup.$(date +%Y%m%d-%H%M%S) -fi - -# Copy new Caddyfile -$SUDO cp Caddyfile.staging-containers /etc/caddy/Caddyfile.staging - -# Validate configuration -echo "Validating Caddy configuration..." -caddy validate --config /etc/caddy/Caddyfile.staging - -# 7. Update Caddy to use staging config -echo "Updating Caddy configuration..." -$SUDO cp /etc/caddy/Caddyfile.staging /etc/caddy/Caddyfile - -# Reload Caddy -echo "Reloading Caddy..." -$SUDO systemctl reload caddy - -# 8. Final health check -echo "" -echo "Performing final health check..." -sleep 5 - -# Test public endpoint -echo -n "Public HTTPS endpoint: " -if curl -s -o /dev/null -w "%{http_code}" https://staging.cmc.springupsoftware.com/health; then - echo " - OK" -else - echo " - Failed (this is normal if DNS is not set up yet)" -fi - -# 9. Show status -echo "" -echo "=== Deployment Complete ===" -echo "" -echo "Container Status:" -docker compose -f docker-compose.caddy-staging.yml ps -echo "" -echo "Caddy Status:" -$SUDO systemctl status caddy --no-pager | head -n 10 -echo "" -echo "Access staging at: https://staging.cmc.springupsoftware.com" -echo "Basic auth: Use credentials configured in Caddyfile" -echo "" -echo "Logs:" -echo " Caddy: sudo journalctl -u caddy -f" -echo " Containers: docker compose -f docker-compose.caddy-staging.yml logs -f" -echo " Access log: sudo tail -f /var/log/caddy/staging.cmc.springupsoftware.com.log" \ No newline at end of file diff --git a/scripts/fix-cakephp-compatibility.sh b/scripts/fix-cakephp-compatibility.sh deleted file mode 100755 index 2168a67c..00000000 --- a/scripts/fix-cakephp-compatibility.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -# Script to fix CakePHP 1.2.5 compatibility issues with newer PHP versions - -echo "=== CakePHP 1.2.5 Compatibility Fixes ===" -echo "" - -# Check if we're in the right directory -if [ ! -d "app/config" ]; then - echo "ERROR: Run this script from the CMC Sales root directory" - exit 1 -fi - -echo "Creating compatibility fixes..." - -# 1. Create a compatibility helper for PHP 7+ if it doesn't exist -mkdir -p app/config/patches - -cat > app/config/patches/php7_compatibility.php << 'EOF' -> app/config/bootstrap.php - echo "// PHP 7+ Compatibility" >> app/config/bootstrap.php - echo "if (version_compare(PHP_VERSION, '7.0.0') >= 0) {" >> app/config/bootstrap.php - echo " require_once(dirname(__FILE__) . '/patches/php7_compatibility.php');" >> app/config/bootstrap.php - echo "}" >> app/config/bootstrap.php - echo "Added compatibility include to bootstrap.php" -fi - -# 3. Fix common CakePHP core issues -echo "Checking for common issues..." - -# Fix Object::cakeError if it exists -if [ -f "cake/libs/object.php" ]; then - # Backup original - cp cake/libs/object.php cake/libs/object.php.bak - - # Fix call-time pass-by-reference - sed -i 's/&\$this->/\$this->/g' cake/libs/object.php - echo "Fixed cake/libs/object.php" -fi - -# 4. Create a test script -cat > app/webroot/test_php.php << 'EOF' -PHP Compatibility Test"; -echo "

      PHP Version: " . PHP_VERSION . "

      "; -echo "

      MySQL Extension: " . (function_exists('mysql_connect') || function_exists('mysqli_connect') ? 'Available' : 'Not Available') . "

      "; -echo "

      GD Extension: " . (extension_loaded('gd') ? 'Loaded' : 'Not Loaded') . "

      "; -echo "

      Error Reporting: " . error_reporting() . "

      "; -echo "

      CakePHP Constants:

      "; -echo "
      ";
      -if (defined('ROOT')) echo "ROOT: " . ROOT . "\n";
      -if (defined('APP_DIR')) echo "APP_DIR: " . APP_DIR . "\n";
      -if (defined('CAKE_CORE_INCLUDE_PATH')) echo "CAKE_CORE_INCLUDE_PATH: " . CAKE_CORE_INCLUDE_PATH . "\n";
      -echo "
      "; -phpinfo(); -EOF - -echo "" -echo "Compatibility fixes applied!" -echo "" -echo "Test your PHP setup at: http://localhost:8091/test_php.php" -echo "" -echo "If you still have issues:" -echo "1. Check error logs: docker logs cmc-php-staging" -echo "2. Try PHP 5.6 version: docker compose -f docker-compose.caddy-staging-php56.yml up -d" -echo "3. Use the original Dockerfile with fixes" \ No newline at end of file diff --git a/scripts/fix-cakephp-php7.sh b/scripts/fix-cakephp-php7.sh deleted file mode 100755 index 16ee13d3..00000000 --- a/scripts/fix-cakephp-php7.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Fix CakePHP for PHP 7 compatibility - -echo "Fixing CakePHP for PHP 7 compatibility..." - -# Fix =& new syntax in cake directory -echo "Fixing deprecated =& new syntax..." -find cake -name "*.php" -type f -exec perl -i -pe 's/=&\s*new/= new/g' {} \; - -# Fix extends Object to extends CakeObject -echo "Fixing Object class inheritance..." -find cake -name "*.php" -type f -exec perl -i -pe 's/extends Object/extends CakeObject/g' {} \; - -echo "CakePHP PHP 7 compatibility fixes applied!" -echo "Note: This is a bulk fix and may need manual verification for edge cases." \ No newline at end of file diff --git a/scripts/install-caddy.sh b/scripts/install-caddy.sh deleted file mode 100755 index 85e5c967..00000000 --- a/scripts/install-caddy.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Caddy installation script for Debian 12 -# Usage: sudo ./scripts/install-caddy.sh - -set -e - -if [ "$EUID" -ne 0 ]; then - echo "Please run as root (use sudo)" - exit 1 -fi - -echo "Installing Caddy web server on Debian 12..." - -# Install dependencies -apt update -apt install -y debian-keyring debian-archive-keyring apt-transport-https curl - -# Add Caddy GPG key -curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg - -# Add Caddy repository -curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list - -# Update and install Caddy -apt update -apt install -y caddy - -# Create directories -mkdir -p /etc/caddy -mkdir -p /var/log/caddy -mkdir -p /var/lib/caddy - -# Set permissions -chown caddy:caddy /var/log/caddy -chown caddy:caddy /var/lib/caddy - -# Enable and start Caddy service -systemctl enable caddy -systemctl stop caddy # We'll configure it first - -echo "Caddy installed successfully!" -echo "" -echo "Next steps:" -echo "1. Copy your Caddyfile to /etc/caddy/Caddyfile" -echo "2. Update the basicauth passwords in Caddyfile" -echo "3. Start Caddy with: sudo systemctl start caddy" -echo "4. Check status with: sudo systemctl status caddy" -echo "" -echo "Generate password hash with: caddy hash-password" \ No newline at end of file diff --git a/scripts/lego-list-certs.sh b/scripts/lego-list-certs.sh deleted file mode 100755 index 65e9f539..00000000 --- a/scripts/lego-list-certs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Lego SSL certificate listing script for CMC Sales -# Usage: ./scripts/lego-list-certs.sh - -set -e - -echo "Listing SSL certificates managed by Lego..." - -# Check if lego container is running -if ! docker ps | grep -q "cmc-lego"; then - echo "ERROR: Lego container is not running. Please start it first with 'make proxy'" - exit 1 -fi - -# List all certificates -docker exec cmc-lego lego \ - --path="/data" \ - list - -echo "" -echo "Certificate files in container:" -docker exec cmc-lego find /data/certificates -name "*.crt" -o -name "*.key" | sort \ No newline at end of file diff --git a/scripts/lego-obtain-cert.sh b/scripts/lego-obtain-cert.sh deleted file mode 100755 index 6f936108..00000000 --- a/scripts/lego-obtain-cert.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Lego SSL certificate obtainment script for CMC Sales -# Usage: ./scripts/lego-obtain-cert.sh [domain] [email] - -set -e - -DOMAIN=${1} -EMAIL=${2} - -if [ -z "$DOMAIN" ] || [ -z "$EMAIL" ]; then - echo "Usage: $0 " - echo "Example: $0 cmc.springupsoftware.com admin@springupsoftware.com" - exit 1 -fi - -echo "Obtaining SSL certificate for domain: $DOMAIN" -echo "Email: $EMAIL" - -# Check if lego container is running -if ! docker ps | grep -q "cmc-lego"; then - echo "ERROR: Lego container is not running. Please start it first with 'make proxy'" - exit 1 -fi - -# Run lego to obtain certificate -docker exec cmc-lego lego \ - --email="$EMAIL" \ - --domains="$DOMAIN" \ - --http \ - --http.webroot="/data/acme-challenge" \ - --path="/data" \ - --accept-tos \ - run - -if [ $? -eq 0 ]; then - echo "Certificate obtained successfully for $DOMAIN" - - # Copy certificates to the expected nginx locations - docker exec cmc-lego cp "/data/certificates/$DOMAIN.crt" "/data/certificates/$DOMAIN.crt" - docker exec cmc-lego cp "/data/certificates/$DOMAIN.key" "/data/certificates/$DOMAIN.key" - - # Reload nginx - docker exec cmc-nginx-proxy nginx -s reload - - echo "Nginx reloaded with new certificate" -else - echo "ERROR: Failed to obtain certificate for $DOMAIN" - exit 1 -fi \ No newline at end of file diff --git a/scripts/lego-renew-cert.sh b/scripts/lego-renew-cert.sh deleted file mode 100755 index f319ac52..00000000 --- a/scripts/lego-renew-cert.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# Lego SSL certificate renewal script for CMC Sales -# Usage: ./scripts/lego-renew-cert.sh [domain] - -set -e - -DOMAIN=${1} - -if [ -z "$DOMAIN" ]; then - echo "Usage: $0 " - echo "Example: $0 cmc.springupsoftware.com" - echo "" - echo "Or run without domain to renew all certificates:" - echo "$0 all" - exit 1 -fi - -echo "Renewing SSL certificate(s)..." - -# Check if lego container is running -if ! docker ps | grep -q "cmc-lego"; then - echo "ERROR: Lego container is not running. Please start it first with 'make proxy'" - exit 1 -fi - -if [ "$DOMAIN" = "all" ]; then - echo "Renewing all certificates..." - # Renew all certificates - docker exec cmc-lego lego \ - --http \ - --http.webroot="/data/acme-challenge" \ - --path="/data" \ - renew \ - --days=30 -else - echo "Renewing certificate for domain: $DOMAIN" - # Renew specific domain - docker exec cmc-lego lego \ - --domains="$DOMAIN" \ - --http \ - --http.webroot="/data/acme-challenge" \ - --path="/data" \ - renew \ - --days=30 -fi - -if [ $? -eq 0 ]; then - echo "Certificate renewal completed successfully" - - # Reload nginx to use new certificates - docker exec cmc-nginx-proxy nginx -s reload - echo "Nginx reloaded with renewed certificates" - - # Show certificate info - echo "" - echo "Certificate information:" - docker exec cmc-lego lego \ - --path="/data" \ - list -else - echo "ERROR: Certificate renewal failed" - exit 1 -fi \ No newline at end of file diff --git a/scripts/manage-staging-caddy.sh b/scripts/manage-staging-caddy.sh deleted file mode 100755 index 1f355a95..00000000 --- a/scripts/manage-staging-caddy.sh +++ /dev/null @@ -1,194 +0,0 @@ -#!/bin/bash - -# Management script for staging environment with Caddy and containers - -set -e - -COMPOSE_FILE="docker-compose.caddy-staging.yml" - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -function show_help { - echo "CMC Sales Staging Management (Caddy + Containers)" - echo "" - echo "Usage: $0 [command]" - echo "" - echo "Commands:" - echo " status Show status of all services" - echo " start Start staging containers" - echo " stop Stop staging containers" - echo " restart Restart staging containers" - echo " logs Show container logs" - echo " caddy-logs Show Caddy logs" - echo " backup Backup staging database" - echo " shell-php Enter PHP container shell" - echo " shell-go Enter Go container shell" - echo " shell-db Enter database shell" - echo " update Pull latest code and rebuild" - echo " clean Stop and remove containers" - echo "" -} - -function check_status { - echo -e "${GREEN}=== Service Status ===${NC}" - echo "" - - # Caddy status - echo -e "${YELLOW}Caddy Status:${NC}" - if systemctl is-active --quiet caddy; then - echo -e " ${GREEN}● Caddy is running${NC}" - echo -n " Config: " - caddy version - else - echo -e " ${RED}● Caddy is not running${NC}" - fi - echo "" - - # Container status - echo -e "${YELLOW}Container Status:${NC}" - docker compose -f $COMPOSE_FILE ps - echo "" - - # Port status - echo -e "${YELLOW}Port Status:${NC}" - sudo netstat -tlnp | grep -E ":(80|443|8091|8092|3307) " | grep LISTEN || echo " No staging ports found" - echo "" - - # Health checks - echo -e "${YELLOW}Health Checks:${NC}" - echo -n " PHP container (8091): " - curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8091 || echo "Failed" - echo -n " Go container (8092): " - curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8092/api/v1/health || echo "Failed" - echo -n " Public HTTPS: " - curl -s -o /dev/null -w "%{http_code}\n" https://staging.cmc.springupsoftware.com/health || echo "Not accessible" -} - -function start_services { - echo -e "${GREEN}Starting staging services...${NC}" - docker compose -f $COMPOSE_FILE up -d - echo "Waiting for services to be ready..." - sleep 10 - check_status -} - -function stop_services { - echo -e "${YELLOW}Stopping staging services...${NC}" - docker compose -f $COMPOSE_FILE stop -} - -function restart_services { - echo -e "${YELLOW}Restarting staging services...${NC}" - docker compose -f $COMPOSE_FILE restart - echo "Waiting for services to be ready..." - sleep 10 - check_status -} - -function show_logs { - echo -e "${GREEN}Showing container logs (Ctrl+C to exit)...${NC}" - docker compose -f $COMPOSE_FILE logs -f -} - -function show_caddy_logs { - echo -e "${GREEN}Showing Caddy logs (Ctrl+C to exit)...${NC}" - sudo journalctl -u caddy -f -} - -function backup_database { - echo -e "${GREEN}Backing up staging database...${NC}" - ./scripts/backup-db.sh staging -} - -function shell_php { - echo -e "${GREEN}Entering PHP container shell...${NC}" - docker exec -it cmc-php-staging /bin/bash -} - -function shell_go { - echo -e "${GREEN}Entering Go container shell...${NC}" - docker exec -it cmc-go-staging /bin/sh -} - -function shell_db { - echo -e "${GREEN}Entering database shell...${NC}" - docker exec -it cmc-db-staging mysql -u cmc_staging -p cmc_staging -} - -function update_deployment { - echo -e "${GREEN}Updating staging deployment...${NC}" - - # Pull latest code - echo "Pulling latest code..." - git pull origin main - - # Rebuild containers - echo "Rebuilding containers..." - docker compose -f $COMPOSE_FILE build --no-cache - - # Restart services - echo "Restarting services..." - docker compose -f $COMPOSE_FILE up -d - - echo "Waiting for services to be ready..." - sleep 10 - check_status -} - -function clean_deployment { - echo -e "${RED}WARNING: This will remove all staging containers and volumes!${NC}" - read -p "Are you sure? (yes/no): " confirm - if [ "$confirm" = "yes" ]; then - docker compose -f $COMPOSE_FILE down -v - echo "Staging environment cleaned" - else - echo "Cancelled" - fi -} - -# Main script logic -case "$1" in - status) - check_status - ;; - start) - start_services - ;; - stop) - stop_services - ;; - restart) - restart_services - ;; - logs) - show_logs - ;; - caddy-logs) - show_caddy_logs - ;; - backup) - backup_database - ;; - shell-php) - shell_php - ;; - shell-go) - shell_go - ;; - shell-db) - shell_db - ;; - update) - update_deployment - ;; - clean) - clean_deployment - ;; - *) - show_help - ;; -esac \ No newline at end of file diff --git a/scripts/quick-rebuild-staging.sh b/scripts/quick-rebuild-staging.sh deleted file mode 100755 index 9bcfaadf..00000000 --- a/scripts/quick-rebuild-staging.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Quick rebuild script for staging - -echo "=== Quick Staging Rebuild ===" - -# Stop containers -echo "Stopping containers..." -docker compose -f docker-compose.caddy-staging-ubuntu.yml down - -# Remove old images -echo "Cleaning up..." -docker system prune -f - -# Build and start -echo "Building and starting..." -docker compose -f docker-compose.caddy-staging-ubuntu.yml build --no-cache -docker compose -f docker-compose.caddy-staging-ubuntu.yml up -d - -# Wait for startup -echo "Waiting for containers to start..." -sleep 15 - -# Test -echo "Testing setup..." -./scripts/test-php-setup.sh \ No newline at end of file diff --git a/scripts/restore-db.sh b/scripts/restore-db.sh deleted file mode 100755 index 61fda52d..00000000 --- a/scripts/restore-db.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -# Database restore script for CMC Sales -# Usage: ./scripts/restore-db.sh [staging|production] - -set -e - -ENVIRONMENT=${1} -BACKUP_FILE=${2} - -if [ -z "$ENVIRONMENT" ] || [ -z "$BACKUP_FILE" ]; then - echo "Usage: $0 [staging|production] " - echo "Example: $0 staging /var/backups/cmc-sales/backup_staging_20240101-120000.sql.gz" - exit 1 -fi - -if [ ! -f "$BACKUP_FILE" ]; then - echo "ERROR: Backup file not found: $BACKUP_FILE" - exit 1 -fi - -case $ENVIRONMENT in - staging) - CONTAINER="cmc-db-staging" - DB_NAME="cmc_staging" - DB_USER="cmc_staging" - ;; - production) - CONTAINER="cmc-db-production" - DB_NAME="cmc" - DB_USER="cmc" - ;; - *) - echo "ERROR: Invalid environment. Use 'staging' or 'production'" - exit 1 - ;; -esac - -echo "WARNING: This will COMPLETELY REPLACE the $ENVIRONMENT database!" -echo "Container: $CONTAINER" -echo "Database: $DB_NAME" -echo "Backup file: $BACKUP_FILE" -echo "" -read -p "Are you sure you want to continue? (yes/no): " confirm - -if [ "$confirm" != "yes" ]; then - echo "Restore cancelled." - exit 0 -fi - -echo "Creating backup of current database before restore..." -CURRENT_BACKUP="/tmp/pre_restore_backup_${ENVIRONMENT}_$(date +%Y%m%d-%H%M%S).sql.gz" -docker exec -e MYSQL_PWD="$(docker exec $CONTAINER printenv | grep MYSQL_PASSWORD | cut -d= -f2)" \ - $CONTAINER \ - mysqldump --single-transaction --routines --triggers --user=$DB_USER $DB_NAME | \ - gzip > "$CURRENT_BACKUP" -echo "Current database backed up to: $CURRENT_BACKUP" - -echo "Restoring database from: $BACKUP_FILE" - -# Drop and recreate database -docker exec -e MYSQL_PWD="$(docker exec $CONTAINER printenv | grep MYSQL_ROOT_PASSWORD | cut -d= -f2)" \ - $CONTAINER \ - mysql --user=root -e "DROP DATABASE IF EXISTS $DB_NAME; CREATE DATABASE $DB_NAME;" - -# Restore from backup -if [[ "$BACKUP_FILE" == *.gz ]]; then - gunzip < "$BACKUP_FILE" | docker exec -i -e MYSQL_PWD="$(docker exec $CONTAINER printenv | grep MYSQL_PASSWORD | cut -d= -f2)" \ - $CONTAINER \ - mysql --user=$DB_USER $DB_NAME -else - docker exec -i -e MYSQL_PWD="$(docker exec $CONTAINER printenv | grep MYSQL_PASSWORD | cut -d= -f2)" \ - $CONTAINER \ - mysql --user=$DB_USER $DB_NAME < "$BACKUP_FILE" -fi - -echo "Database restore completed successfully!" -echo "Previous database backed up to: $CURRENT_BACKUP" \ No newline at end of file diff --git a/scripts/setup-caddy-auth.sh b/scripts/setup-caddy-auth.sh deleted file mode 100755 index fa401cb8..00000000 --- a/scripts/setup-caddy-auth.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Setup Caddy basic authentication -# Usage: ./scripts/setup-caddy-auth.sh - -set -e - -echo "Setting up Caddy basic authentication..." -echo "" - -# Get username -read -p "Enter username (default: admin): " username -username=${username:-admin} - -# Get password -read -s -p "Enter password: " password -echo "" -read -s -p "Confirm password: " password_confirm -echo "" - -if [ "$password" != "$password_confirm" ]; then - echo "Passwords do not match!" - exit 1 -fi - -# Generate password hash -echo "" -echo "Generating password hash..." -hash=$(caddy hash-password --plaintext "$password") - -echo "" -echo "Authentication setup complete!" -echo "" -echo "Add this to your Caddyfile basicauth section:" -echo " $username $hash" -echo "" -echo "Example:" -echo " basicauth /* {" -echo " $username $hash" -echo " }" -echo "" -echo "You can add multiple users by adding more lines in the basicauth block." \ No newline at end of file diff --git a/scripts/setup-lego-certs.sh b/scripts/setup-lego-certs.sh deleted file mode 100755 index 022c7c29..00000000 --- a/scripts/setup-lego-certs.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Initial setup script for Lego SSL certificates -# Usage: ./scripts/setup-lego-certs.sh - -set -e - -EMAIL=${1} - -if [ -z "$EMAIL" ]; then - echo "Usage: $0 " - echo "Example: $0 admin@springupsoftware.com" - exit 1 -fi - -echo "Setting up SSL certificates for CMC Sales using Lego" -echo "Email: $EMAIL" - -# Ensure proxy is running -if ! docker ps | grep -q "cmc-lego"; then - echo "Starting proxy services..." - docker compose -f docker-compose.proxy.yml up -d - echo "Waiting for services to be ready..." - sleep 10 -fi - -# Obtain certificate for production domain -echo "" -echo "=== Obtaining certificate for production domain ===" -./scripts/lego-obtain-cert.sh cmc.springupsoftware.com "$EMAIL" - -# Obtain certificate for staging domain -echo "" -echo "=== Obtaining certificate for staging domain ===" -./scripts/lego-obtain-cert.sh staging.cmc.springupsoftware.com "$EMAIL" - -echo "" -echo "=== Certificate setup complete ===" -echo "" -echo "Certificates obtained for:" -echo " - cmc.springupsoftware.com" -echo " - staging.cmc.springupsoftware.com" -echo "" -echo "Testing HTTPS endpoints..." - -# Test the endpoints -sleep 5 -echo "Testing production HTTPS..." -curl -I https://cmc.springupsoftware.com/health || echo "Production endpoint not yet accessible" - -echo "Testing staging HTTPS..." -curl -I https://staging.cmc.springupsoftware.com/health || echo "Staging endpoint not yet accessible" - -echo "" -echo "SSL setup complete! Remember to set up auto-renewal in cron:" -echo "0 2 * * * /opt/cmc-sales/scripts/lego-renew-cert.sh all" \ No newline at end of file diff --git a/scripts/setup-staging-native.sh b/scripts/setup-staging-native.sh deleted file mode 100755 index a744a390..00000000 --- a/scripts/setup-staging-native.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -# Setup script for running staging environment natively with Caddy -# This runs PHP and Go applications directly on the host - -set -e - -if [ "$EUID" -ne 0 ]; then - echo "Please run as root (use sudo)" - exit 1 -fi - -echo "Setting up CMC Sales staging environment (native)..." - -# 1. Install dependencies -echo "Installing dependencies..." -apt update -apt install -y \ - php7.4-fpm \ - php7.4-mysql \ - php7.4-gd \ - php7.4-curl \ - php7.4-mbstring \ - php7.4-xml \ - php7.4-zip \ - mariadb-server \ - golang-go \ - git \ - supervisor - -# 2. Create directories -echo "Creating directories..." -mkdir -p /var/www/cmc-sales-staging -mkdir -p /var/log/cmc-staging -mkdir -p /var/run/cmc-staging -mkdir -p /etc/cmc-staging - -# 3. Clone or copy application -echo "Setting up application code..." -if [ -d "/home/cmc/cmc-sales" ]; then - cp -r /home/cmc/cmc-sales/* /var/www/cmc-sales-staging/ -else - echo "Please clone the repository to /home/cmc/cmc-sales first" - exit 1 -fi - -# 4. Setup PHP-FPM pool for staging -echo "Configuring PHP-FPM..." -cat > /etc/php/7.4/fpm/pool.d/staging.conf << 'EOF' -[staging] -user = www-data -group = www-data -listen = /run/php/php7.4-fpm-staging.sock -listen.owner = www-data -listen.group = caddy -listen.mode = 0660 - -pm = dynamic -pm.max_children = 10 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 -pm.max_requests = 500 - -; Environment variables -env[APP_ENV] = staging -env[DB_HOST] = localhost -env[DB_PORT] = 3307 -env[DB_NAME] = cmc_staging -env[DB_USER] = cmc_staging - -; PHP settings -php_admin_value[error_log] = /var/log/cmc-staging/php-error.log -php_admin_flag[log_errors] = on -php_admin_value[memory_limit] = 256M -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M -EOF - -# 5. Setup MariaDB for staging -echo "Configuring MariaDB..." -mysql -e "CREATE DATABASE IF NOT EXISTS cmc_staging;" -mysql -e "CREATE USER IF NOT EXISTS 'cmc_staging'@'localhost' IDENTIFIED BY '${DB_PASSWORD_STAGING:-staging_password}';" -mysql -e "GRANT ALL PRIVILEGES ON cmc_staging.* TO 'cmc_staging'@'localhost';" -mysql -e "FLUSH PRIVILEGES;" - -# 6. Setup Go application service -echo "Setting up Go application service..." -cat > /etc/systemd/system/cmc-go-staging.service << 'EOF' -[Unit] -Description=CMC Go Application - Staging -After=network.target mariadb.service - -[Service] -Type=simple -User=www-data -Group=www-data -WorkingDirectory=/var/www/cmc-sales-staging/go-app -Environment="PORT=8092" -Environment="APP_ENV=staging" -Environment="DB_HOST=localhost" -Environment="DB_PORT=3306" -Environment="DB_USER=cmc_staging" -Environment="DB_NAME=cmc_staging" -ExecStart=/usr/local/bin/cmc-go-staging -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -EOF - -# 7. Build Go application -echo "Building Go application..." -cd /var/www/cmc-sales-staging/go-app -go mod download -go build -o /usr/local/bin/cmc-go-staging cmd/server/main.go - -# 8. Set permissions -echo "Setting permissions..." -chown -R www-data:www-data /var/www/cmc-sales-staging -chmod -R 755 /var/www/cmc-sales-staging -chmod -R 777 /var/www/cmc-sales-staging/app/tmp -chmod -R 777 /var/www/cmc-sales-staging/app/webroot/pdf -chmod -R 777 /var/www/cmc-sales-staging/app/webroot/attachments_files - -# 9. Create Caddy user in www-data group -usermod -a -G www-data caddy - -# 10. Copy Caddyfile -cp /home/cmc/cmc-sales/Caddyfile.staging-native /etc/caddy/Caddyfile - -# 11. Start services -echo "Starting services..." -systemctl restart php7.4-fpm -systemctl enable cmc-go-staging -systemctl start cmc-go-staging -systemctl reload caddy - -echo "" -echo "Staging environment setup complete!" -echo "" -echo "Next steps:" -echo "1. Set database password: export DB_PASSWORD_STAGING='your_password'" -echo "2. Update /etc/caddy/Caddyfile with correct database password" -echo "3. Import database: mysql cmc_staging < backup.sql" -echo "4. Restart services: systemctl restart caddy cmc-go-staging" -echo "" -echo "Access staging at: https://staging.cmc.springupsoftware.com" \ No newline at end of file diff --git a/scripts/test-php-setup.sh b/scripts/test-php-setup.sh deleted file mode 100755 index e744f94a..00000000 --- a/scripts/test-php-setup.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -# Test script to verify PHP container setup - -echo "=== Testing PHP Container Setup ===" -echo "" - -# Test 1: Check if containers are running -echo "1. Checking container status..." -docker ps | grep -E "(cmc-php-staging|cmc-go-staging|cmc-db-staging)" || echo "No staging containers running" -echo "" - -# Test 2: Test PHP container response -echo "2. Testing PHP container (port 8091)..." -response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8091/ 2>/dev/null) -if [ "$response" = "200" ]; then - echo "✓ PHP container responding (HTTP $response)" -else - echo "✗ PHP container not responding (HTTP $response)" - echo "Checking PHP container logs..." - docker logs cmc-php-staging --tail 20 -fi -echo "" - -# Test 3: Test Go container response -echo "3. Testing Go container (port 8092)..." -response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/api/v1/health 2>/dev/null) -if [ "$response" = "200" ]; then - echo "✓ Go container responding (HTTP $response)" -else - echo "✗ Go container not responding (HTTP $response)" -fi -echo "" - -# Test 4: Check database connection -echo "4. Testing database connection..." -if docker exec cmc-db-staging mysql -u cmc_staging -pcmc_staging -e "SELECT 1;" cmc_staging &>/dev/null; then - echo "✓ Database connection working" -else - echo "✗ Database connection failed" -fi -echo "" - -# Test 5: Test CakePHP specific endpoint -echo "5. Testing CakePHP structure..." -response=$(curl -s http://localhost:8091/test_php.php 2>/dev/null | head -n 5) -if [[ $response == *"PHP"* ]]; then - echo "✓ CakePHP structure accessible" - echo "Sample response: $(echo "$response" | tr '\n' ' ' | cut -c1-100)..." -else - echo "✗ CakePHP structure issue" - # Check if we can at least get a response - curl -v http://localhost:8091/ 2>&1 | head -n 20 -fi -echo "" - -# Test 6: Check file permissions -echo "6. Checking file permissions in container..." -docker exec cmc-php-staging ls -la /var/www/cmc-sales/ | head -n 10 -echo "" - -# Test 7: Check CakePHP core files -echo "7. Checking CakePHP core files..." -if docker exec cmc-php-staging test -f /var/www/cmc-sales/cake/bootstrap.php; then - echo "✓ CakePHP core files present" -else - echo "✗ CakePHP core files missing" - docker exec cmc-php-staging find /var/www/cmc-sales -name "*.php" | head -n 10 -fi -echo "" - -echo "Test complete!" -echo "" -echo "If issues persist:" -echo "- Check logs: docker logs cmc-php-staging" -echo "- Rebuild: make restart-staging" -echo "- Check volumes: docker volume ls | grep staging" \ No newline at end of file