|
@@ 4153-4188 (lines=36) @@
|
| 4150 |
|
* |
| 4151 |
|
* @return void |
| 4152 |
|
*/ |
| 4153 |
|
public function testSaveAllAssociatedTransactionNoRollback() { |
| 4154 |
|
$testDb = ConnectionManager::getDataSource('test'); |
| 4155 |
|
|
| 4156 |
|
$db = $this->getMock('DboSource', array('connect', 'rollback', 'describe', 'create', 'update', 'begin')); |
| 4157 |
|
$db->columns = $testDb->columns; |
| 4158 |
|
|
| 4159 |
|
$db->expects($this->once())->method('rollback'); |
| 4160 |
|
$db->expects($this->any())->method('describe') |
| 4161 |
|
->will($this->returnValue(array( |
| 4162 |
|
'id' => array('type' => 'integer', 'length' => 11), |
| 4163 |
|
'title' => array('type' => 'string'), |
| 4164 |
|
'body' => array('type' => 'text'), |
| 4165 |
|
'published' => array('type' => 'string') |
| 4166 |
|
))); |
| 4167 |
|
|
| 4168 |
|
$Post = new TestPost(); |
| 4169 |
|
$Post->setDataSourceObject($db); |
| 4170 |
|
$Post->Author->setDataSourceObject($db); |
| 4171 |
|
|
| 4172 |
|
$Post->Author->validate = array( |
| 4173 |
|
'user' => array('rule' => array('notEmpty')) |
| 4174 |
|
); |
| 4175 |
|
|
| 4176 |
|
$data = array( |
| 4177 |
|
'Post' => array( |
| 4178 |
|
'title' => 'New post', |
| 4179 |
|
'body' => 'Content', |
| 4180 |
|
'published' => 'Y' |
| 4181 |
|
), |
| 4182 |
|
'Author' => array( |
| 4183 |
|
'user' => '', |
| 4184 |
|
'password' => "sekret" |
| 4185 |
|
) |
| 4186 |
|
); |
| 4187 |
|
$Post->saveAll($data, array('validate' => true)); |
| 4188 |
|
} |
| 4189 |
|
|
| 4190 |
|
/** |
| 4191 |
|
* test saveAll with nested saveAll call. |
|
@@ 5586-5621 (lines=36) @@
|
| 5583 |
|
* |
| 5584 |
|
* @return void |
| 5585 |
|
*/ |
| 5586 |
|
public function testSaveAssociatedTransactionNoRollback() { |
| 5587 |
|
$testDb = ConnectionManager::getDataSource('test'); |
| 5588 |
|
|
| 5589 |
|
$db = $this->getMock('DboSource', array('connect', 'rollback', 'describe', 'create', 'begin')); |
| 5590 |
|
$db->columns = $testDb->columns; |
| 5591 |
|
|
| 5592 |
|
$db->expects($this->once())->method('rollback'); |
| 5593 |
|
$db->expects($this->any())->method('describe') |
| 5594 |
|
->will($this->returnValue(array( |
| 5595 |
|
'id' => array('type' => 'integer', 'length' => 11), |
| 5596 |
|
'title' => array('type' => 'string'), |
| 5597 |
|
'body' => array('type' => 'text'), |
| 5598 |
|
'published' => array('type' => 'string') |
| 5599 |
|
))); |
| 5600 |
|
|
| 5601 |
|
$Post = new TestPost(); |
| 5602 |
|
$Post->setDataSourceObject($db); |
| 5603 |
|
$Post->Author->setDataSourceObject($db); |
| 5604 |
|
|
| 5605 |
|
$Post->Author->validate = array( |
| 5606 |
|
'user' => array('rule' => array('notEmpty')) |
| 5607 |
|
); |
| 5608 |
|
|
| 5609 |
|
$data = array( |
| 5610 |
|
'Post' => array( |
| 5611 |
|
'title' => 'New post', |
| 5612 |
|
'body' => 'Content', |
| 5613 |
|
'published' => 'Y' |
| 5614 |
|
), |
| 5615 |
|
'Author' => array( |
| 5616 |
|
'user' => '', |
| 5617 |
|
'password' => "sekret" |
| 5618 |
|
) |
| 5619 |
|
); |
| 5620 |
|
$Post->saveAssociated($data, array('validate' => true, 'atomic' => true)); |
| 5621 |
|
} |
| 5622 |
|
|
| 5623 |
|
/** |
| 5624 |
|
* test saveMany with nested saveMany call. |