Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add missing TestMock.pm6 file, torehaug++

  • Loading branch information...
commit 1cba5bfaeb7fff95f48e4c4d7c1e95d2fe7b78b9 1 parent 385fb81
Moritz Lenz moritz authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 lib/DBDish/TestMock.pm6
31 lib/DBDish/TestMock.pm6
View
@@ -0,0 +1,31 @@
+use v6;
+
+use DBDish;
+
+my @data = (
+ [<a b c>],
+ [<d e f>],
+);
+
+my @column_names = <col1 col2 col3>;
+
+class DBDish::TestMock::StatementHandle does DBDish::StatementHandle {
+ has Int $!current_idx = 0;
+
+ method execute(*@) { $!current_idx = 0; @data.elems }
+ method rows { @data.elems }
+
+ method fetchrow { (@data[$!current_idx++] // ()).list }
+ method column_names { @column_names }
+
+ method finish { True }
+}
+
+class DBDish::TestMock::Connection does DBDish::Connection {
+ method prepare($) { DBDish::TestMock::StatementHandle.new }
+ method disconnect { True }
+}
+
+class DBDish::TestMock {
+ method connect() { DBDish::TestMock::Connection.new }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.