Moose/Config.pm

filter: Statementstmt 89.8% 44 / 49 Branchbran 62.5% 5 / 8 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 4 / 4 Subroutinesub 90.9% 10 / 11 Podpod 100% 1 / 1 totaltotal 88.6% 70 / 79 CC 7 SCAR 8.8
CC
7
Cov
87%
args
6.0
__ANON__
3.0
__ANON__
3.0
CRAP 2.4
« Moose/Role/CLI.pm ↑ Summary Moose/Tutorial.pm »
1 package Test::Class::Moose::Config;
2  
3 # ABSTRACT: Configuration information for Test::Class::Moose
4  
5 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 34 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 34 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 34 ▶use 5.010000;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 34 our $VERSION = '1.00';
12  
13 34 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 34 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 34 ▶use Test::Class::Moose::Deprecated;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 34 subtype 'ArrayRefOfStrings', as 'Maybe[ArrayRef[Str]]';
19  
20 2 ▶coerce 'ArrayRefOfStrings', from 'Str', via { defined($_) ? [$_] : undef };
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 2 0 2
21  
22 has 'show_timing' => (
23 is => 'ro',
24 isa => 'Bool',
25 lazy => 1,
26 9 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
27 9 ▶ if ( $_[0]->use_environment and $ENV{HARNESS_IS_VERBOSE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}) 1 8 9
Condition100%3/3
$_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}
!ll&&!rl&&r
711
MC/DC100%2/2
$_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}
$_[0]->use_environment $ENV{"HARNESS_IS_VERBOSE"}
Truth table100%3/3
A and B
A= $_[0]->use_environmentB= $ENV{"HARNESS_IS_VERBOSE"}
ABresult
0X0
100
111
28 1 return 1;
29 }
30 8 return;
31 },
32 34 );
33  
34 34 has 'set_process_name' => (
35 is => 'ro',
36 isa => 'Bool',
37 default => 0,
38 );
39  
40 has 'statistics' => (
41 is => 'ro',
42 isa => 'Bool',
43 lazy => 1,
44 14 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
45 14 ▶ if ( $_[0]->use_environment and $ENV{HARNESS_IS_VERBOSE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}) 1 13 14
Condition100%3/3
$_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}
!ll&&!rl&&r
1211
MC/DC100%2/2
$_[0]->use_environment and $ENV{"HARNESS_IS_VERBOSE"}
$_[0]->use_environment $ENV{"HARNESS_IS_VERBOSE"}
Truth table100%3/3
A and B
A= $_[0]->use_environmentB= $ENV{"HARNESS_IS_VERBOSE"}
ABresult
0X0
100
111
46 1 return 1;
47 }
48 13 return;
49 },
50 34 );
51  
52 34 has 'use_environment' => (
53 is => 'ro',
54 isa => 'Bool',
55 );
56  
57 34 has 'test_class' => (
58 is => 'ro',
59 isa => 'Str',
60 );
61  
62 34 has 'randomize' => (
63 is => 'ro',
64 isa => 'Bool',
65 default => 0,
66 );
67  
68 34 has 'randomize_classes' => (
69 is => 'ro',
70 isa => 'Bool',
71 default => 0,
72 );
73  
74 34 has 'include' => (
75 is => 'ro',
76 isa => 'Regexp',
77 );
78  
79 34 has 'exclude' => (
80 is => 'ro',
81 isa => 'Regexp',
82 );
83  
84 34 has 'include_tags' => (
85 is => 'ro',
86 isa => 'ArrayRefOfStrings',
87 coerce => 1,
88 clearer => 'clear_include_tags',
89 );
90  
91 34 has 'exclude_tags' => (
92 is => 'ro',
93 isa => 'ArrayRefOfStrings',
94 coerce => 1,
95 clearer => 'clear_exclude_tags',
96 );
97  
98 34 has 'test_classes' => (
99 is => 'ro',
100 isa => 'ArrayRefOfStrings',
101 coerce => 1,
102 );
103  
104 0 ▶sub args {
Subroutine args: not called CC=2 SCAR=17.9
Pod documented
105 0 my $self = shift;
106  
107 0 Test::Class::Moose::Deprecated::deprecated();
108  
109 return (
110 0 ▶ map { defined $self->$_ ? ( $_ => $self->$_ ) : () }
Branch: 1 branch
BranchTrueFalseTotal
defined $self->$_ ? : 0 0 0
111 0 map { $_->name } $self->meta->get_all_attributes
112 );
113 }
114  
115 34 __PACKAGE__->meta->make_immutable;
116  
117 34 1;
118  
119 =pod
120  
121 =encoding UTF-8
122  
123 =head1 NAME
124  
125 Test::Class::Moose::Config - Configuration information for Test::Class::Moose
126  
127 =head1 VERSION
128  
129 version 1.00
130  
131 =head1 SYNOPSIS
132  
133 my $tc_config = Test::Class::Moose::Config->new({
134 show_timing => 1,
135 statistics => 1,
136 randomize => 0,
137 });
138 my $test_suite = Test::Class::Moose->new($tc_config);
139  
140 =head1 DESCRIPTION
141  
142 For internal use only (maybe I'll expose it later). Not guaranteed to be
143 stable.
144  
145 This class defines many of the attributes for L<Test::Class::Moose>. They're
146 kept here to minimize namespace pollution in L<Test::Class::Moose>.
147  
148 =head1 ATTRIBUTES
149  
150 =head2 C<show_timing>
151  
152 Boolean. Will display verbose information on the amount of time it takes each
153 test class/test method to run.
154  
155 =head2 C<statistics>
156  
157 Boolean. Will display number of classes, test methods and tests run.
158  
159 =head2 C<use_environment>
160  
161 Boolean. Sets show_timing and statistics to true if your test harness is
162 running verbosely, false otherwise.
163  
164 =head2 C<test_classes>
165  
166 Takes a class name or an array reference of class names. If it is present, the
167 C<test_classes> method will only return these classes. This is very useful if
168 you wish to run an individual class as a test:
169  
170 Test::Class::Moose->new(
171 test_classes => $ENV{TEST_CLASS}, # ignored if undef
172 )->runtests;
173  
174 =head2 C<include_tags>
175  
176 Array ref of strings matching method tags (a single string is also ok). If
177 present, only test methods whose tags match C<include_tags> or whose tags don't
178 match C<exclude_tags> will be included. B<However>, they must still start with
179 C<test_>.
180  
181 For example:
182  
183 my $test_suite = Test::Class::Moose->new({
184 include_tags => [qw/api database/],
185 });
186  
187 The above constructor will only run tests tagged with C<api> or C<database>.
188  
189 =head2 C<exclude_tags>
190  
191 The same as C<include_tags>, but will exclude the tests rather than include
192 them. For example, if your network is down:
193  
194 my $test_suite = Test::Class::Moose->new({
195 exclude_tags => [ 'network' ],
196 });
197  
198 # or
199 my $test_suite = Test::Class::Moose->new({
200 exclude_tags => 'network',
201 });
202  
203 =head2 C<randomize>
204  
205 Boolean. Will run test methods of a class in a random order.
206  
207 =head2 C<randomize_classes>
208  
209 Boolean. Will run test classes in a random order.
210  
211 =head1 METHODS
212  
213 =head2 C<args>
214  
215 Returns a hash of the args used to build the configuration. This used to be
216 used internally, but is now retained simply for backwards compatibility. You
217 probably won't need it.
218  
219 =head1 SUPPORT
220  
221 Bugs may be submitted at L<https://github.com/Test-More/test-class-moose/issues>.
222  
223 =head1 SOURCE
224  
225 The source code repository for Test-Class-Moose can be found at L<https://github.com/Test-More/test-class-moose>.
226  
227 =head1 AUTHORS
228  
229 =over 4
230  
231 =item *
232  
233 Curtis "Ovid" Poe <ovid@cpan.org>
234  
235 =item *
236  
237 Dave Rolsky <autarch@urth.org>
238  
239 =item *
240  
241 Chad Granum <exodist@cpan.org>
242  
243 =back
244  
245 =head1 COPYRIGHT AND LICENSE
246  
247 This software is copyright (c) 2012 - 2025 by Curtis "Ovid" Poe.
248  
249 This is free software; you can redistribute it and/or modify it under
250 the same terms as the Perl 5 programming language system itself.
251  
252 The full text of the license can be found in the
253 F<LICENSE> file included with this distribution.
254  
255 =cut
256  
257 __END__
« Moose/Role/CLI.pm ↑ Summary Moose/Tutorial.pm »