mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Added test to prove #5482 (Trying to get property of non-object).
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7665 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
370b20dce6
commit
a628dfa028
1 changed files with 44 additions and 9 deletions
|
@ -32,8 +32,8 @@ App::import('Component', 'Cookie');
|
|||
/**
|
||||
* ControllerPost class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerPost extends CakeTestModel {
|
||||
/**
|
||||
|
@ -94,8 +94,8 @@ class ControllerPost extends CakeTestModel {
|
|||
/**
|
||||
* ControllerComment class
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerComment extends CakeTestModel {
|
||||
/**
|
||||
|
@ -127,6 +127,41 @@ class ControllerComment extends CakeTestModel {
|
|||
*/
|
||||
var $alias = 'ControllerComment';
|
||||
}
|
||||
/**
|
||||
* ControllerAlias class
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerAlias extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'ControllerAlias'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'ControllerAlias';
|
||||
/**
|
||||
* alias property
|
||||
*
|
||||
* @var string 'ControllerSomeAlias'
|
||||
* @access public
|
||||
*/
|
||||
var $alias = 'ControllerSomeAlias';
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
* @var string 'posts'
|
||||
* @access public
|
||||
*/
|
||||
var $useTable = 'posts';
|
||||
}
|
||||
/**
|
||||
* ControllerPaginateModel class
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
*/
|
||||
class ControllerPaginateModel extends CakeTestModel {
|
||||
/**
|
||||
* name property
|
||||
|
@ -248,7 +283,7 @@ class TestController extends AppController {
|
|||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array('ControllerComment');
|
||||
var $uses = array('ControllerComment', 'ControllerAlias');
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
|
@ -314,14 +349,14 @@ class ControllerTest extends CakeTestCase {
|
|||
$Controller->constructClasses();
|
||||
$this->assertTrue(is_a($Controller->ControllerPost, 'ControllerPost'));
|
||||
$this->assertTrue(is_a($Controller->ControllerComment, 'ControllerComment'));
|
||||
|
||||
|
||||
$this->assertEqual($Controller->ControllerComment->name, 'Comment');
|
||||
|
||||
unset($Controller);
|
||||
|
||||
$_back = array(
|
||||
'pluginPaths' => Configure::read('pluginPaths'),
|
||||
);
|
||||
);
|
||||
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
|
||||
|
||||
$Controller =& new Controller();
|
||||
|
@ -331,7 +366,7 @@ class ControllerTest extends CakeTestCase {
|
|||
$this->assertEqual($Controller->modelClass, 'TestPluginPost');
|
||||
$this->assertTrue(isset($Controller->TestPluginPost));
|
||||
$this->assertTrue(is_a($Controller->TestPluginPost, 'TestPluginPost'));
|
||||
|
||||
|
||||
Configure::write('pluginPaths', $_back['pluginPaths']);
|
||||
unset($Controller);
|
||||
}
|
||||
|
@ -452,7 +487,7 @@ class ControllerTest extends CakeTestCase {
|
|||
$result = $Controller->paginate('ControllerPost');
|
||||
$this->assertEqual(Set::extract($result, '{n}.ControllerPost.id'), array(2, 3));
|
||||
$this->assertEqual($Controller->ControllerPost->lastQuery['conditions'], array('ControllerPost.id > ' => '1'));
|
||||
|
||||
|
||||
$Controller =& new Controller();
|
||||
$Controller->uses = array('ControllerPaginateModel');
|
||||
$Controller->params['url'] = array();
|
||||
|
|
Loading…
Add table
Reference in a new issue