From 66dd67c088eebe90da0d8d25a88e5c39007251e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20D=2E=20Rodas?= Date: Wed, 13 Nov 2013 04:54:31 -0300 Subject: [PATCH] Added more tests --- tests/DBTest.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/DBTest.php b/tests/DBTest.php index 030c8f3..60a833d 100644 --- a/tests/DBTest.php +++ b/tests/DBTest.php @@ -58,9 +58,17 @@ class DBTest extends \phpunit_framework_testcase $db->insert("foobar", ['type' => '/barfoo', 'karma' => 30]); sleep(1); - $this->assertEquals($db->first("SELECT max(karma) FROM foobar;")->max, 30); - $this->assertEquals($db->first("SELECT min(karma) FROM foobar;")->min, 10); - $this->assertEquals($db->first("SELECT mean(karma) FROM foobar;")->mean, 20); + $this->assertEquals($db->first("SELECT max(karma) FROM foobar")->max, 30); + $this->assertEquals($db->first("SELECT min(karma) FROM foobar")->min, 10); + $this->assertEquals($db->first("SELECT mean(karma) FROM foobar")->mean, 20); + + foreach ($db->query("SELECT mean(karma) FROM foobar GROUP BY type") as $row) { + if ($row->type == "/foobar") { + $this->assertEquals(15, $row->mean); + } else { + $this->assertEquals(30, $row->mean); + } + } $db->drop(); }