line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eve::EventTestBase; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
4724
|
use parent qw(Eve::Test); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
19
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
142
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
103
|
|
6
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
84
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
4560
|
use Test::MockObject; |
|
3
|
|
|
|
|
12452
|
|
|
3
|
|
|
|
|
28
|
|
9
|
3
|
|
|
3
|
|
102
|
use Test::More; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
53
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
3079
|
use Eve::RegistryStub; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Eve::Registry; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Eve::EventTestBase->SKIP_CLASS(1); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
B - a base class for event test case classes. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package BogusEventTest; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use parent qw(Eve::EventTestBase); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Place the event test case class here |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
B is the class that provides tests that are |
32
|
|
|
|
|
|
|
required to pass for all event classes. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 B |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub setup { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$self->{'registry'} = Eve::Registry->new(); |
44
|
|
|
|
|
|
|
$self->{'event_map'} = $self->{'registry'}->get_event_map(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 B |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
A mandatory test case for the C method. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub test_trigger : Test(6) { |
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $handler_list = []; |
57
|
|
|
|
|
|
|
for my $i (0..2) { |
58
|
|
|
|
|
|
|
$self->{'event'}->trigger(); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
for my $handler (@{$handler_list}) { |
61
|
|
|
|
|
|
|
is($handler->call_pos(1), 'handle'); |
62
|
|
|
|
|
|
|
is_deeply( |
63
|
|
|
|
|
|
|
[$handler->call_args(1)], |
64
|
|
|
|
|
|
|
[$handler, event => $self->{'event'}]); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $handler_mock = Test::MockObject->new()->set_always('handle', 1); |
68
|
|
|
|
|
|
|
push(@{$handler_list}, $handler_mock); |
69
|
|
|
|
|
|
|
$self->{'event_map'}->bind( |
70
|
|
|
|
|
|
|
event_class => ref $self->{'event'}, |
71
|
|
|
|
|
|
|
handler => $handler_mock); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SEE ALSO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Copyright 2010-2013 Sergey Konoplev, Igor Zinovyev. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
90
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
91
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item L |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |