diff options
author | wei <> | 2007-04-12 08:05:03 +0000 |
---|---|---|
committer | wei <> | 2007-04-12 08:05:03 +0000 |
commit | dc3bf922d9715bfd1b2105be04a9aabc84a1d7d4 (patch) | |
tree | ff97362f718b6ebb482128527402efe03fe1ac43 /tests/simple_unit/TableGateway/DeleteByPkTest.php | |
parent | 6178a99df0c722581bc61e35559ac5f8af1cc6e8 (diff) |
Refactor and add TTableGateway, System.Data.Common, System.Data.DataGateway
Diffstat (limited to 'tests/simple_unit/TableGateway/DeleteByPkTest.php')
-rw-r--r-- | tests/simple_unit/TableGateway/DeleteByPkTest.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/simple_unit/TableGateway/DeleteByPkTest.php b/tests/simple_unit/TableGateway/DeleteByPkTest.php new file mode 100644 index 00000000..120b63e9 --- /dev/null +++ b/tests/simple_unit/TableGateway/DeleteByPkTest.php @@ -0,0 +1,52 @@ +<?php +
+require_once(dirname(__FILE__).'/BaseGatewayTest.php');
+
+class DeleteByPkTest extends BaseGatewayTest
+{
+ function test_delete_by_1_pk()
+ {
+ $this->add_record1();
+ $id = $this->getGateway()->getLastInsertId();
+ $deleted = $this->getGateway()->deleteByPk($id);
+
+ $this->assertEqual(1, $deleted);
+ }
+
+ function test_delete_by_multiple_pk()
+ {
+ $this->add_record1();
+ $id1 = $this->getGateway()->getLastInsertId();
+ $this->add_record2();
+ $id2 = $this->getGateway()->getLastInsertId();
+
+ $deleted = $this->getGateway()->deleteByPk($id1, $id2);
+
+ $this->assertEqual(2, $deleted);
+ }
+
+ function test_delete_by_multiple_pk2()
+ {
+ $this->add_record1();
+ $id1 = $this->getGateway()->getLastInsertId();
+ $this->add_record2();
+ $id2 = $this->getGateway()->getLastInsertId();
+
+ $deleted = $this->getGateway()->deleteByPk(array($id1, $id2));
+
+ $this->assertEqual(2, $deleted);
+ }
+
+ function test_delete_by_multiple_pk3()
+ {
+ $this->add_record1();
+ $id1 = $this->getGateway()->getLastInsertId();
+ $this->add_record2();
+ $id2 = $this->getGateway()->getLastInsertId();
+
+ $deleted = $this->getGateway()->deleteByPk(array(array($id1), array($id2)));
+
+ $this->assertEqual(2, $deleted);
+ }
+} +?>
\ No newline at end of file |