Skip to content

Commit

Permalink
Making BehaviorCollection more consistent with other object collections.
Browse files Browse the repository at this point in the history
Fixing failing tests caused by not being updated when behavior changed.
  • Loading branch information
markstory committed Nov 21, 2010
1 parent cb657b1 commit 8aabf36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cake/libs/model/behavior_collection.php
Expand Up @@ -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']);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cake/tests/cases/libs/model/model_integration.test.php
Expand Up @@ -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));
}
Expand Down

0 comments on commit 8aabf36

Please sign in to comment.