Fix truncate table

This commit is contained in:
Marcos Zuriaga 2016-10-11 02:06:04 +02:00
parent 1f30ccc963
commit efd27ee1ae
No known key found for this signature in database
GPG key ID: 7D15585354D072FF

View file

@ -53,6 +53,14 @@ abstract class DatabaseHelperTest extends PHPUnit_Extensions_Database_TestCase {
}
}
/**
* Truncates a table, platform aware
* @param $table_name
*/
public function truncateTable($table_name) {
$this->db->executeQuery($this->db->getDatabasePlatform()->getTruncateTableSQL($table_name));
}
/**
* Initializes the table with the corresponding dataset on the dumps dir
*
@ -62,7 +70,7 @@ abstract class DatabaseHelperTest extends PHPUnit_Extensions_Database_TestCase {
$table = $this->getTableDataset($table_name);
// Cleanup any data currently inside the table
$this->db->executeQuery("TRUNCATE $table_name;");
$this->truncateTable($table_name);
// Fill the table with the data dumps
for ($i = 0; $i < $table->getRowCount(); $i++) {