mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fix indentation.
This commit is contained in:
parent
354716cf60
commit
b8e27c7588
1 changed files with 51 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue