Skip to content

Commit

Permalink
Adding a few transactions to speed up a little tests involving fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Nov 17, 2010
1 parent 1326707 commit c0f1043
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cake/libs/model/datasources/dbo_source.php
Expand Up @@ -2687,11 +2687,12 @@ public function insertMulti($table, $fields, $values) {
$count = count($values);
$sql = "INSERT INTO {$table} ({$fields}) VALUES ({$holder})";
$statement = $this->_connection->prepare($sql);
$this->begin();
for ($x = 0; $x < $count; $x++) {
$statement->execute($values[$x]);
$statement->closeCursor();
}
return true;
return $this->commit();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions cake/tests/lib/cake_fixture_manager.php
Expand Up @@ -206,13 +206,15 @@ public function load(CakeTestCase $test) {
return;
}

$test->db->begin();
foreach ($fixtures as $f) {
if (!empty($this->_loaded[$f])) {
$fixture = $this->_loaded[$f];
$this->_setupTable($fixture, $test->db, $test->dropTables);
$fixture->insert($test->db);
}
}
$test->db->commit();
}

/**
Expand Down

0 comments on commit c0f1043

Please sign in to comment.