mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-17 06:59:51 +00:00
Add tests for #9766
I'm not able to reproduce incorrect aliases coming out of ClassRegistry. As reported.
This commit is contained in:
parent
93e29e91ef
commit
66363e6bea
1 changed files with 19 additions and 1 deletions
|
@ -147,7 +147,7 @@ class ClassRegistryTest extends CakeTestCase {
|
||||||
$this->assertSame($Tag, $TagCopy);
|
$this->assertSame($Tag, $TagCopy);
|
||||||
|
|
||||||
$NewTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
$NewTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
||||||
$this->assertInstanceOf('RegisterArticleTag', $Tag);
|
$this->assertInstanceOf('RegisterArticleTag', $NewTag);
|
||||||
|
|
||||||
$NewTagCopy = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
$NewTagCopy = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
||||||
|
|
||||||
|
@ -182,6 +182,24 @@ class ClassRegistryTest extends CakeTestCase {
|
||||||
$this->assertEquals('ParentCategory', $ParentCategory->alias);
|
$this->assertEquals('ParentCategory', $ParentCategory->alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that init() can make models with alias set properly
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testAddModelWithAlias()
|
||||||
|
{
|
||||||
|
$tag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
||||||
|
$this->assertInstanceOf('RegisterArticleTag', $tag);
|
||||||
|
$this->assertSame('NewTag', $tag->alias);
|
||||||
|
$this->assertSame('RegisterArticleTag', $tag->name);
|
||||||
|
|
||||||
|
$newTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'OtherTag'));
|
||||||
|
$this->assertInstanceOf('RegisterArticleTag', $tag);
|
||||||
|
$this->assertSame('OtherTag', $newTag->alias);
|
||||||
|
$this->assertSame('RegisterArticleTag', $newTag->name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testClassRegistryFlush method
|
* testClassRegistryFlush method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue