mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-12 20:49:50 +00:00
Merge branch 'local/svn/1.2.x.x' into 1.2
This commit is contained in:
commit
40ff8370e4
8 changed files with 41 additions and 37 deletions
|
@ -947,17 +947,17 @@ class Controller extends Object {
|
|||
}
|
||||
|
||||
if ($assoc && isset($this->{$object}->{$assoc})) {
|
||||
$object = $this->{$object}->{$assoc};
|
||||
$object =& $this->{$object}->{$assoc};
|
||||
} elseif ($assoc && isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$assoc})) {
|
||||
$object = $this->{$this->modelClass}->{$assoc};
|
||||
$object =& $this->{$this->modelClass}->{$assoc};
|
||||
} elseif (isset($this->{$object})) {
|
||||
$object = $this->{$object};
|
||||
$object =& $this->{$object};
|
||||
} elseif (isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$object})) {
|
||||
$object = $this->{$this->modelClass}->{$object};
|
||||
$object =& $this->{$this->modelClass}->{$object};
|
||||
}
|
||||
} elseif (empty($object) || $object === null) {
|
||||
if (isset($this->{$this->modelClass})) {
|
||||
$object = $this->{$this->modelClass};
|
||||
$object =& $this->{$this->modelClass};
|
||||
} else {
|
||||
$className = null;
|
||||
$name = $this->uses[0];
|
||||
|
@ -965,9 +965,9 @@ class Controller extends Object {
|
|||
list($name, $className) = explode('.', $this->uses[0]);
|
||||
}
|
||||
if ($className) {
|
||||
$object = $this->{$className};
|
||||
$object =& $this->{$className};
|
||||
} else {
|
||||
$object = $this->{$name};
|
||||
$object =& $this->{$name};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class Scaffold extends Object {
|
|||
$associations = $this->__associations();
|
||||
|
||||
$this->controller->set(compact('modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||
'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations'));
|
||||
|
||||
if ($this->controller->view && $this->controller->view !== 'Theme') {
|
||||
$this->controller->view = 'scaffold';
|
||||
|
@ -378,7 +378,7 @@ class Scaffold extends Object {
|
|||
* @access private
|
||||
*/
|
||||
function __scaffold($params) {
|
||||
$db = &ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
|
||||
$db =& ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
|
||||
$admin = Configure::read('Routing.admin');
|
||||
|
||||
if (isset($db)) {
|
||||
|
|
|
@ -86,7 +86,7 @@ class AclShellTest extends CakeTestCase {
|
|||
function startTest() {
|
||||
$this->Dispatcher =& new TestAclShellMockShellDispatcher();
|
||||
$this->Task =& new MockAclShell($this->Dispatcher);
|
||||
$this->Task->Dispatch = new $this->Dispatcher;
|
||||
$this->Task->Dispatch =& $this->Dispatcher;
|
||||
$this->Task->params['datasource'] = 'test_suite';
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class ApiShellTest extends CakeTestCase {
|
|||
function startTest() {
|
||||
$this->Dispatcher =& new ApiShellMockShellDispatcher();
|
||||
$this->Shell =& new MockApiShell($this->Dispatcher);
|
||||
$this->Shell->Dispatch = new $this->Dispatcher;
|
||||
$this->Shell->Dispatch =& $this->Dispatcher;
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
|
@ -107,7 +107,7 @@ class ApiShellTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
$this->Shell->expectAt(1, 'out', $expected);
|
||||
|
||||
|
||||
$this->Shell->args = array('controller');
|
||||
$this->Shell->paths['controller'] = CAKE_CORE_INCLUDE_PATH . DS . LIBS . 'controller' . DS;
|
||||
$this->Shell->main();
|
||||
|
|
|
@ -37,10 +37,9 @@ if (!class_exists('ShellDispatcher')) {
|
|||
ob_end_clean();
|
||||
}
|
||||
|
||||
Mock::generatePartial(
|
||||
'ShellDispatcher', 'TestShellMockShellDispatcher',
|
||||
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
||||
);
|
||||
Mock::generatePartial('ShellDispatcher', 'TestShellMockShellDispatcher', array(
|
||||
'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment'
|
||||
));
|
||||
/**
|
||||
* TestShell class
|
||||
*
|
||||
|
@ -48,6 +47,13 @@ Mock::generatePartial(
|
|||
* @subpackage cake.tests.cases.console.libs
|
||||
*/
|
||||
class TestShell extends Shell {
|
||||
/**
|
||||
* Fixtures used in this test case
|
||||
*
|
||||
* @var name
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'TestShell';
|
||||
}
|
||||
/**
|
||||
* TestAppleTask class
|
||||
|
|
|
@ -65,7 +65,7 @@ class TestTaskTest extends CakeTestCase {
|
|||
function setUp() {
|
||||
$this->Dispatcher =& new TestTestTaskMockShellDispatcher();
|
||||
$this->Task =& new MockTestTask($this->Dispatcher);
|
||||
$this->Task->Dispatch = new $this->Dispatcher;
|
||||
$this->Task->Dispatch =& $this->Dispatcher;
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
|
|
|
@ -228,21 +228,21 @@ class ScaffoldViewTest extends CakeTestCase {
|
|||
*/
|
||||
var $fixtures = array('core.article', 'core.user', 'core.comment');
|
||||
/**
|
||||
* setUp method
|
||||
* startTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
function startTest() {
|
||||
$this->Controller =& new ScaffoldMockController();
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
* endTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
function endTest() {
|
||||
unset($this->Controller);
|
||||
}
|
||||
/**
|
||||
|
@ -452,7 +452,6 @@ class ScaffoldViewTest extends CakeTestCase {
|
|||
$this->assertPattern('/textarea name="data\[ScaffoldMock\]\[body\]" cols="30" rows="6" id="ScaffoldMockBody"/', $result);
|
||||
$this->assertPattern('/<li><a href="\/scaffold_mock\/delete\/1"[^>]*>Delete<\/a>\s*<\/li>/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Admin Index Scaffolding.
|
||||
*
|
||||
|
@ -562,21 +561,21 @@ class ScaffoldTest extends CakeTestCase {
|
|||
*/
|
||||
var $fixtures = array('core.article', 'core.user', 'core.comment');
|
||||
/**
|
||||
* setUp method
|
||||
* startTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
function startTest() {
|
||||
$this->Controller =& new ScaffoldMockController();
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
* endTest method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function tearDown() {
|
||||
function endTest() {
|
||||
unset($this->Controller);
|
||||
}
|
||||
/**
|
||||
|
@ -611,7 +610,6 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$result = $Scaffold->getParams();
|
||||
$this->assertEqual($result['action'], 'admin_edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the proper names and variable values are set by Scaffold
|
||||
*
|
||||
|
@ -639,7 +637,7 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$this->Controller->base = '/';
|
||||
$this->Controller->constructClasses();
|
||||
$Scaffold =& new TestScaffoldMock($this->Controller, $params);
|
||||
$result = $this->Controller->viewVars;
|
||||
$result = $Scaffold->controller->viewVars;
|
||||
|
||||
$this->assertEqual($result['singularHumanName'], 'Scaffold Mock');
|
||||
$this->assertEqual($result['pluralHumanName'], 'Scaffold Mock');
|
||||
|
|
|
@ -257,7 +257,7 @@ class TestBehavior extends ModelBehavior {
|
|||
}
|
||||
echo "onError trigger success";
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* beforeTest method
|
||||
*
|
||||
* @param mixed $model
|
||||
|
@ -265,8 +265,8 @@ class TestBehavior extends ModelBehavior {
|
|||
* @return void
|
||||
*/
|
||||
function beforeTest(&$model) {
|
||||
$model->beforeTestResult[] = get_class($this);
|
||||
return get_class($this);
|
||||
$model->beforeTestResult[] = strtolower(get_class($this));
|
||||
return strtolower(get_class($this));
|
||||
}
|
||||
/**
|
||||
* testMethod method
|
||||
|
@ -983,24 +983,24 @@ 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');
|
||||
|
||||
$Apple->beforeTestResult = array();
|
||||
$Apple->Behaviors->trigger($Apple, 'beforeTest');
|
||||
$expected = array('TestBehavior', 'Test2Behavior', 'Test3Behavior');
|
||||
$expected = array('testbehavior', 'test2behavior', 'test3behavior');
|
||||
$this->assertIdentical($Apple->beforeTestResult, $expected);
|
||||
|
||||
$Apple->beforeTestResult = array();
|
||||
$Apple->Behaviors->trigger($Apple, 'beforeTest', array(), array('break' => true, 'breakOn' => 'Test2Behavior'));
|
||||
$expected = array('TestBehavior', 'Test2Behavior');
|
||||
$Apple->Behaviors->trigger($Apple, 'beforeTest', array(), array('break' => true, 'breakOn' => 'test2behavior'));
|
||||
$expected = array('testbehavior', 'test2behavior');
|
||||
$this->assertIdentical($Apple->beforeTestResult, $expected);
|
||||
|
||||
$Apple->beforeTestResult = array();
|
||||
$Apple->Behaviors->trigger($Apple, 'beforeTest', array(), array('break' => true, 'breakOn' => array('Test2Behavior', 'Test3Behavior')));
|
||||
$expected = array('TestBehavior', 'Test2Behavior');
|
||||
$Apple->Behaviors->trigger($Apple, 'beforeTest', array(), array('break' => true, 'breakOn' => array('test2behavior', 'test3behavior')));
|
||||
$expected = array('testbehavior', 'test2behavior');
|
||||
$this->assertIdentical($Apple->beforeTestResult, $expected);
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue