dblayer : add more unit tests
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1830 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -119,6 +119,7 @@ class test_dblayer_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
"with space"=>array ("varchar", "255", "not null"));
|
||||
$db->unique = array ();
|
||||
$db->primary = "group";
|
||||
// Don't update primary key
|
||||
$res = $db->update ("gr ou\"p", array ("object"=>"%éàoppp",
|
||||
"with space"=>"WITH SPACE"));
|
||||
$this->assertSame (1, $res);
|
||||
@@ -144,4 +145,45 @@ class test_dblayer_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
"where"=>"\$'\"",
|
||||
"with space"=>"WITH SPACE")), $res);
|
||||
}
|
||||
|
||||
public function test_update2 ()
|
||||
{
|
||||
$dbconfig = $this->confs["{ENGINE}"];
|
||||
$db = new dblayer ($dbconfig["dsn"], $dbconfig["username"],
|
||||
$dbconfig["password"], $dbconfig["driver_options"]);
|
||||
$db->table = "grouped";
|
||||
$db->fields = array ("group"=>array ("varchar", "255", "not null"),
|
||||
"object"=>array ("varchar", "255", "not null"),
|
||||
"where"=>array ("varchar", "255", "not null"),
|
||||
"with space"=>array ("varchar", "255", "not null"));
|
||||
$db->unique = array (array ("group","object"));
|
||||
$db->primary = "group";
|
||||
// Update primary key
|
||||
$res = $db->update ("gr ou\"p", array ("group"=>"NEW GROUP",
|
||||
"object"=>"%éàoppp",
|
||||
"with space"=>"WITH SPACE"));
|
||||
$this->assertSame (1, $res);
|
||||
}
|
||||
|
||||
public function test_read3 ()
|
||||
{
|
||||
$dbconfig = $this->confs["{ENGINE}"];
|
||||
$db = new dblayer ($dbconfig["dsn"], $dbconfig["username"],
|
||||
$dbconfig["password"], $dbconfig["driver_options"]);
|
||||
$db->table = "grouped";
|
||||
$db->fields = array ("group"=>array ("varchar", "255", "not null"),
|
||||
"object"=>array ("varchar", "255", "not null"),
|
||||
"where"=>array ("varchar", "255", "not null"),
|
||||
"with space"=>array ("varchar", "255", "not null"));
|
||||
$db->unique = array ();
|
||||
$res = $db->read (array (array ("group", "NEW GROUP"),
|
||||
array ("object","%éàoppp"),
|
||||
array ("where","\$'\""),
|
||||
array ("with space","WITH SPACE")));
|
||||
$this->assertSame (array (0=>array ("group"=>"NEW GROUP",
|
||||
"object"=>"%éàoppp",
|
||||
"where"=>"\$'\"",
|
||||
"with space"=>"WITH SPACE")), $res);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user