Fix get-where tests

This commit is contained in:
Timothy Warren 2012-03-09 12:52:35 -05:00
parent 6b6660585c
commit c61df13fbc
4 changed files with 30 additions and 4 deletions

View File

@ -137,6 +137,8 @@ class Query_Builder {
// Quote the identifiers // Quote the identifiers
$safe_array = array_map(array($this->db, 'quote_ident'), $fields_array); $safe_array = array_map(array($this->db, 'quote_ident'), $fields_array);
unset($fields_array);
// Join the strings back together // Join the strings back together
for($i = 0, $c = count($safe_array); $i < $c; $i++) for($i = 0, $c = count($safe_array); $i < $c; $i++)
@ -149,7 +151,7 @@ class Query_Builder {
$this->select_string = implode(', ', $safe_array); $this->select_string = implode(', ', $safe_array);
//echo $this->select_string."<br />"; unset($safe_array);
return $this; return $this;
} }
@ -207,8 +209,10 @@ class Query_Builder {
// Create the where portion of the string // Create the where portion of the string
$this->where_string = ' WHERE '.implode(', ', $kv_array); $this->where_string = ' WHERE '.implode(', ', $kv_array);
unset($kv_array);
unset($fields);
// @todo Implement where method
return $this; return $this;
} }

View File

@ -154,6 +154,21 @@ class FirebirdTest extends UnitTestCase {
$this->assertTrue(is_resource($query)); $this->assertTrue(is_resource($query));
} }
function TestQBSelectWhereGet()
{
$query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test', 2, 1);
$this->assertTrue(is_resource($query));
}
function TestQBSelectWhereGet2()
{
$query = $this->qb->select('id, key as k, val')->where(' id ', 1)->get('create_test', 2, 1);
$this->assertTrue(is_resource($query));
}
function TestQBSelectGet() function TestQBSelectGet()
{ {
$query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1); $query = $this->qb->select('id, key as k, val')->get('create_test', 2, 1);

View File

@ -154,7 +154,14 @@ SQL;
function TestQBSelectWhereGet() function TestQBSelectWhereGet()
{ {
$query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test, 2, 1'); $query = $this->qb->select('id, key as k, val')->where('id >', 1)->get('create_test', 2, 1);
$this->assertIsA($query, 'PDOStatement');
}
function TestQBSelectWhereGet2()
{
$query = $this->qb->select('id, key as k, val')->where('id', 1)->get('create_test', 2, 1);
$this->assertIsA($query, 'PDOStatement'); $this->assertIsA($query, 'PDOStatement');
} }
@ -179,7 +186,7 @@ SQL;
//Check //Check
$dbs = $this->db->get_tables(); $dbs = $this->db->get_tables();
$this->assertTrue(empty($dbs['create_test'])); $this->assertFalse(in_array('create_test', $dbs));
} }
} }

Binary file not shown.