3 * PHPUnit test case for Query
5 * The method skeletons below need to be filled in with
6 * real data so that the tests will run correctly. Replace
7 * all EXPECTED_VAL and PARAM strings with real data.
9 * Created with PHPUnit_Skeleton on 2006-11-29
11 require_once 'PHPUnit.php';
12 class QueryTest
extends PHPUnit_TestCase
{
16 function QueryTest($name)
18 $this->PHPUnit_TestCase($name);
23 require_once '../lib/database.php';
24 $this->Query
=& new Query();
25 $this->DataBase
=& new DataBase("sqlite://home/slim/waraq/test/database.db");
35 $result = $this->Query
->db(PARAM
);
36 $expected = EXPECTED_VAL
;
37 $this->assertEquals($expected, $result);
42 $addItemQuery = new Query
;
43 //$addItemQuery->insert("item")->set("p1='test'")->then("p2='test'");
45 $addItemQuery->string();
49 $p1 = $getItemQuery->db();
50 $this->assertEquals($expected, $result);
56 $result = $this->Query
->select("p1")->from("item")->where("p2='test'")->string();
57 $expected = "select p1 from item where p2='test'";
58 $this->assertEquals($expected, $result);
63 $result = $this->Query
->from(PARAM
);
64 $expected = EXPECTED_VAL
;
65 $this->assertEquals($expected, $result);
70 $result = $this->Query
->where(PARAM
);
71 $expected = EXPECTED_VAL
;
72 $this->assertEquals($expected, $result);
77 $suite = new PHPUnit_TestSuite('QueryTest');
78 $result = PHPUnit
::run($suite);
79 echo $result->toString();