Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add missing TestMock.pm6 file, torehaug++

  • Loading branch information...
commit 1cba5bfaeb7fff95f48e4c4d7c1e95d2fe7b78b9 1 parent 385fb81
Moritz Lenz moritz authored

Showing 1 changed file with 31 additions and 0 deletions. Show diff stats Hide diff stats

  1. +31 0 lib/DBDish/TestMock.pm6
31 lib/DBDish/TestMock.pm6
... ... @@ -0,0 +1,31 @@
  1 +use v6;
  2 +
  3 +use DBDish;
  4 +
  5 +my @data = (
  6 + [<a b c>],
  7 + [<d e f>],
  8 +);
  9 +
  10 +my @column_names = <col1 col2 col3>;
  11 +
  12 +class DBDish::TestMock::StatementHandle does DBDish::StatementHandle {
  13 + has Int $!current_idx = 0;
  14 +
  15 + method execute(*@) { $!current_idx = 0; @data.elems }
  16 + method rows { @data.elems }
  17 +
  18 + method fetchrow { (@data[$!current_idx++] // ()).list }
  19 + method column_names { @column_names }
  20 +
  21 + method finish { True }
  22 +}
  23 +
  24 +class DBDish::TestMock::Connection does DBDish::Connection {
  25 + method prepare($) { DBDish::TestMock::StatementHandle.new }
  26 + method disconnect { True }
  27 +}
  28 +
  29 +class DBDish::TestMock {
  30 + method connect() { DBDish::TestMock::Connection.new }
  31 +}

0 comments on commit 1cba5bf

Please sign in to comment.
Something went wrong with that request. Please try again.