Skip to content

Commit

Permalink
Replace deprecated methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 8, 2013
1 parent f82b00c commit b5bd087
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 120 deletions.
22 changes: 11 additions & 11 deletions lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
Expand Up @@ -61,9 +61,9 @@ public function setUp() {
'hasAndBelongsToMany' => array('Article')
), false);

$this->User->Behaviors->attach('Containable');
$this->Article->Behaviors->attach('Containable');
$this->Tag->Behaviors->attach('Containable');
$this->User->Behaviors->load('Containable');
$this->Article->Behaviors->load('Containable');
$this->Tag->Behaviors->load('Containable');
}

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testInvalidContainments() {
* @return void
*/
public function testInvalidContainmentsNoNotices() {
$this->Article->Behaviors->attach('Containable', array('notices' => false));
$this->Article->Behaviors->load('Containable', array('notices' => false));
$this->_containments($this->Article, array('Comment', 'InvalidBinding'));
}

Expand Down Expand Up @@ -3241,7 +3241,7 @@ public function testOtherFinds() {
* @return void
*/
public function testOriginalAssociations() {
$this->Article->Comment->Behaviors->attach('Containable');
$this->Article->Comment->Behaviors->load('Containable');

$options = array(
'conditions' => array(
Expand Down Expand Up @@ -3356,9 +3356,9 @@ public function testResetAddedAssociation() {
$this->JoinB = ClassRegistry::init('JoinB');
$this->JoinC = ClassRegistry::init('JoinC');

$this->JoinA->Behaviors->attach('Containable');
$this->JoinB->Behaviors->attach('Containable');
$this->JoinC->Behaviors->attach('Containable');
$this->JoinA->Behaviors->load('Containable');
$this->JoinB->Behaviors->load('Containable');
$this->JoinC->Behaviors->load('Containable');

$this->JoinA->JoinB->find('all', array('contain' => array('JoinA')));
$this->JoinA->bindModel(array('hasOne' => array('JoinAsJoinC' => array('joinTable' => 'as_cs'))), false);
Expand All @@ -3373,9 +3373,9 @@ public function testResetAddedAssociation() {
*
*/
public function testResetAssociation() {
$this->Article->Behaviors->attach('Containable');
$this->Article->Comment->Behaviors->attach('Containable');
$this->Article->User->Behaviors->attach('Containable');
$this->Article->Behaviors->load('Containable');
$this->Article->Comment->Behaviors->load('Containable');
$this->Article->User->Behaviors->load('Containable');

$initialOptions = array(
'conditions' => array(
Expand Down
12 changes: 6 additions & 6 deletions lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
Expand Up @@ -69,13 +69,13 @@ public function testTranslateModel() {
$this->loadFixtures('TranslateTable', 'Tag', 'TranslatedItem', 'Translate', 'User', 'TranslatedArticle', 'TranslateArticle');
$TestModel = new Tag();
$TestModel->translateTable = 'another_i18n';
$TestModel->Behaviors->attach('Translate', array('title'));
$TestModel->Behaviors->load('Translate', array('title'));
$translateModel = $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEquals('I18nModel', $translateModel->name);
$this->assertEquals('another_i18n', $translateModel->useTable);

$TestModel = new User();
$TestModel->Behaviors->attach('Translate', array('title'));
$TestModel->Behaviors->load('Translate', array('title'));
$translateModel = $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEquals('I18nModel', $translateModel->name);
$this->assertEquals('i18n', $translateModel->useTable);
Expand Down Expand Up @@ -989,7 +989,7 @@ public function testAttachDetach() {
$expected = array('Title', 'Content');
$this->assertEquals($expected, $result);

$TestModel->Behaviors->detach('Translate');
$TestModel->Behaviors->unload('Translate');
$result = array_keys($TestModel->hasMany);
$expected = array();
$this->assertEquals($expected, $result);
Expand All @@ -1003,7 +1003,7 @@ public function testAttachDetach() {
$result = isset($Behavior->runtime[$TestModel->alias]);
$this->assertFalse($result);

$TestModel->Behaviors->attach('Translate', array('title' => 'Title', 'content' => 'Content'));
$TestModel->Behaviors->load('Translate', array('title' => 'Title', 'content' => 'Content'));
$result = array_keys($TestModel->hasMany);
$expected = array('Title', 'Content');
$this->assertEquals($expected, $result);
Expand Down Expand Up @@ -1185,9 +1185,9 @@ public function testUnbindTranslationInfinteLoop() {
$this->loadFixtures('Translate', 'TranslatedItem');

$TestModel = new TranslatedItem();
$TestModel->Behaviors->detach('Translate');
$TestModel->Behaviors->unload('Translate');
$TestModel->actsAs = array();
$TestModel->Behaviors->attach('Translate');
$TestModel->Behaviors->load('Translate');
$TestModel->bindTranslation(array('title', 'content'), true);
$result = $TestModel->unbindTranslation();

Expand Down
Expand Up @@ -1486,7 +1486,7 @@ public function testArraySyntax() {
public function testFindThreaded() {
$Model = new Person();
$Model->recursive = -1;
$Model->Behaviors->attach('Tree', array('parent' => 'mother_id'));
$Model->Behaviors->load('Tree', array('parent' => 'mother_id'));

$result = $Model->find('threaded');
$expected = array(
Expand Down
30 changes: 15 additions & 15 deletions lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php
Expand Up @@ -80,11 +80,11 @@ public function testStringScope() {
);
$this->assertEquals($expected, $result);

$this->Tree->Behaviors->attach('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->Tree->Behaviors->load('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->assertEquals(array(), $this->Tree->children());

$this->Tree->id = 1;
$this->Tree->Behaviors->attach('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->Tree->Behaviors->load('Tree', array('scope' => 'FlagTree.flag = 1'));

$result = $this->Tree->children();
$expected = array(array('FlagTree' => array('id' => '2', 'name' => '1.1', 'parent_id' => '1', 'lft' => '2', 'rght' => '9', 'flag' => '1')));
Expand Down Expand Up @@ -117,11 +117,11 @@ public function testArrayScope() {
);
$this->assertEquals($expected, $result);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->assertEquals(array(), $this->Tree->children());

$this->Tree->id = 1;
$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$result = $this->Tree->children();
$expected = array(array('FlagTree' => array('id' => '2', 'name' => '1.1', 'parent_id' => '1', 'lft' => '2', 'rght' => '9', 'flag' => '1')));
Expand All @@ -139,7 +139,7 @@ public function testArrayScope() {
public function testMoveUpWithScope() {
$this->Ad = new Ad();
$this->Ad->order = null;
$this->Ad->Behaviors->attach('Tree', array('scope' => 'Campaign'));
$this->Ad->Behaviors->load('Tree', array('scope' => 'Campaign'));
$this->Ad->moveUp(6);

$this->Ad->id = 4;
Expand All @@ -156,7 +156,7 @@ public function testMoveUpWithScope() {
public function testMoveDownWithScope() {
$this->Ad = new Ad();
$this->Ad->order = null;
$this->Ad->Behaviors->attach('Tree', array('scope' => 'Campaign'));
$this->Ad->Behaviors->load('Tree', array('scope' => 'Campaign'));
$this->Ad->moveDown(6);

$this->Ad->id = 4;
Expand All @@ -175,7 +175,7 @@ public function testTranslatingTree() {
$this->Tree = new FlagTree();
$this->Tree->order = null;
$this->Tree->cacheQueries = false;
$this->Tree->Behaviors->attach('Translate', array('title'));
$this->Tree->Behaviors->load('Translate', array('title'));

//Save
$this->Tree->create();
Expand Down Expand Up @@ -316,7 +316,7 @@ public function testAliasesWithScopeInTwoTreeAssociations() {
)
)
));
$this->TreeTwo->Behaviors->attach('Tree', array(
$this->TreeTwo->Behaviors->load('Tree', array(
'scope' => 'FirstTree'
));

Expand Down Expand Up @@ -358,7 +358,7 @@ public function testGenerateTreeListWithScope() {
$this->Tree->id = 2;
$this->Tree->saveField('flag', 1);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$result = $this->Tree->generateTreeList();
$expected = array(
Expand All @@ -368,7 +368,7 @@ public function testGenerateTreeListWithScope() {
$this->assertEquals($expected, $result);

// As string.
$this->Tree->Behaviors->attach('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->Tree->Behaviors->load('Tree', array('scope' => 'FlagTree.flag = 1'));

$result = $this->Tree->generateTreeList();
$this->assertEquals($expected, $result);
Expand All @@ -392,7 +392,7 @@ public function testRecoverUsingParentMode() {
$this->Tree->order = null;
$this->Tree->initialize(2, 3);

$this->Tree->Behaviors->attach('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->Tree->Behaviors->load('Tree', array('scope' => 'FlagTree.flag = 1'));
$this->Tree->Behaviors->disable('Tree');

$this->Tree->create();
Expand Down Expand Up @@ -457,7 +457,7 @@ public function testRecoverFromMissingParent() {
$this->Tree->id = 2;
$this->Tree->saveField('flag', 1);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$result = $this->Tree->findByName('1.1');
$this->Tree->updateAll(array($parentField => 999999), array('id' => $result[$modelClass]['id']));
Expand Down Expand Up @@ -488,7 +488,7 @@ public function testDetectInvalidParents() {
$this->Tree->id = 2;
$this->Tree->saveField('flag', 1);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$this->Tree->updateAll(array($parentField => null));

Expand Down Expand Up @@ -518,7 +518,7 @@ public function testDetectInvalidLftsRghts() {
$this->Tree->id = 2;
$this->Tree->saveField('flag', 1);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$this->Tree->updateAll(array($leftField => 0, $rightField => 0));

Expand Down Expand Up @@ -547,7 +547,7 @@ public function testDetectEqualLftsRghts() {
$this->Tree->id = 2;
$this->Tree->saveField('flag', 1);

$this->Tree->Behaviors->attach('Tree', array('scope' => array('FlagTree.flag' => 1)));
$this->Tree->Behaviors->load('Tree', array('scope' => array('FlagTree.flag' => 1)));

$result = $this->Tree->findByName('1.1');
$this->Tree->updateAll(array($rightField => $result[$modelClass][$leftField]), array('id' => $result[$modelClass]['id']));
Expand Down

0 comments on commit b5bd087

Please sign in to comment.