Exemplo n.º 1
0
 protected function proceedSeeInDatabase($table, $criteria)
 {
     $query = "select count(*) from `%s` where %s";
     $params = array();
     foreach ($criteria as $k => $v) {
         $params[] = "`{$k}` = ? ";
     }
     $params = implode('AND ', $params);
     $query = sprintf($query, $table, $params);
     $this->debugSection('Query', $query, $params);
     $sth = $this->driver->getDbh()->prepare($query);
     if (!$sth) {
         \PHPUnit_Framework_Assert::fail("Query '{$query}' can't be executed.");
     }
     $sth->execute(array_values($criteria));
     return $sth->fetchColumn();
 }
Exemplo n.º 2
0
 protected function proceedSeeInDatabase($table, $column, $criteria)
 {
     $query = $this->driver->select($column, $table, $criteria);
     $this->debugSection('Query', $query, json_encode($criteria));
     $sth = $this->driver->getDbh()->prepare($query);
     if (!$sth) {
         \PHPUnit_Framework_Assert::fail("Query '{$query}' can't be executed.");
     }
     $sth->execute(array_values($criteria));
     return $sth->fetchColumn();
 }