From 596c751ea35dc2edb7e3c81118c024798641fec1 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 28 Jul 2010 23:42:36 -0400 Subject: [PATCH] Converting spaces to tabs. --- .../cases/libs/model/model_write.test.php | 184 +++++++++--------- 1 file changed, 93 insertions(+), 91 deletions(-) diff --git a/cake/tests/cases/libs/model/model_write.test.php b/cake/tests/cases/libs/model/model_write.test.php index 8d3564dc53f..9c01485d50f 100644 --- a/cake/tests/cases/libs/model/model_write.test.php +++ b/cake/tests/cases/libs/model/model_write.test.php @@ -3689,6 +3689,7 @@ function testSaveAllHasManyValidationOnly() { ); $this->assertEqual($TestModel->Comment->validationErrors, $expected); } + /** * TestFindAllWithoutForeignKey * @@ -3702,57 +3703,58 @@ function testFindAllForeignKey() { $conditions = array('Group.name' => 'group one'); - $ProductUpdateAll->bindModel(array( + $ProductUpdateAll->bindModel(array( 'belongsTo' => array( 'Group' => array('className' => 'GroupUpdateAll') ) )); - $ProductUpdateAll->belongsTo = array( + $ProductUpdateAll->belongsTo = array( 'Group' => array('className' => 'GroupUpdateAll', 'foreignKey' => 'group_id') ); - $results = $ProductUpdateAll->find('all', compact('conditions')); + $results = $ProductUpdateAll->find('all', compact('conditions')); $this->assertTrue(!empty($results)); - $ProductUpdateAll->bindModel(array('belongsTo'=>array('Group'))); - $ProductUpdateAll->belongsTo = array( - 'Group' => array( + $ProductUpdateAll->bindModel(array('belongsTo'=>array('Group'))); + $ProductUpdateAll->belongsTo = array( + 'Group' => array( 'className' => 'GroupUpdateAll', 'foreignKey' => false, 'conditions' => 'ProductUpdateAll.groupcode = Group.code' )); - $resultsFkFalse = $ProductUpdateAll->find('all', compact('conditions')); - $this->assertTrue(!empty($resultsFkFalse)); - $expected = array( - '0' => array( - 'ProductUpdateAll' => array( - 'id' => 1, - 'name' => 'product one', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120) - ), - '1' => array( - 'ProductUpdateAll' => array( - 'id' => 2, - 'name' => 'product two', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120) - ) - - ); - $this->assertEqual($results, $expected); - $this->assertEqual($resultsFkFalse, $expected); - } + $resultsFkFalse = $ProductUpdateAll->find('all', compact('conditions')); + $this->assertTrue(!empty($resultsFkFalse)); + $expected = array( + '0' => array( + 'ProductUpdateAll' => array( + 'id' => 1, + 'name' => 'product one', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120) + ), + '1' => array( + 'ProductUpdateAll' => array( + 'id' => 2, + 'name' => 'product two', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120) + ) + + ); + $this->assertEqual($results, $expected); + $this->assertEqual($resultsFkFalse, $expected); + } + /** * testProductUpdateAllWithForeignKey * @@ -3760,7 +3762,7 @@ function testFindAllForeignKey() { * @access public * @return void */ - function testProductUpdateAll() { + function testProductUpdateAll() { $this->skipIf( $this->db->config['driver'] == 'postgres', '%s Currently, there is no way of doing joins in an update statement in postgresql' @@ -3770,39 +3772,39 @@ function testProductUpdateAll() { $conditions = array('Group.name' => 'group one'); - $ProductUpdateAll->bindModel(array('belongsTo' => array( + $ProductUpdateAll->bindModel(array('belongsTo' => array( 'Group' => array('className' => 'GroupUpdateAll'))) ); - $ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions); - $results = $ProductUpdateAll->find('all', array( + $ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions); + $results = $ProductUpdateAll->find('all', array( 'conditions' => array('ProductUpdateAll.name' => 'new product') )); - $expected = array( - '0' => array( - 'ProductUpdateAll' => array( - 'id' => 1, - 'name' => 'new product', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120) - ), - '1' => array( - 'ProductUpdateAll' => array( - 'id' => 2, - 'name' => 'new product', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120))); - - $this->assertEqual($results, $expected); - } + $expected = array( + '0' => array( + 'ProductUpdateAll' => array( + 'id' => 1, + 'name' => 'new product', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120) + ), + '1' => array( + 'ProductUpdateAll' => array( + 'id' => 2, + 'name' => 'new product', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120))); + + $this->assertEqual($results, $expected); + } /** * testProductUpdateAllWithoutForeignKey @@ -3833,32 +3835,32 @@ function testProductUpdateAllWithoutForeignKey() { ) ); - $ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions); - $resultsFkFalse = $ProductUpdateAll->find('all', array('conditions' => array('ProductUpdateAll.name'=>'new product'))); - $expected = array( - '0' => array( - 'ProductUpdateAll' => array( - 'id' => 1, - 'name' => 'new product', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120) - ), - '1' => array( - 'ProductUpdateAll' => array( - 'id' => 2, - 'name' => 'new product', - 'groupcode' => 120, - 'group_id' => 1), - 'Group' => array( - 'id' => 1, - 'name' => 'group one', - 'code' => 120))); - $this->assertEqual($resultsFkFalse, $expected); - } + $ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions); + $resultsFkFalse = $ProductUpdateAll->find('all', array('conditions' => array('ProductUpdateAll.name'=>'new product'))); + $expected = array( + '0' => array( + 'ProductUpdateAll' => array( + 'id' => 1, + 'name' => 'new product', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120) + ), + '1' => array( + 'ProductUpdateAll' => array( + 'id' => 2, + 'name' => 'new product', + 'groupcode' => 120, + 'group_id' => 1), + 'Group' => array( + 'id' => 1, + 'name' => 'group one', + 'code' => 120))); + $this->assertEqual($resultsFkFalse, $expected); + } /** * test that saveAll behaves like plain save() when suplied empty data