Fix indentation.

This commit is contained in:
mark_story 2012-01-24 20:32:06 -05:00
parent 354716cf60
commit b8e27c7588

View file

@ -24,62 +24,62 @@ require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
*/
class ModelWriteTest extends BaseModelTest {
/**
* testInsertAnotherHabtmRecordWithSameForeignKey method
*
* @access public
* @return void
*/
public function testInsertAnotherHabtmRecordWithSameForeignKey() {
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
$TestModel = new JoinA();
/**
* testInsertAnotherHabtmRecordWithSameForeignKey method
*
* @access public
* @return void
*/
public function testInsertAnotherHabtmRecordWithSameForeignKey() {
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
$TestModel = new JoinA();
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$TestModel->JoinAsJoinB->create();
$data = array(
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 1,
'other' => 'Data for Join A 1 Join B 1',
'created' => '2008-01-03 10:56:44',
'updated' => '2008-01-03 10:56:44'
);
$result = $TestModel->JoinAsJoinB->save($data);
$lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID();
$data['id'] = $lastInsertId;
$this->assertEquals($result, array('JoinAsJoinB' => $data));
$this->assertTrue($lastInsertId != null);
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$TestModel->JoinAsJoinB->create();
$data = array(
'join_a_id' => 1,
'join_b_id' => 1,
'other' => 'Data for Join A 1 Join B 1',
'created' => '2008-01-03 10:56:44',
'updated' => '2008-01-03 10:56:44'
);
$result = $TestModel->JoinAsJoinB->save($data);
$lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID();
$data['id'] = $lastInsertId;
$this->assertEquals($result, array('JoinAsJoinB' => $data));
$this->assertTrue($lastInsertId != null);
$updatedValue = 'UPDATED Data for Join A 1 Join B 2';
$TestModel->JoinAsJoinB->id = 1;
$result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false);
$this->assertFalse(empty($result));
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$result = $TestModel->JoinAsJoinB->findById(1);
$this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue);
}
$updatedValue = 'UPDATED Data for Join A 1 Join B 2';
$TestModel->JoinAsJoinB->id = 1;
$result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false);
$this->assertFalse(empty($result));
$result = $TestModel->JoinAsJoinB->findById(1);
$this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue);
}
/**
* testSaveDateAsFirstEntry method