Skip to content

Commit

Permalink
Fix AclNode constructor.
Browse files Browse the repository at this point in the history
It should forward the settings from ClassRegistry::init() so that
aliases can be customized as needed.

Refs #9766
  • Loading branch information
markstory committed Nov 20, 2016
1 parent 66363e6 commit 71b7d62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/AclNode.php
Expand Up @@ -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);
}

/**
Expand Down
13 changes: 13 additions & 0 deletions lib/Cake/Test/Case/Utility/ClassRegistryTest.php
Expand Up @@ -200,6 +200,19 @@ public function testAddModelWithAlias()
$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
*
Expand Down

0 comments on commit 71b7d62

Please sign in to comment.