Fix AclNode constructor.

It should forward the settings from ClassRegistry::init() so that
aliases can be customized as needed.

Refs #9766
This commit is contained in:
mark_story 2016-11-19 22:30:18 -04:00
parent 66363e6bea
commit 71b7d6211b
2 changed files with 15 additions and 2 deletions

View file

@ -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);
}
/**

View file

@ -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
*