From 52ca011af1b57c332904401df6e59d9e2702e4ad Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 25 Jun 2008 10:25:50 -0400 Subject: [PATCH] Add a test for the new Iterarator implementation in BSDBResult * UnitTest/DatabaseTestAbstract.php (DatabaseTestAbstract::testIterator): New method --- UnitTest/DatabaseTestAbstract.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/UnitTest/DatabaseTestAbstract.php b/UnitTest/DatabaseTestAbstract.php index 8970121..9655cf0 100644 --- a/UnitTest/DatabaseTestAbstract.php +++ b/UnitTest/DatabaseTestAbstract.php @@ -20,7 +20,7 @@ abstract class DatabaseTestAbstract extends PHPUnit_Framework_TestCase { try { - $this->fixture->query("INSERT INTO test (textstuff) VALUES ('moo'), ('foo'), ('hey'), ('foo'), ('boo'), ('poo')"); + $this->fixture->query("INSERT INTO test (textstuff) VALUES ('moo'), ('foo'), ('hey'), ('foo'), ('boo'), ('poo')"); } catch (BSDbException $e) { @@ -46,6 +46,20 @@ abstract class DatabaseTestAbstract extends PHPUnit_Framework_TestCase } } + public function testIterator() + { + $this->fixture->query("INSERT INTO test (textstuff) VALUES ('a'), ('b'), ('c')"); + $result = $this->fixture->query("SELECT * FROM test"); + + $i = 0; + foreach ($result as $item) + { + $i++; + } + + $this->assertEquals(3, $i); + } + public function testEscapeString() { $this->assertEquals("Robert\'s castle", $this->fixture->escapeString("Robert's castle")); -- 2.43.5