diff --git a/Tests/dblayerComplet.php b/Tests/dblayerComplet.php index af277d0..8a1436a 100644 --- a/Tests/dblayerComplet.php +++ b/Tests/dblayerComplet.php @@ -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); + } + }