Merge pull request #9782 from cakephp/acl-constructor

Fix AclNode constructor.
This commit is contained in:
Mark Story 2016-11-24 16:56:02 -05:00 committed by GitHub
commit 2e30cf7b89
2 changed files with 20 additions and 4 deletions

View file

@ -39,13 +39,18 @@ class AclNode extends Model {
/**
* Constructor
*
* @param bool|int|string|array $id Set this ID for this model on startup,
* can also be an array of options, see above.
* @param string $table Name of database table to use.
* @param string $ds DataSource connection name.
*/
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

@ -187,8 +187,7 @@ class ClassRegistryTest extends CakeTestCase {
*
* @return void
*/
public function testAddModelWithAlias()
{
public function testAddModelWithAlias() {
$tag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
$this->assertInstanceOf('RegisterArticleTag', $tag);
$this->assertSame('NewTag', $tag->alias);
@ -200,6 +199,18 @@ 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
*