mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Proving that ClassRegistry will not overwrite alias from associations. Closes #5482 as invalid.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7670 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
6ad3cfa0ef
commit
0a0ba598e5
1 changed files with 38 additions and 4 deletions
|
@ -67,10 +67,10 @@ class RegisterArticleFeatured extends ClassRegisterModel {
|
|||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'RegisterArticlFeatured'
|
||||
* @var string 'RegisterArticleFeatured'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'RegisterArticlFeatured';
|
||||
var $name = 'RegisterArticleFeatured';
|
||||
}
|
||||
/**
|
||||
* RegisterArticleTag class
|
||||
|
@ -82,10 +82,10 @@ class RegisterArticleTag extends ClassRegisterModel {
|
|||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'RegisterArticlTag'
|
||||
* @var string 'RegisterArticleTag'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'RegisterArticlTag';
|
||||
var $name = 'RegisterArticleTag';
|
||||
}
|
||||
/**
|
||||
* RegistryPluginAppModel class
|
||||
|
@ -117,6 +117,21 @@ class TestRegistryPluginModel extends RegistryPluginAppModel {
|
|||
*/
|
||||
var $name = 'TestRegistryPluginModel';
|
||||
}
|
||||
/**
|
||||
* RegisterCategory class
|
||||
*
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
*/
|
||||
class RegisterCategory extends ClassRegisterModel {
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string 'RegisterCategory'
|
||||
* @access public
|
||||
*/
|
||||
var $name = 'RegisterCategory';
|
||||
}
|
||||
/**
|
||||
* ClassRegistryTest class
|
||||
*
|
||||
|
@ -191,6 +206,25 @@ class ClassRegistryTest extends CakeTestCase {
|
|||
}
|
||||
$this->assertTrue(is_a($UserCopy, 'AppModel'));
|
||||
$this->assertIdentical($User, $UserCopy);
|
||||
|
||||
if (PHP5) {
|
||||
$Category = ClassRegistry::init(array('class' => 'RegisterCategory'));
|
||||
} else {
|
||||
$Category =& ClassRegistry::init(array('class' => 'RegisterCategory'));
|
||||
}
|
||||
$this->assertTrue(is_a($Category, 'RegisterCategory'));
|
||||
|
||||
if (PHP5) {
|
||||
$ParentCategory = ClassRegistry::init(array('class' => 'RegisterCategory', 'alias' => 'ParentCategory'));
|
||||
} else {
|
||||
$ParentCategory =& ClassRegistry::init(array('class' => 'RegisterCategory', 'alias' => 'ParentCategory'));
|
||||
}
|
||||
$this->assertTrue(is_a($ParentCategory, 'RegisterCategory'));
|
||||
$this->assertNotIdentical($Category, $ParentCategory);
|
||||
|
||||
$this->assertNotEqual($Category->alias, $ParentCategory->alias);
|
||||
$this->assertEqual('RegisterCategory', $Category->alias);
|
||||
$this->assertEqual('ParentCategory', $ParentCategory->alias);
|
||||
}
|
||||
/**
|
||||
* testClassRegistryFlush method
|
||||
|
|
Loading…
Reference in a new issue