| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Mock::Mango::DB; |
|
2
|
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
363
|
use v5.10; |
|
|
19
|
|
|
|
|
66
|
|
|
|
19
|
|
|
|
|
785
|
|
|
4
|
19
|
|
|
19
|
|
97
|
use strict; |
|
|
19
|
|
|
|
|
36
|
|
|
|
19
|
|
|
|
|
523
|
|
|
5
|
19
|
|
|
19
|
|
90
|
use warnings; |
|
|
19
|
|
|
|
|
32
|
|
|
|
19
|
|
|
|
|
811
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
17273
|
use Test::Mock::Mango::Collection; |
|
|
19
|
|
|
|
|
47
|
|
|
|
19
|
|
|
|
|
3286
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
50
|
|
|
50
|
0
|
2014
|
my $class = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
50
|
|
|
|
|
4987
|
bless { |
|
15
|
|
|
|
|
|
|
name => shift |
|
16
|
|
|
|
|
|
|
}, $class; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
42
|
|
|
42
|
0
|
246
|
sub collection { Test::Mock::Mango::Collection->new(shift,shift) } |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------ |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Just return undef |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
sub command { |
|
25
|
4
|
|
|
4
|
0
|
178
|
my ($self, $command) = (shift,shift); |
|
26
|
4
|
100
|
|
|
|
18
|
my $cb = ref $_[-1] eq 'CODE' ? pop : undef; |
|
27
|
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
5
|
my $err = undef; |
|
29
|
|
|
|
|
|
|
|
|
30
|
4
|
100
|
|
|
|
14
|
if (defined $Test::Mock::Mango::error) { |
|
31
|
2
|
|
|
|
|
4
|
$err = $Test::Mock::Mango::error; |
|
32
|
2
|
|
|
|
|
3
|
$Test::Mock::Mango::error = undef; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
4
|
100
|
|
|
|
20
|
return $cb->($self, $err, undef) if $cb; # Non blocking |
|
36
|
2
|
|
|
|
|
6
|
return undef; # Blocking |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
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. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |