From a3388622287e218beddfa14a47ed677d4307b36b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 25 Mar 2016 17:55:51 +0100 Subject: Removed simpletest and moved all tests in the unit tree Tests are executed now, but a lot of them need fixing. --- tests/unit/Data/SqlMap/TestQueryForMap.php | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/unit/Data/SqlMap/TestQueryForMap.php (limited to 'tests/unit/Data/SqlMap/TestQueryForMap.php') diff --git a/tests/unit/Data/SqlMap/TestQueryForMap.php b/tests/unit/Data/SqlMap/TestQueryForMap.php new file mode 100644 index 00000000..09810489 --- /dev/null +++ b/tests/unit/Data/SqlMap/TestQueryForMap.php @@ -0,0 +1,44 @@ +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"]); + } + +} -- cgit v1.2.3