File Coverage

blib/lib/Message/Passing/Output/Test.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Message::Passing::Output::Test;
2 13     13   412038 use Moo;
  13         42772  
  13         76  
3 13     13   12495 use MooX::Types::MooseLike::Base qw/ ArrayRef /;
  13         45609  
  13         1003  
4 13     13   2118 use namespace::clean -except => 'meta';
  13         40362  
  13         105  
5              
6             extends 'Message::Passing::Output::Callback';
7              
8             has '+cb' => (
9             default => sub { sub {} },
10             );
11              
12             has _messages => (
13             is => 'ro',
14             isa => ArrayRef,
15             default => sub { [] },
16             clearer => 'clear_messages',
17             lazy => 1,
18             );
19              
20 27     27 1 113589 sub messages { @{ $_[0]->_messages } }
  27         518  
21 27     27 1 47 sub consume_test { push(@{$_[0]->_messages }, $_[1]) }
  27         442  
22 14     14 1 5804 sub message_count { scalar @{ $_[0]->_messages } }
  14         250  
23              
24              
25             after consume => sub {
26             shift()->consume_test(@_);
27             };
28              
29              
30             1;
31              
32             =head1 NAME
33              
34             Message::Passing::Output::Test - Output for use in unit tests
35              
36             =head1 SYNOPSIS
37              
38             You only want this if you're writing tests...
39             See the current tests for examples..
40              
41             =head1 METHODS
42              
43             =head2 messages
44              
45             =head2 clear_messages
46              
47             Clears all stores messages. Useful to speed up tests by resetting the
48             instance instead of re-instantiating it.
49              
50             =head2 consume_test
51              
52             =head2 message_count
53              
54             =head1 SEE ALSO
55              
56             L<Message::Passing>
57              
58             =head1 SPONSORSHIP
59              
60             This module exists due to the wonderful people at Suretec Systems Ltd.
61             <http://www.suretecsystems.com/> who sponsored its development for its
62             VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
63             the SureVoIP API -
64             <http://www.surevoip.co.uk/support/wiki/api_documentation>
65              
66             =head1 AUTHOR, COPYRIGHT AND LICENSE
67              
68             See L<Message::Passing>.
69              
70             =cut