Removing =& operators for construction of objects.

This commit is contained in:
mark_story 2010-11-12 23:05:44 -05:00
parent 8c2f9e1d2b
commit 18bb5f6b8b
55 changed files with 133 additions and 133 deletions

View file

@ -94,7 +94,7 @@ class AclShell extends Shell {
if (!in_array($this->command, array('initdb'))) {
$collection = new ComponentCollection();
$this->Acl =& new AclComponent($collection);
$this->Acl = new AclComponent($collection);
$controller = null;
$this->Acl->startup($controller);
}

View file

@ -61,7 +61,7 @@ class ConsoleShell extends Shell {
foreach ($this->models as $model) {
$class = Inflector::camelize(str_replace('.php', '', $model));
$this->models[$model] = $class;
$this->{$class} =& new $class();
$this->{$class} = new $class();
}
$this->out('Model classes:');
$this->out('--------------');
@ -290,7 +290,7 @@ class ConsoleShell extends Shell {
}
break;
case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
$router =& Router::getInstance();
$router = Router::getInstance();
if (!$this->_loadRoutes()) {
$this->out("There was an error loading the routes config. Please check that the file");
$this->out("exists and is free of parse errors.");
@ -299,7 +299,7 @@ class ConsoleShell extends Shell {
$this->out("Routes configuration reloaded, " . count($router->routes) . " routes connected");
break;
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
$router =& Router::getInstance();
$router = Router::getInstance();
$this->out(implode("\n", Set::extract($router->routes, '{n}.0')));
break;
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
@ -335,7 +335,7 @@ class ConsoleShell extends Shell {
* @return boolean True if config reload was a success, otherwise false
*/
protected function _loadRoutes() {
$router =& Router::getInstance();
$router = Router::getInstance();
$router->reload();
extract($router->getNamedExpressions());

View file

@ -99,7 +99,7 @@ class SchemaShell extends Shell {
$name = $plugin;
}
}
$this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
}
/**
@ -151,7 +151,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;
@ -209,7 +209,7 @@ class SchemaShell extends Shell {
$write = $this->params['write'];
}
}
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
@ -218,9 +218,9 @@ class SchemaShell extends Shell {
$write .= '.sql';
}
if (strpos($write, DS) !== false) {
$File =& new File($write, true);
$File = new File($write, true);
} else {
$File =& new File($this->Schema->path . DS . $write, true);
$File = new File($this->Schema->path . DS . $write, true);
}
if ($File->write($contents)) {
@ -280,7 +280,7 @@ class SchemaShell extends Shell {
$options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
}
$Schema =& $this->Schema->load($options);
$Schema = $this->Schema->load($options);
if (!$Schema) {
$this->err(sprintf(__('%s could not be loaded'), $this->Schema->path . DS . $this->Schema->file));
@ -300,7 +300,7 @@ class SchemaShell extends Shell {
* @access private
*/
function __create(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$drop = $create = array();
@ -343,7 +343,7 @@ class SchemaShell extends Shell {
* @access private
*/
function __update(&$Schema, $table = null) {
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
$this->out(__('Comparing Database to Schema...'));
$options = array();
@ -390,7 +390,7 @@ class SchemaShell extends Shell {
return;
}
Configure::write('debug', 2);
$db =& ConnectionManager::getDataSource($this->Schema->connection);
$db = ConnectionManager::getDataSource($this->Schema->connection);
foreach ($contents as $table => $sql) {
if (empty($sql)) {

View file

@ -278,7 +278,7 @@ class ControllerTask extends BakeTask {
$this->_stop();
}
$modelObj =& ClassRegistry::init($currentModelName);
$modelObj = ClassRegistry::init($currentModelName);
$controllerPath = $this->_controllerPath($controllerName);
$pluralName = $this->_pluralName($currentModelName);
$singularName = Inflector::variable($currentModelName);

View file

@ -394,12 +394,12 @@ class FixtureTask extends BakeTask {
$condition = 'WHERE 1=1 LIMIT ' . (isset($this->params['count']) ? $this->params['count'] : 10);
}
App::import('Model', 'Model', false);
$modelObject =& new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
$modelObject = new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
$records = $modelObject->find('all', array(
'conditions' => $condition,
'recursive' => -1
));
$db =& ConnectionManager::getDataSource($modelObject->useDbConfig);
$db = ConnectionManager::getDataSource($modelObject->useDbConfig);
$schema = $modelObject->schema(true);
$out = array();
foreach ($records as $record) {

View file

@ -131,7 +131,7 @@ class ModelTask extends BakeTask {
if (!$table) {
$table = Inflector::tableize($className);
}
$object =& new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
$object = new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
return $object;
}
@ -180,7 +180,7 @@ class ModelTask extends BakeTask {
}
$currentModelName = $this->getName();
$useTable = $this->getTable($currentModelName);
$db =& ConnectionManager::getDataSource($this->connection);
$db = ConnectionManager::getDataSource($this->connection);
$fullTableName = $db->fullTableName($useTable);
if (in_array($useTable, $this->_tables)) {
@ -793,7 +793,7 @@ class ModelTask extends BakeTask {
}
App::import('Model', 'ConnectionManager', false);
$db =& ConnectionManager::getDataSource($useDbConfig);
$db = ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;
@ -823,7 +823,7 @@ class ModelTask extends BakeTask {
App::import('Model', 'ConnectionManager', false);
$tables = array();
$db =& ConnectionManager::getDataSource($useDbConfig);
$db = ConnectionManager::getDataSource($useDbConfig);
$db->cacheSources = false;
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];
if ($usePrefix) {

View file

@ -104,7 +104,7 @@ class PluginTask extends Shell {
$looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y') {
$Folder =& new Folder($this->path . $pluginPath);
$Folder = new Folder($this->path . $pluginPath);
$directories = array(
'config' . DS . 'schema',
'models' . DS . 'behaviors',
@ -127,7 +127,7 @@ class PluginTask extends Shell {
foreach ($directories as $directory) {
$dirPath = $this->path . $pluginPath . DS . $directory;
$Folder->create($dirPath);
$File =& new File($dirPath . DS . 'empty', true);
$File = new File($dirPath . DS . 'empty', true);
}
foreach ($Folder->messages() as $message) {

View file

@ -59,7 +59,7 @@ class TemplateTask extends Shell {
$separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core);
$paths[] = $core;
$Folder =& new Folder($core . 'templates' . DS . 'default');
$Folder = new Folder($core . 'templates' . DS . 'default');
$contents = $Folder->read();
$themeFolders = $contents[0];
@ -76,14 +76,14 @@ class TemplateTask extends Shell {
$themes = array();
foreach ($paths as $path) {
$Folder =& new Folder($path . 'templates', false);
$Folder = new Folder($path . 'templates', false);
$contents = $Folder->read();
$subDirs = $contents[0];
foreach ($subDirs as $dir) {
if (empty($dir) || preg_match('@^skel$|_skel$@', $dir)) {
continue;
}
$Folder =& new Folder($path . 'templates' . DS . $dir);
$Folder = new Folder($path . 'templates' . DS . $dir);
$contents = $Folder->read();
$subDirs = $contents[0];
if (array_intersect($contents[0], $themeFolders)) {

View file

@ -115,7 +115,7 @@ class TestTask extends BakeTask {
public function bake($type, $className) {
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
$this->out(__('Bake is detecting possible fixtures..'));
$testSubject =& $this->buildTestSubject($type, $className);
$testSubject = $this->buildTestSubject($type, $className);
$this->generateFixtureList($testSubject);
} elseif ($this->interactive) {
$this->getUserFixtures();
@ -228,9 +228,9 @@ class TestTask extends BakeTask {
App::import($type, $class);
$class = $this->getRealClassName($type, $class);
if (strtolower($type) == 'model') {
$instance =& ClassRegistry::init($class);
$instance = ClassRegistry::init($class);
} else {
$instance =& new $class();
$instance = new $class();
}
return $instance;
}

View file

@ -282,11 +282,11 @@ class ViewTask extends BakeTask {
$this->_stop();
}
$controllerClassName = $this->controllerName . 'Controller';
$controllerObj =& new $controllerClassName();
$controllerObj = new $controllerClassName();
$controllerObj->plugin = $this->plugin;
$controllerObj->constructClasses();
$modelClass = $controllerObj->modelClass;
$modelObj =& $controllerObj->{$controllerObj->modelClass};
$modelObj = $controllerObj->{$controllerObj->modelClass};
if ($modelObj) {
$primaryKey = $modelObj->primaryKey;

View file

@ -39,7 +39,7 @@ class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
<?php endif; ?>
public function startTest() {
$this-><?php echo $className . ' =& ' . $construction; ?>
$this-><?php echo $className . ' = ' . $construction; ?>
}
public function endTest() {

View file

@ -78,7 +78,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) {
list($host, $port) = $this->_parseServerString($server);
if ($this->__Memcache->addServer($host, $port)) {

View file

@ -280,8 +280,8 @@ class DbAcl extends Object implements AclInterface {
* @return void
*/
public function initialize($component) {
$component->Aro =& $this->Aro;
$component->Aco =& $this->Aco;
$component->Aro = $this->Aro;
$component->Aco = $this->Aco;
}
/**

View file

@ -322,7 +322,7 @@ class AuthComponent extends Component {
if (!$this->__setDefaults()) {
return false;
}
$request =& $controller->request;
$request = $controller->request;
$this->request->data = $controller->request->data = $this->hashPasswords($request->data);
$url = '';

View file

@ -627,7 +627,7 @@ class Controller extends Object {
if ($this->persistModel === true) {
$this->_persist($modelClass, true, $this->{$modelClass});
$registry =& ClassRegistry::getInstance();
$registry = ClassRegistry::getInstance();
$this->_persist($modelClass . 'registry', true, $registry->__objects, 'registry');
}
} else {

View file

@ -93,7 +93,7 @@ class File {
* @access private
*/
function __construct($path, $create = false, $mode = 0755) {
$this->Folder =& new Folder(dirname($path), $create, $mode);
$this->Folder = new Folder(dirname($path), $create, $mode);
if (!is_dir($path)) {
$this->name = basename($path);
}

View file

@ -146,12 +146,12 @@ class HttpSocket extends CakeSocket {
* You can use a url string to set the url and use default configurations for
* all other options:
*
* `$http =& new HttpSockect('http://cakephp.org/');`
* `$http = new HttpSockect('http://cakephp.org/');`
*
* Or use an array to configure multiple options:
*
* {{{
* $http =& new HttpSocket(array(
* $http = new HttpSocket(array(
* 'host' => 'cakephp.org',
* 'timeout' => 20
* ));

View file

@ -53,7 +53,7 @@ class MagicDb extends Object {
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;
}
@ -155,7 +155,7 @@ class MagicDb extends Object {
}
$matches = array();
$MagicFileResource =& new MagicFileResource($file);
$MagicFileResource = new MagicFileResource($file);
foreach ($this->db['database'] as $format) {
$magic = $format[0];
$match = $MagicFileResource->test($magic);
@ -201,7 +201,7 @@ class MagicFileResource extends Object{
*/
public function __construct($file) {
if (file_exists($file)) {
$this->resource =& new File($file);
$this->resource = new File($file);
} else {
$this->resource = $file;
}

View file

@ -121,7 +121,7 @@ class ContainableBehavior extends ModelBehavior {
$mandatory = array();
foreach ($containments['models'] as $name => $model) {
$instance =& $model['instance'];
$instance = $model['instance'];
$needed = $this->fieldDependencies($instance, $map, false);
if (!empty($needed)) {
$mandatory = array_merge($mandatory, $needed);
@ -431,7 +431,7 @@ class ContainableBehavior extends ModelBehavior {
public function containmentsMap($containments) {
$map = array();
foreach ($containments['models'] as $name => $model) {
$instance =& $model['instance'];
$instance = $model['instance'];
foreach ($this->types as $type) {
foreach ($instance->{$type} as $assoc => $options) {
if (isset($model['keep'][$assoc])) {

View file

@ -52,7 +52,7 @@ class TranslateBehavior extends ModelBehavior {
* @return mixed
*/
public function setup(&$model, $config = array()) {
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$db = ConnectionManager::getDataSource($model->useDbConfig);
if (!$db->connected) {
trigger_error(
sprintf(__('Datasource %s for TranslateBehavior of model %s is not connected'), $model->useDbConfig, $model->alias),
@ -91,8 +91,8 @@ class TranslateBehavior extends ModelBehavior {
if (empty($locale)) {
return $query;
}
$db =& ConnectionManager::getDataSource($model->useDbConfig);
$RuntimeModel =& $this->translateModel($model);
$db = ConnectionManager::getDataSource($model->useDbConfig);
$RuntimeModel = $this->translateModel($model);
if (!empty($RuntimeModel->tablePrefix)) {
$tablePrefix = $RuntimeModel->tablePrefix;
} else {

View file

@ -612,7 +612,7 @@ class DboSource extends DataSource {
if (PHP_SAPI != 'cli') {
App::import('Core', 'View');
$controller = null;
$View =& new View($controller, false);
$View = new View($controller, false);
$View->set('logs', array($this->configKeyName => $log));
echo $View->element('sql_dump', array('_forced_from_dbo_' => true));
} else {

View file

@ -223,7 +223,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 . '\';

View file

@ -119,7 +119,7 @@ class ShellTest extends CakeTestCase {
$output = $this->getMock('ConsoleOutput', array(), array(), '', false);
$error = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Shell =& new TestShell($output, $error, $in);
$this->Shell = new TestShell($output, $error, $in);
}
/**

View file

@ -220,7 +220,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->startup();
$this->Shell->dump();
$this->file =& new File(TMP . 'tests' . DS . 'i18n.sql');
$this->file = new File(TMP . 'tests' . DS . 'i18n.sql');
$contents = $this->file->read();
$this->assertPattern('/DROP TABLE/', $contents);
$this->assertPattern('/CREATE TABLE `i18n`/', $contents);
@ -250,7 +250,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->expects($this->once())->method('_stop');
$this->Shell->dump();
$this->file =& new File(TMP . 'tests' . DS . 'dump_test.sql');
$this->file = new File(TMP . 'tests' . DS . 'dump_test.sql');
$contents = $this->file->read();
$this->assertPattern('/CREATE TABLE `test_plugin_acos`/', $contents);

View file

@ -479,7 +479,7 @@ class TestTaskTest extends CakeTestCase {
$this->assertContains('function redirect($url, $status = null, $exit = true)', $result);
$this->assertContains('function startTest()', $result);
$this->assertContains("\$this->TestTaskComments =& new TestTestTaskCommentsController()", $result);
$this->assertContains("\$this->TestTaskComments = new TestTestTaskCommentsController()", $result);
$this->assertContains("\$this->TestTaskComments->constructClasses()", $result);
$this->assertContains('function endTest()', $result);

View file

@ -280,12 +280,12 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
function testClearWithPrefixes() {
$FileOne =& new FileEngine();
$FileOne = new FileEngine();
$FileOne->init(array(
'prefix' => 'prefix_one_',
'duration' => DAY
));
$FileTwo =& new FileEngine();
$FileTwo = new FileEngine();
$FileTwo->init(array(
'prefix' => 'prefix_two_',
'duration' => DAY

View file

@ -101,7 +101,7 @@ class MemcacheEngineTest extends CakeTestCase {
function testMultipleServers() {
$servers = array('127.0.0.1:11211', '127.0.0.1:11222');
$available = true;
$Memcache =& new Memcache();
$Memcache = new Memcache();
foreach($servers as $server) {
list($host, $port) = explode(':', $server);
@ -113,7 +113,7 @@ class MemcacheEngineTest extends CakeTestCase {
if ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) {
return;
}
$Memcache =& new MemcacheEngine();
$Memcache = new MemcacheEngine();
$Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));
$servers = array_keys($Memcache->__Memcache->getExtendedStats());
@ -129,7 +129,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
function testConnect() {
$Memcache =& new MemcacheEngine();
$Memcache = new MemcacheEngine();
$Memcache->init(Cache::settings('memcache'));
$result = $Memcache->connect('127.0.0.1');
$this->assertTrue($result);
@ -141,7 +141,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
function testConnectIpv6() {
$Memcache =& new MemcacheEngine();
$Memcache = new MemcacheEngine();
$result = $Memcache->init(array(
'prefix' => 'cake_',
'duration' => 200,
@ -159,7 +159,7 @@ class MemcacheEngineTest extends CakeTestCase {
* @return void
*/
function testParseServerStringNonLatin() {
$Memcache =& new TestMemcacheEngine();
$Memcache = new TestMemcacheEngine();
$result = $Memcache->parseServerString('schülervz.net:13211');
$this->assertEqual($result, array('schülervz.net', '13211'));

View file

@ -967,7 +967,7 @@ class CakeRequestTestCase extends CakeTestCase {
* @return void
*/
public function testEnvironmentDetection() {
$dispatcher =& new Dispatcher();
$dispatcher = new Dispatcher();
$environments = array(
'IIS' => array(

View file

@ -406,7 +406,7 @@ class ComponentTest extends CakeTestCase {
return;
}
$Controller =& new ComponentTestController();
$Controller = new ComponentTestController();
$Controller->uses = false;
$Controller->components = array('Session');
$Controller->constructClasses();

View file

@ -363,7 +363,7 @@ TEMPDOC;
return;
}
$connection =& new CakeSocket(array('protocol'=>'smtp', 'host' => 'localhost', 'port' => 25));
$connection = new CakeSocket(array('protocol'=>'smtp', 'host' => 'localhost', 'port' => 25));
$this->Controller->EmailTest->setConnectionSocket($connection);
$this->Controller->EmailTest->smtpOptions['timeout'] = 10;
$this->assertTrue($connection->connect());

View file

@ -757,7 +757,7 @@ class ControllerTest extends CakeTestCase {
* @access public
*/
function testPaginateFieldsDouble(){
$Controller =& new Controller();
$Controller = new Controller();
$Controller->uses = array('ControllerPost');
$Controller->request->params['url'] = array();
$Controller->constructClasses();
@ -1042,7 +1042,7 @@ class ControllerTest extends CakeTestCase {
$core[0]
)
), true);
$Controller =& new Controller($this->getMock('CakeRequest'));
$Controller = new Controller($this->getMock('CakeRequest'));
$Controller->uses = array();
$Controller->components = array('Test');
$Controller->constructClasses();
@ -1406,7 +1406,7 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
function testValidateErrorsOnArbitraryModels() {
$TestController =& new TestController();
$TestController = new TestController();
$Post = new ControllerPost();
$Post->validate = array('title' => 'notEmpty');

View file

@ -145,7 +145,7 @@ class ControllerMergeVarsTest extends CakeTestCase {
function testComponentParamMergingNoDuplication() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), "APP_CONTROLLER_EXISTS cannot run {$this->name}");
$Controller =& new MergeVariablesController();
$Controller = new MergeVariablesController();
$Controller->constructClasses();
$expected = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false));
@ -160,7 +160,7 @@ class ControllerMergeVarsTest extends CakeTestCase {
function testComponentMergingWithRedeclarations() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), "APP_CONTROLLER_EXISTS cannot run {$this->name}");
$Controller =& new MergeVariablesController();
$Controller = new MergeVariablesController();
$Controller->components['MergeVar'] = array('remote', 'redirect' => true);
$Controller->constructClasses();
@ -176,7 +176,7 @@ class ControllerMergeVarsTest extends CakeTestCase {
function testHelperSettingMergingNoDuplication() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), "APP_CONTROLLER_EXISTS cannot run {$this->name}");
$Controller =& new MergeVariablesController();
$Controller = new MergeVariablesController();
$Controller->constructClasses();
$expected = array('MergeVar' => array('format' => 'html', 'terse'));
@ -191,7 +191,7 @@ class ControllerMergeVarsTest extends CakeTestCase {
function testMergeVarsWithPlugin() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), "APP_CONTROLLER_EXISTS cannot run {$this->name}");
$Controller =& new MergePostsController();
$Controller = new MergePostsController();
$Controller->components = array('Email' => array('ports' => 'open'));
$Controller->plugin = 'MergeVarPlugin';
$Controller->constructClasses();
@ -209,7 +209,7 @@ class ControllerMergeVarsTest 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();

View file

@ -784,7 +784,7 @@ class ScaffoldTest extends CakeTestCase {
$this->Controller->theme = 'test_theme';
$this->Controller->view = 'Theme';
$this->Controller->constructClasses();
$Scaffold =& new TestScaffoldMock($this->Controller, $this->Controller->request);
$Scaffold = new TestScaffoldMock($this->Controller, $this->Controller->request);
$this->assertEqual($this->Controller->view, 'Scaffold');
}

View file

@ -126,7 +126,7 @@ class FileTest extends CakeTestCase {
*/
function testRead() {
$file = __FILE__;
$this->File =& new File($file);
$this->File = new File($file);
$result = $this->File->read();
$expecting = file_get_contents(__FILE__);

View file

@ -34,7 +34,7 @@ class L10nTest extends CakeTestCase {
* @return void
*/
function testGet() {
$l10n =& new L10n();
$l10n = new L10n();
// Catalog Entry
$l10n->get('en');
@ -90,7 +90,7 @@ class L10nTest extends CakeTestCase {
$__SERVER = $_SERVER;
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
$l10n =& new L10n();
$l10n = new L10n();
$l10n->get();
$this->assertEqual($l10n->language, 'English (Canadian)');
@ -121,7 +121,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');
@ -451,7 +451,7 @@ class L10nTest extends CakeTestCase {
* @return void
*/
function testCatalog() {
$l10n =& new L10n();
$l10n = new L10n();
$result = $l10n->catalog(array('af'));
$expected = array(

View file

@ -35,7 +35,7 @@ class FileLogTest extends CakeTestCase {
*/
function testLogFileWriting() {
@unlink(LOGS . 'error.log');
$log =& new FileLog();
$log = new FileLog();
$log->write('warning', 'Test warning');
$this->assertTrue(file_exists(LOGS . 'error.log'));
@ -69,7 +69,7 @@ class FileLogTest extends CakeTestCase {
$path = TMP . 'tests' . DS;
@unlink($path . 'error.log');
$log =& new FileLog(compact('path'));
$log = new FileLog(compact('path'));
$log->write('warning', 'Test warning');
$this->assertTrue(file_exists($path . 'error.log'));
unlink($path . 'error.log');

View file

@ -39,7 +39,7 @@ class MagicDbTest extends UnitTestCase {
*
*/
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.

View file

@ -3189,7 +3189,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();

View file

@ -614,7 +614,7 @@ class CakeSchemaTest extends CakeTestCase {
function testSchemaReadWithTablePrefix() {
$model =& new SchemaPrefixAuthUser();
$Schema =& new CakeSchema();
$Schema = new CakeSchema();
$read = $Schema->read(array(
'connection' => 'test',
'name' => 'TestApp',
@ -650,7 +650,7 @@ class CakeSchemaTest extends CakeTestCase {
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
$Schema =& new CakeSchema();
$Schema = new CakeSchema();
$Schema->plugin = 'TestPlugin';
$read = $Schema->read(array(
'connection' => 'test',
@ -832,13 +832,13 @@ class CakeSchemaTest extends CakeTestCase {
* @return void
*/
function testCompareEmptyStringAndNull() {
$One =& new CakeSchema(array(
$One = new CakeSchema(array(
'posts' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => '')
)
));
$Two =& new CakeSchema(array(
$Two = new CakeSchema(array(
'posts' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'name' => array('type' => 'string', 'null' => false, 'default' => null)
@ -984,7 +984,7 @@ class CakeSchemaTest extends CakeTestCase {
$db =& ConnectionManager::getDataSource('test');
$db->cacheSources = false;
$Schema =& new CakeSchema(array(
$Schema = new CakeSchema(array(
'connection' => 'test',
'testdescribes' => array(
'id' => array('type' => 'integer', 'key' => 'primary'),

View file

@ -696,7 +696,7 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testAlteringTwoTables() {
$schema1 =& new CakeSchema(array(
$schema1 = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(
@ -708,7 +708,7 @@ class DboMysqlTest extends CakeTestCase {
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
)
));
$schema2 =& new CakeSchema(array(
$schema2 = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(
@ -792,7 +792,7 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testVirtualFieldSeparators() {
$model =& new CakeTestModel(array('table' => 'binary_tests', 'ds' => 'test', 'name' => 'BinaryTest'));
$model = new CakeTestModel(array('table' => 'binary_tests', 'ds' => 'test', 'name' => 'BinaryTest'));
$model->virtualFields = array(
'other__field' => 'SUM(id)'
);
@ -809,7 +809,7 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testDescribeGettingFieldParameters() {
$schema =& new CakeSchema(array(
$schema = new CakeSchema(array(
'connection' => 'test',
'testdescribes' => array(
'id' => array('type' => 'integer', 'key' => 'primary'),
@ -829,7 +829,7 @@ class DboMysqlTest extends CakeTestCase {
));
$this->db->execute($this->db->createSchema($schema));
$model =& new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
$result = $this->db->describe($model);
$this->assertEqual($result['stringy']['collate'], 'cp1250_general_ci');
$this->assertEqual($result['stringy']['charset'], 'cp1250');

View file

@ -295,7 +295,7 @@ class DboMysqliTest extends CakeTestCase {
* @return void
*/
function testFloatParsing() {
$model =& new Model(array('ds' => 'test', 'table' => 'datatypes', 'name' => 'Datatype'));
$model = new Model(array('ds' => 'test', 'table' => 'datatypes', 'name' => 'Datatype'));
$result = $this->Dbo->describe($model);
$this->assertEqual((string)$result['float_field']['length'], '5,2');
}

View file

@ -105,7 +105,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';

View file

@ -807,7 +807,7 @@ class DboPostgresTest extends CakeTestCase {
*/
function testUpdateAllWithNonQualifiedConditions() {
$this->loadFixtures('Article');
$Article =& new Article();
$Article = new Article();
$result = $Article->updateAll(array('title' => "'Awesome'"), array('title' => 'Third Article'));
$this->assertTrue($result);
@ -823,7 +823,7 @@ class DboPostgresTest extends CakeTestCase {
* @return void
*/
function testAlteringTwoTables() {
$schema1 =& new CakeSchema(array(
$schema1 = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(
@ -835,7 +835,7 @@ class DboPostgresTest extends CakeTestCase {
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
)
));
$schema2 =& new CakeSchema(array(
$schema2 = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(

View file

@ -2048,7 +2048,7 @@ class DboSourceTest extends CakeTestCase {
* @return void
*/
function testGenerateAssociationQueryHasManyAndAggregateFunction() {
$this->Model =& new TestModel5();
$this->Model = new TestModel5();
$this->Model->schema();
$this->_buildRelatedModels($this->Model);
@ -4478,7 +4478,7 @@ class DboSourceTest extends CakeTestCase {
* @return void
*/
function testFieldsWithComplexVirtualFields() {
$Article =& new Article();
$Article = new Article();
$Article->virtualFields = array(
'distance' => 'ACOS(SIN(20 * PI() / 180)
* SIN(Article.latitude * PI() / 180)
@ -4505,7 +4505,7 @@ class DboSourceTest extends CakeTestCase {
* @return void
*/
function testReadVirtualFieldsWithNewLines() {
$Article =& new Article();
$Article = new Article();
$Article->recursive = 1;
$Article->virtualFields = array(
'test' => '

View file

@ -239,10 +239,10 @@ class TestDbAcl 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();
}
}
@ -280,7 +280,7 @@ class AclNodeTest extends CakeTestCase {
* @return void
*/
function testNode() {
$Aco =& new DbAcoTest();
$Aco = new DbAcoTest();
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
$expected = array(2, 1);
$this->assertEqual($result, $expected);
@ -321,7 +321,7 @@ class AclNodeTest extends CakeTestCase {
* @return void
*/
function testNodeWithDuplicatePathSegments() {
$Aco =& new DbAcoTest();
$Aco = new DbAcoTest();
$nodes = $Aco->node('ROOT/Users');
$this->assertEqual($nodes[0]['DbAcoTest']['parent_id'], 1, 'Parent id does not point at ROOT. %s');
}

View file

@ -718,7 +718,7 @@ class ModelDeleteTest extends BaseModelTest {
function testBeforeDeleteWipingTable() {
$this->loadFixtures('Comment');
$Comment =& new BeforeDeleteComment();
$Comment = new BeforeDeleteComment();
// Delete 3 records.
$Comment->delete(4);
$result = $Comment->find('count');
@ -746,7 +746,7 @@ class ModelDeleteTest extends BaseModelTest {
function testBeforeDeleteWipingTableWithDuplicateDelete() {
$this->loadFixtures('Comment');
$Comment =& new BeforeDeleteComment();
$Comment = new BeforeDeleteComment();
$Comment->delete(1);
$result = $Comment->find('count');

View file

@ -4744,7 +4744,7 @@ class ModelReadTest extends BaseModelTest {
*/
function testBindModelMultipleTimesResetCorrectly() {
$this->loadFixtures('User', 'Comment', 'Article');
$TestModel =& new User();
$TestModel = new User();
$TestModel->bindModel(array('hasMany' => array('Comment')));
$TestModel->bindModel(array('hasMany' => array('Comment')));
@ -4761,7 +4761,7 @@ class ModelReadTest extends BaseModelTest {
*/
function testBindMultipleTimesWithDifferentResetSettings() {
$this->loadFixtures('User', 'Comment', 'Article');
$TestModel =& new User();
$TestModel = new User();
$result = $TestModel->hasMany;
$expected = array();
@ -4815,7 +4815,7 @@ class ModelReadTest extends BaseModelTest {
*/
function testUnbindMultipleTimesResetCorrectly() {
$this->loadFixtures('User', 'Comment', 'Article');
$TestModel =& new Article10();
$TestModel = new Article10();
$TestModel->unbindModel(array('hasMany' => array('Comment')));
$TestModel->unbindModel(array('hasMany' => array('Comment')));
@ -4832,7 +4832,7 @@ class ModelReadTest extends BaseModelTest {
*/
function testUnBindMultipleTimesWithDifferentResetSettings() {
$this->loadFixtures('User', 'Comment', 'Article');
$TestModel =& new Comment();
$TestModel = new Comment();
$result = array_keys($TestModel->belongsTo);
$expected = array('Article', 'User');
@ -6526,7 +6526,7 @@ class ModelReadTest extends BaseModelTest {
);
$this->assertEqual($result, $expected);
$TestModel =& new Article();
$TestModel = new Article();
$TestModel->displayField = 'title';
$result = $TestModel->find('list', array(
'conditions' => array('User.user' => 'mariano'),

View file

@ -36,7 +36,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void
*/
function testValidationParams() {
$TestModel =& new ValidationTest1();
$TestModel = new ValidationTest1();
$TestModel->validate['title'] = array(
'rule' => 'customValidatorWithParams',
'required' => true
@ -128,7 +128,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void
*/
function testInvalidFieldsWithFieldListParams() {
$TestModel =& new ValidationTest1();
$TestModel = new ValidationTest1();
$TestModel->validate = $validate = array(
'title' => array(
'rule' => 'customValidator',
@ -174,7 +174,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void
*/
function testInvalidFieldsWhitelist() {
$TestModel =& new ValidationTest1();
$TestModel = new ValidationTest1();
$TestModel->validate = $validate = array(
'title' => array(
'rule' => 'customValidator',
@ -199,7 +199,7 @@ class ModelValidationTest extends BaseModelTest {
* @return void
*/
function testValidates() {
$TestModel =& new TestValidate();
$TestModel = new TestValidate();
$TestModel->validate = array(
'user_id' => 'numeric',
@ -565,7 +565,7 @@ class ModelValidationTest extends BaseModelTest {
)
);
$Something =& new Something();
$Something = new Something();
$JoinThing =& $Something->JoinThing;
$JoinThing->validate = array('doomed' => array('rule' => 'notEmpty'));
@ -618,7 +618,7 @@ class ModelValidationTest extends BaseModelTest {
array('something_else_id' => 1, 'doomed' => '')
)
);
$Something =& new Something();
$Something = new Something();
$JoinThing =& $Something->JoinThing;
$JoinThing->validate = array('doomed' => array('rule' => 'notEmpty'));
@ -652,7 +652,7 @@ class ModelValidationTest extends BaseModelTest {
function testMissingValidationErrorTriggering() {
Configure::write('debug', 2);
$TestModel =& new ValidationTest1();
$TestModel = new ValidationTest1();
$TestModel->create(array('title' => 'foo'));
$TestModel->validate = array(
'title' => array(
@ -671,7 +671,7 @@ class ModelValidationTest extends BaseModelTest {
*/
function testMissingValidationErrorNoTriggering() {
Configure::write('debug', 0);
$TestModel =& new ValidationTest1();
$TestModel = new ValidationTest1();
$TestModel->create(array('title' => 'foo'));
$TestModel->validate = array(
'title' => array(

View file

@ -2171,7 +2171,7 @@ class ModelWriteTest extends BaseModelTest {
*/
function testUpdateSavingBlankValues() {
$this->loadFixtures('Article');
$Article =& new Article();
$Article = new Article();
$Article->validate = array();
$Article->create();
$result = $Article->save(array(
@ -3037,7 +3037,7 @@ class ModelWriteTest extends BaseModelTest {
'published' => array('type' => 'string')
)));
$Post =& new Post();
$Post = new Post();
$Post->useDbConfig = 'mock_transaction_assoc';
$Post->Author->useDbConfig = 'mock_transaction_assoc';
@ -3589,7 +3589,7 @@ class ModelWriteTest extends BaseModelTest {
* @return void
*/
function testSaveAllValidateFirstAtomicFalse() {
$Something =& new Something();
$Something = new Something();
$invalidData = array(
array(
'title' => 'foo',
@ -3620,7 +3620,7 @@ class ModelWriteTest extends BaseModelTest {
$expected = array(true, false);
$this->assertEqual($result, $expected);
$Something =& new Something();
$Something = new Something();
$validData = array(
array(
'title' => 'title value',

View file

@ -447,7 +447,7 @@ class ObjectTest extends CakeTestCase {
@unlink(CACHE . 'persistent' . DS . 'testmodel.php');
$model =& new ObjectTestModel();
$model = new ObjectTestModel();
$expected = ClassRegistry::keys();
ClassRegistry::flush();

View file

@ -399,7 +399,7 @@ class CakeRouteTestCase extends CakeTestCase {
* @return void
*/
function testPatternOnAction() {
$route =& new CakeRoute(
$route = new CakeRoute(
'/blog/:action/*',
array('controller' => 'blog_posts'),
array('action' => 'other|actions')

View file

@ -481,7 +481,7 @@ HTML;
$this->fixtureManager->load($this);
$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',
@ -500,7 +500,7 @@ HTML;
$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',

View file

@ -601,7 +601,7 @@ class HtmlHelperTest extends CakeTestCase {
App::import('Core', 'File');
$testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js';
$file =& new File($testfile, true);
$file = new File($testfile, true);
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)

View file

@ -806,7 +806,7 @@ class ViewTest extends CakeTestCase {
*/
function testRenderStrippingNoCacheTagsOnlyCacheHelper() {
Configure::write('Cache.check', false);
$View =& new View($this->PostsController);
$View = new View($this->PostsController);
$View->set(array('superman' => 'clark', 'variable' => 'var'));
$View->helpers = array('Html', 'Form', 'Cache');
$View->layout = 'cache_layout';
@ -821,7 +821,7 @@ class ViewTest extends CakeTestCase {
*/
function testRenderStrippingNoCacheTagsOnlyCacheCheck() {
Configure::write('Cache.check', true);
$View =& new View($this->PostsController);
$View = new View($this->PostsController);
$View->set(array('superman' => 'clark', 'variable' => 'var'));
$View->helpers = array('Html', 'Form');
$View->layout = 'cache_layout';

View file

@ -29,7 +29,7 @@
<?php
App::import('Core', 'View');
$null = null;
$View =& new View($null, false);
$View = new View($null, false);
echo $View->element('sql_dump');
?>
</div>