line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mockify::MethodCallCounter; |
2
|
17
|
|
|
17
|
|
117
|
use Test::Mockify::Tools qw ( Error ); |
|
17
|
|
|
|
|
39
|
|
|
17
|
|
|
|
|
735
|
|
3
|
17
|
|
|
17
|
|
94
|
use strict; |
|
17
|
|
|
|
|
31
|
|
|
17
|
|
|
|
|
322
|
|
4
|
17
|
|
|
17
|
|
76
|
use warnings; |
|
17
|
|
|
|
|
35
|
|
|
17
|
|
|
|
|
4209
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
113
|
|
|
113
|
0
|
204
|
my $class = shift; |
8
|
113
|
|
|
|
|
213
|
my $self = bless {}, $class; |
9
|
113
|
|
|
|
|
281
|
return $self; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub addMethod { |
13
|
121
|
|
|
121
|
0
|
183
|
my $self = shift; |
14
|
121
|
|
|
|
|
236
|
my ( $MethodName ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
121
|
|
|
|
|
262
|
$self->{$MethodName} = 0; |
17
|
|
|
|
|
|
|
|
18
|
121
|
|
|
|
|
211
|
return; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub increment { |
22
|
138
|
|
|
138
|
0
|
241
|
my $self = shift; |
23
|
138
|
|
|
|
|
237
|
my ( $MethodName ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
138
|
|
|
|
|
343
|
$self->_testIfMethodWasAdded( $MethodName ); |
26
|
138
|
|
|
|
|
213
|
$self->{$MethodName} += 1; |
27
|
|
|
|
|
|
|
|
28
|
138
|
|
|
|
|
215
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub getAmountOfCalls { |
32
|
34
|
|
|
34
|
0
|
60
|
my $self = shift; |
33
|
34
|
|
|
|
|
66
|
my ( $MethodName ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
34
|
|
|
|
|
100
|
$self->_testIfMethodWasAdded( $MethodName ); |
36
|
33
|
|
|
|
|
56
|
my $AmountOfCalls = $self->{ $MethodName }; |
37
|
|
|
|
|
|
|
|
38
|
33
|
|
|
|
|
125
|
return $AmountOfCalls; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _testIfMethodWasAdded { |
42
|
172
|
|
|
172
|
|
253
|
my $self = shift; |
43
|
172
|
|
|
|
|
258
|
my ( $MethodName ) = @_; |
44
|
|
|
|
|
|
|
|
45
|
172
|
100
|
|
|
|
433
|
if( not exists $self->{ $MethodName } ){ |
46
|
1
|
|
|
|
|
6
|
Error( "The Method: '$MethodName' was not added to Mockify" ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
1; |