Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarcos Zuriaga <wolfi@wolfi.es>2016-10-15 02:42:14 +0300
committerMarcos Zuriaga <wolfi@wolfi.es>2016-10-15 02:42:14 +0300
commit4086f222125262ee47bcca0fd1857a45b20fb41f (patch)
tree69035925657aece229522a65e6add30b36d73df1 /tests
parent0779d79ccab9949e35920937023d283bd9c16849 (diff)
Refactored helper to use nextcloud query builder
hoping this fixes the test problems with pgsql
Diffstat (limited to 'tests')
-rw-r--r--tests/db/DatabaseHelperTest.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/db/DatabaseHelperTest.php b/tests/db/DatabaseHelperTest.php
index 0b208728..ab1ee8d7 100644
--- a/tests/db/DatabaseHelperTest.php
+++ b/tests/db/DatabaseHelperTest.php
@@ -68,6 +68,7 @@ abstract class DatabaseHelperTest extends PHPUnit_Extensions_Database_TestCase {
*/
public function setUpTable($table_name){
$table = $this->getTableDataset($table_name);
+ $table_no_prefix = substr($table_name, 3);
// Cleanup any data currently inside the table
$this->truncateTable($table_name);
@@ -76,19 +77,14 @@ abstract class DatabaseHelperTest extends PHPUnit_Extensions_Database_TestCase {
for ($i = 0; $i < $table->getRowCount(); $i++) {
$row = $table->getRow($i);
- $fields = "";
- $values = "";
+ $qb = $this->db->getQueryBuilder();
+ $qb->insert($table_no_prefix);
+
foreach ($row as $key => $value){
- $fields .= "`{$key}`, ";
- $values .= is_numeric($value) ? $value : ("'{$value}'") ;
- $values .= ", ";
+ $qb->setValue($key, is_numeric($value) ? $value : ("'{$value}'"));
}
- $fields = substr($fields, 0, count($fields) -3);
- $values = substr($values, 0, count($values) -3);
-
- $q = "INSERT INTO $table_name ({$fields}) VALUES ({$values});";
- $this->db->executeQuery($q);
+ $qb->execute();
}
}