summaryrefslogtreecommitdiff
path: root/tests/simple_unit/SqlMap/TestQueryForMap.php
diff options
context:
space:
mode:
authorwei <>2007-05-08 08:06:13 +0000
committerwei <>2007-05-08 08:06:13 +0000
commite9486a539c3a43afcc129f647917780ffc1ed6cd (patch)
tree4e41bdf72611d424b6caa90489da3c34500164e9 /tests/simple_unit/SqlMap/TestQueryForMap.php
parent3392e51b4edf84682b66ce9e32d00c1adb3205bb (diff)
Fixed #458
Diffstat (limited to 'tests/simple_unit/SqlMap/TestQueryForMap.php')
-rw-r--r--tests/simple_unit/SqlMap/TestQueryForMap.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/simple_unit/SqlMap/TestQueryForMap.php b/tests/simple_unit/SqlMap/TestQueryForMap.php
new file mode 100644
index 00000000..25ef2f4d
--- /dev/null
+++ b/tests/simple_unit/SqlMap/TestQueryForMap.php
@@ -0,0 +1,43 @@
+<?php
+require_once(dirname(__FILE__).'/BaseCase.php');
+
+class TestQueryForMap extends BaseCase
+{
+ function __construct()
+ {
+ parent::__construct();
+ $this->initSqlMap();
+ }
+
+ /**
+ * Test ExecuteQueryForMap : Hashtable.
+ */
+ function testExecuteQueryForMap()
+ {
+ $map = $this->sqlmap->QueryForMap("GetAllAccountsViaResultClass", null, "FirstName",null,0,2);
+ $this->assertIdentical(2, count($map));
+ $this->assertAccount1($map["Joe"]);
+
+ $this->assertIdentical(1, $map["Joe"]->getID());
+ $this->assertIdentical(2, $map["Averel"]->getID());
+ }
+
+ /**
+ * Test ExecuteQueryForMap with value property :
+ * "FirstName" as key, "EmailAddress" as value
+ */
+ function testExecuteQueryForMapWithValueProperty()
+ {
+ $map = $this->sqlmap->QueryForMap("GetAllAccountsViaResultClass", null,
+ "FirstName", "EmailAddress",1,3);
+
+ $this->assertIdentical(3, count($map));
+
+ $this->assertIdentical("Averel.Dalton@somewhere.com", $map["Averel"]);
+ $this->assertNull($map["William"]);
+ $this->assertIdentical("Jack.Dalton@somewhere.com", $map["Jack"]);
+ }
+
+}
+
+?> \ No newline at end of file