public function haveOrUpdateInDatabase($table, array $data)
{
$query = $this->driver->insertOrUpdate($table, $data);
$this->debugSection('Query', $query);
$sth = $this->driver->getDbh()->prepare($query);
if (!$sth) {
$this->fail("Query '{$query}' can't be executed.");
}
$i = 1;
foreach ($data as $val) {
$sth->bindValue($i, $val);
$i++;
}
$res = $sth->execute();
if (!$res) {
$this->fail(sprintf("Record with %s couldn't be inserted into %s", json_encode($data), $table));
}
}