mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
66363e6bea
commit
71b7d6211b
2 changed files with 15 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue