diff --git a/cake/libs/model/behavior_collection.php b/cake/libs/model/behavior_collection.php index 9820d568b78..3ce783c7629 100644 --- a/cake/libs/model/behavior_collection.php +++ b/cake/libs/model/behavior_collection.php @@ -64,8 +64,8 @@ function init($modelName, $behaviors = array()) { $this->modelName = $modelName; if (!empty($behaviors)) { - foreach (Set::normalize($behaviors) as $behavior => $config) { - $this->load($behavior, $config); + foreach (BehaviorCollection::normalizeObjectArray($behaviors) as $behavior => $config) { + $this->load($config['class'], $config['settings']); } } } diff --git a/cake/tests/cases/libs/model/model_integration.test.php b/cake/tests/cases/libs/model/model_integration.test.php index 5790ec344c6..b3d78af1ad3 100644 --- a/cake/tests/cases/libs/model/model_integration.test.php +++ b/cake/tests/cases/libs/model/model_integration.test.php @@ -1309,12 +1309,12 @@ function testConstruct() { $this->loadFixtures('Post'); $TestModel = ClassRegistry::init('MergeVarPluginPost'); - $this->assertEqual($TestModel->actsAs, array('Containable', 'Tree')); + $this->assertEqual($TestModel->actsAs, array('Containable' => null, 'Tree' => null)); $this->assertTrue(isset($TestModel->Behaviors->Containable)); $this->assertTrue(isset($TestModel->Behaviors->Tree)); $TestModel = ClassRegistry::init('MergeVarPluginComment'); - $expected = array('Containable', 'Containable' => array('some_settings')); + $expected = array('Containable' => array('some_settings')); $this->assertEqual($TestModel->actsAs, $expected); $this->assertTrue(isset($TestModel->Behaviors->Containable)); }