Code Duplication    Length = 23-23 lines in 2 locations

lib/Cake/Test/Case/Model/ModelWriteTest.php 2 locations

@@ 4124-4146 (lines=23) @@
4121
 *
4122
 * @return void
4123
 */
4124
	public function testSaveAllManyRowsTransactionNoRollback() {
4125
		$this->loadFixtures('Post');
4126
4127
		$db = $this->getMock('DboSource', array('begin', 'connect', 'rollback', 'describe'));
4128
4129
		$db->expects($this->once())
4130
			->method('describe')
4131
			->will($this->returnValue(array()));
4132
		$db->expects($this->once())->method('rollback');
4133
4134
		$Post = new TestPost();
4135
		$Post->setDataSourceObject($db);
4136
4137
		$Post->validate = array(
4138
			'title' => array('rule' => array('notEmpty'))
4139
		);
4140
4141
		$data = array(
4142
			array('author_id' => 1, 'title' => 'New Fourth Post'),
4143
			array('author_id' => 1, 'title' => '')
4144
		);
4145
		$Post->saveAll($data, array('atomic' => true, 'validate' => true));
4146
	}
4147
4148
/**
4149
 * test saveAll with transactions and ensure there is no missing rollback.
@@ 5557-5579 (lines=23) @@
5554
 *
5555
 * @return void
5556
 */
5557
	public function testSaveManyTransactionNoRollback() {
5558
		$this->loadFixtures('Post');
5559
5560
		$db = $this->getMock('DboSource', array('begin', 'connect', 'rollback', 'describe'));
5561
5562
		$db->expects($this->once())
5563
			->method('describe')
5564
			->will($this->returnValue(array()));
5565
		$db->expects($this->once())->method('rollback');
5566
5567
		$Post = new TestPost();
5568
		$Post->setDataSourceObject($db);
5569
5570
		$Post->validate = array(
5571
			'title' => array('rule' => array('notEmpty'))
5572
		);
5573
5574
		$data = array(
5575
			array('author_id' => 1, 'title' => 'New Fourth Post'),
5576
			array('author_id' => 1, 'title' => '')
5577
		);
5578
		$Post->saveMany($data, array('validate' => true));
5579
	}
5580
5581
/**
5582
 * test saveAssociated with transactions and ensure there is no missing rollback.