| 1 | package Test::Mock::Mango::DB; | ||||||||||
| 2 | |||||||||||
| 3 | 19 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 19 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 19 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 19 | our $VERSION = '0.03'; | |||||||||
| 8 | |||||||||||
| 9 | 19 | ▶ | use Test::Mock::Mango::Collection; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 50 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 12 | 50 | my $class = shift; | |||||||||
| 13 | |||||||||||
| 14 | 50 | bless { | |||||||||
| 15 | name => shift | ||||||||||
| 16 | }, $class; | ||||||||||
| 17 | } | ||||||||||
| 18 | 42 | ▶ | sub collection { Test::Mock::Mango::Collection->new(shift,shift) } | ||||||||
|
Subroutine
collection: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 19 | |||||||||||
| 20 | # ------------------------------------------------------------------------------ | ||||||||||
| 21 | |||||||||||
| 22 | # Just return undef | ||||||||||
| 23 | # | ||||||||||
| 24 | 4 | ▶ | sub command { | ||||||||
|
Subroutine
command: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 25 | 4 | my ($self, $command) = (shift,shift); | |||||||||
| 26 | 4 | ▶ | my $cb = ref $_[-1] eq 'CODE' ? pop : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 4 | my $err = undef; | |||||||||
| 29 | |||||||||||
| 30 | 4 | ▶ | if (defined $Test::Mock::Mango::error) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 2 | $err = $Test::Mock::Mango::error; | |||||||||
| 32 | 2 | $Test::Mock::Mango::error = undef; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 4 | ▶ | return $cb->($self, $err, undef) if $cb; # Non blocking | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 2 | return undef; # Blocking | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 19 | 1; | |||||||||
| 40 | |||||||||||
| 41 | =encoding utf8 | ||||||||||
| 42 | |||||||||||
| 43 | =head1 NAME | ||||||||||
| 44 | |||||||||||
| 45 | Test::Mock::Mango::DB - fake Mango::DB | ||||||||||
| 46 | |||||||||||
| 47 | =head1 DESCRIPTION | ||||||||||
| 48 | |||||||||||
| 49 | Simulated mango db for unit testing as part of L<Test::Mock::Mango>. | ||||||||||
| 50 | |||||||||||
| 51 | =cut | ||||||||||