From f82f0cc208a2ff6d3d3662cef70a9d46b61a2db4 Mon Sep 17 00:00:00 2001 From: Sergey Tsalkov Date: Sat, 14 Aug 2021 05:08:41 +0000 Subject: [PATCH] add another queryWalk() test case make sure we're using $is_buffered=false for queryWalk() like we're supposed to --- simpletest/WalkTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/simpletest/WalkTest.php b/simpletest/WalkTest.php index f60c18d..688ecff 100644 --- a/simpletest/WalkTest.php +++ b/simpletest/WalkTest.php @@ -45,4 +45,20 @@ class WalkTest extends SimpleTest { // if $Walk hasn't been properly freed, this will produce an out of sync error DB::query("SELECT * FROM accounts"); } + + function test_5_walk_error() { + $Walk = DB::queryWalk("SELECT * FROM accounts"); + $Walk->next(); + + try { + // this will produce an out of sync error + DB::query("SELECT * FROM accounts"); + } catch (MeekroDBException $e) { + if (substr_count($e->getMessage(), 'out of sync')) { + $exception_was_caught = 1; + } + } + + $this->assert($exception_was_caught === 1); + } } \ No newline at end of file