Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Converting spaces to tabs.

  • Loading branch information...
commit 596c751ea35dc2edb7e3c81118c024798641fec1 1 parent 6527e92
Mark Story markstory authored
Showing with 93 additions and 91 deletions.
  1. +93 −91 cake/tests/cases/libs/model/model_write.test.php
184 cake/tests/cases/libs/model/model_write.test.php
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.