From 4813565b22eadbdf23985a7635b69e6c7e3d3659 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 1 Oct 2008 14:15:52 +0000 Subject: Added test for dbi Iterator --- tests/it_dbi.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/it_dbi.t') diff --git a/tests/it_dbi.t b/tests/it_dbi.t index 6e14657..cd8c650 100755 --- a/tests/it_dbi.t +++ b/tests/it_dbi.t @@ -159,3 +159,24 @@ is( "integer/integer/integer/string", "automatic type detection" ); + +$count = 0; +foreach (new it_dbi_test as $id => $record) +{ + $count++; + is($record->_key, $id, "Iterator id $id"); +} +is($count, 3, "Iterator without select"); + +$count = 0; +foreach (new it_dbi_test('foo <>' => "") as $id => $record) +{ + $count++; + is($record->_key, $id, "Iterator id $id"); +} +is($count, 2, "Iterator with select"); + +$count = 0; +foreach ($record as $rec) + $count++; +is($count, 2, "Iterator reused"); -- cgit v1.2.3