File Coverage

blib/lib/Eve/RegistryStub.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Eve::RegistryStub;
2              
3 8     8   982 use strict;
  8         22  
  8         259  
4 8     8   38 use warnings;
  8         15  
  8         213  
5              
6 8     8   38 no warnings qw(redefine);
  8         47  
  8         238  
7              
8 8     8   8183 use Test::MockObject::Extends;
  8         38755  
  8         73  
9              
10 8     8   5826 use Eve::Registry;
  0            
  0            
11              
12             =head1 NAME
13              
14             B - a helper class that replaces the registry with
15             a mock object.
16              
17             =head1 SYNOPSIS
18              
19             package SomeTestCase;
20              
21             use Eve::RegistryStub;
22             use Eve::Registry;
23              
24             my $already_mocked_registry = Eve::Registry->new(
25             # some literals declarations);
26              
27             my $service = $registry->get_service();
28              
29             =head1 DESCRIPTION
30              
31             B is the mock version of a B class
32             that contains all services and automatically replaces some input
33             parameter with bogus default values..
34              
35             =head1 METHODS
36              
37             =head2 B
38              
39             =cut
40              
41             sub main {
42             my $init = \&Eve::Registry::init;
43              
44             *Eve::Registry::new = sub {
45             my $self = &Eve::Class::new(@_);
46              
47             return Test::MockObject::Extends->new($self);
48             };
49              
50             *Eve::Registry::init = sub {
51             my $self = shift;
52              
53             $init->(
54             $self,
55             base_uri_string => 'http://example.com',
56             email_from_string => 'Someone ',
57             session_storage_path => File::Spec->catdir(
58             File::Spec->tmpdir(), 'test_session_storage'),
59             session_expiration_interval => 3600,
60             @_);
61             };
62             }
63              
64             main();
65              
66             =head1 SEE ALSO
67              
68             =over 4
69              
70             =item L
71              
72             =item L
73              
74             =back
75              
76             =head1 LICENSE AND COPYRIGHT
77              
78             Copyright 2010-2013 Sergey Konoplev, Igor Zinovyev.
79              
80             This program is free software; you can redistribute it and/or modify it
81             under the terms of either: the GNU General Public License as published
82             by the Free Software Foundation; or the Artistic License.
83              
84             See http://dev.perl.org/licenses/ for more information.
85              
86             =head1 AUTHOR
87              
88             =over 4
89              
90             =item L
91              
92             =item L
93              
94             =back
95              
96             =cut
97              
98             1;