From 71b7d6211bb9660bc34423bace5146f76cf2427d Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 19 Nov 2016 22:30:18 -0400 Subject: [PATCH] Fix AclNode constructor. It should forward the settings from ClassRegistry::init() so that aliases can be customized as needed. Refs #9766 --- lib/Cake/Model/AclNode.php | 4 ++-- lib/Cake/Test/Case/Utility/ClassRegistryTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/AclNode.php b/lib/Cake/Model/AclNode.php index 1080b9a22..4d62dea87 100644 --- a/lib/Cake/Model/AclNode.php +++ b/lib/Cake/Model/AclNode.php @@ -40,12 +40,12 @@ class AclNode extends Model { /** * Constructor */ - public function __construct() { + public function __construct($id = false, $table = null, $ds = null) { $config = Configure::read('Acl.database'); if (isset($config)) { $this->useDbConfig = $config; } - parent::__construct(); + parent::__construct($id, $table, $ds); } /** diff --git a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php index d6d70774f..fc3fdb18b 100644 --- a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php +++ b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php @@ -200,6 +200,19 @@ class ClassRegistryTest extends CakeTestCase { $this->assertSame('RegisterArticleTag', $newTag->name); } +/** + * Test that init() can make the Aco models with alias set properly + * + * @return void + */ + public function testAddModelWithAliasAco() + { + $aco = ClassRegistry::init(array('class' => 'Aco', 'alias' => 'CustomAco')); + $this->assertInstanceOf('Aco', $aco); + $this->assertSame('Aco', $aco->name); + $this->assertSame('CustomAco', $aco->alias); + } + /** * testClassRegistryFlush method *