Moose/Role/Executor.pm

filter: Statementstmt 94.1% 259 / 275 Branchbran 87.7% 79 / 90 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 100% 47 / 47 Podpod 100% 6 / 6 totaltotal 93.2% 399 / 428 CC 56 SCAR 14.5
CC
56
Cov
92%
__ANON__
10.0
_filter_by_tag
9.0
test_classes
7.1
CRAP 4.3
« Moose/AttributeRegistry.pm ↑ Summary Moose/Util.pm »
1 package Test::Class::Moose::Role::Executor;
2  
3 # ABSTRACT: Common code for Runner classes
4  
5 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 30 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 30 ▶use 5.010000;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 30 our $VERSION = '1.00';
12  
13 30 ▶use Moose::Role 2.0000;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 30 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 30 ▶use List::SomeUtils qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 30 ▶use List::Util qw(shuffle);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 30 ▶use Test2::API qw( test2_stack );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 30 ▶use Test2::Tools::AsyncSubtest qw( async_subtest );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 30 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
21 30 require Test2::AsyncSubtest::Hub;
22 30 Test2::AsyncSubtest::Hub->do_not_warn_on_plan();
23 }
24 30 ▶use Test::Class::Moose::AttributeRegistry;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 30 ▶use Test::Class::Moose::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 30 ▶use Test::Class::Moose::Report::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 30 ▶use Test::Class::Moose::Report::Instance;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 30 ▶use Test::Class::Moose::Report::Method;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 30 ▶use Test::Class::Moose::Report;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 30 ▶use Test::Class::Moose::Util qw( context_do );
Subroutine BEGIN: called CC=1 SCAR=0.0
31 30 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 30 has 'test_configuration' => (
34 is => 'ro',
35 isa => 'Test::Class::Moose::Config',
36 required => 1,
37 );
38  
39 30 has 'test_report' => (
40 is => 'ro',
41 isa => 'Test::Class::Moose::Report',
42 builder => '_build_test_report',
43 );
44  
45 has 'is_parallel' => (
46 is => 'ro',
47 isa => 'Bool',
48 35 ▶ default => sub { ( ref $_[0] ) =~ /::Parallel$/ ? 1 : 0 },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
ref($_[0]) =~ /::Parallel$/ ? : 11 24 35
49 30 );
50  
51 31 ▶sub runtests {
Subroutine runtests: called CC=1 SCAR=0.2
Pod documented
52 31 my $self = shift;
53  
54 31 my $report = $self->test_report;
55 31 $report->_start_benchmark;
56 31 my @test_classes = $self->test_classes;
57  
58 31 $self->_validate_test_classes(@test_classes);
59  
60 29 ▶ context_do {
Subroutine __ANON__: called CC=2 SCAR=8.7
61 29 my $ctx = shift;
62  
63 29 $ctx->plan( scalar @test_classes );
64  
65 29 $self->_run_test_classes(@test_classes);
66  
67 19 ▶ $ctx->diag(<<"END") if $self->test_configuration->statistics;
Branch: 1 branch
BranchTrueFalseTotal
if $self->test_configuration->statistics 0 19 19
68 0 Test classes: @{[ $report->num_test_classes ]}
69 0 Test instances: @{[ $report->num_test_instances ]}
70 0 Test methods: @{[ $report->num_test_methods ]}
71 0 Total tests run: @{[ $report->num_tests_run ]}
72 END
73  
74 19 $ctx->done_testing;
75 29 };
76  
77 19 $report->_end_benchmark;
78 19 return $self;
79 }
80  
81 31 ▶sub _validate_test_classes {
Subroutine _validate_test_classes: called CC=6 SCAR=17.9
82 31 my $self = shift;
83  
84 31 ▶ my @bad = grep { !$_->isa('Test::Class::Moose') } @_
Branch: 1 branch
BranchTrueFalseTotal
my(@bad) = grep({not $_->isa("Test::Class::Moose");} @_) or return 2 29 31
85 or return;
86  
87 2 my $msg = 'Found the following class';
88 2 ▶ $msg .= 'es' if @bad > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @bad > 1 1 1 2
89 2 ▶ $msg
Branch: 2 branches
BranchTrueFalseTotal
@bad > 1 ? : 1 1 2
@bad > 1 ? : 1 1 2
90 .= ' that '
91 . ( @bad > 1 ? 'are' : 'is' ) . ' not '
92 . ( @bad > 1 ? 'subclasses' : 'a subclass' )
93 . " of Test::Class::Moose: @bad";
94 2 ▶ $msg .= ' (did you load '
Branch: 1 branch
BranchTrueFalseTotal
@bad > 1 ? : 1 1 2
95 . ( @bad > 1 ? 'these classes' : 'this class' ) . '?)';
96 2 die $msg;
97 }
98  
99 19 ▶sub _run_test_classes {
Subroutine _run_test_classes: called CC=2 SCAR=6.9
100 19 my $self = shift;
101 19 my @test_classes = @_;
102  
103 19 for my $test_class (@test_classes) {
104 async_subtest(
105 $test_class,
106 { manual_skip_all => 1 },
107 35 ▶ sub { $self->run_test_class($test_class) }
Subroutine __ANON__: called CC=1 SCAR=0.0
108 35 )->finish;
109 }
110 }
111  
112 35 ▶sub _build_test_report { Test::Class::Moose::Report->new }
Subroutine _build_test_report: called CC=1 SCAR=0.0
113  
114 45 ▶sub run_test_class {
Subroutine run_test_class: called CC=1 SCAR=0.0
Pod documented
115 45 my $self = shift;
116 45 my $test_class = shift;
117  
118 45 my $class_report
119 = Test::Class::Moose::Report::Class->new( name => $test_class );
120  
121 45 $self->test_report->add_test_class($class_report);
122  
123 45 $class_report->_start_benchmark;
124  
125 45 my $passed = $self->_run_test_instances( $test_class, $class_report );
126  
127 45 $class_report->passed($passed);
128  
129 45 $class_report->_end_benchmark;
130  
131 45 return $class_report;
132 }
133  
134 45 ▶sub _run_test_instances {
Subroutine _run_test_instances: called CC=2 SCAR=6.9
135 45 my $self = shift;
136 45 my $test_class = shift;
137 45 my $class_report = shift;
138  
139 45 my @test_instances = $test_class->_tcm_make_test_class_instances(
140 test_report => $self->test_report,
141 );
142  
143 45 ▶ unless (@test_instances) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@test_instances) 2 43 45
144 2 ▶ context_do {
Subroutine __ANON__: called CC=1 SCAR=0.0
145 2 my $ctx = shift;
146  
147 2 my $message = "Skipping '$test_class': no test instances found";
148 2 $class_report->skipped($message);
149 2 $class_report->passed(1);
150 2 $ctx->plan( 0, 'SKIP' => $message );
151 2 };
152 2 return 1;
153 }
154  
155 43 ▶ return context_do {
Subroutine __ANON__: called CC=4 SCAR=13.9
156 43 my $ctx = shift;
157  
158 43 ▶ $ctx->plan( scalar @test_instances )
Branch: 1 branch
BranchTrueFalseTotal
if @test_instances > 1 3 40 43
159 if @test_instances > 1;
160  
161 43 my $passed = 1;
162 43 for my $test_instance (
163 3 sort { $a->test_instance_name cmp $b->test_instance_name }
164 @test_instances )
165 {
166 46 my $instance_report = $self->_maybe_wrap_test_instance(
167 $test_instance,
168 $class_report,
169 @test_instances > 1,
170 );
171 46 ▶ $passed = 0 if not $instance_report->passed;
Branch: 1 branch
BranchTrueFalseTotal
unless $instance_report->passed 6 40 46
172 }
173  
174 43 return $passed;
175 43 };
176 }
177  
178 46 ▶sub _maybe_wrap_test_instance {
Subroutine _maybe_wrap_test_instance: called CC=2 SCAR=6.9
179 46 my $self = shift;
180 46 my $test_instance = shift;
181 46 my $class_report = shift;
182 46 my $in_subtest = shift;
183  
184 46 ▶ return $self->run_test_instance(
Branch: 1 branch
BranchTrueFalseTotal
unless $in_subtest 40 6 46
185 $test_instance,
186 $class_report,
187 ) unless $in_subtest;
188  
189 6 my $instance_report;
190 async_subtest(
191 $test_instance->test_instance_name,
192 { manual_skip_all => 1 },
193 6 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
194 6 $instance_report = $self->run_test_instance(
195 $test_instance,
196 $class_report,
197 );
198 },
199 6 )->finish;
200  
201 6 return $instance_report;
202 }
203  
204 46 ▶sub run_test_instance {
Subroutine run_test_instance: called CC=2 SCAR=7.1
Pod documented
205 46 my ( $self, $test_instance, $class_report ) = @_;
206  
207 46 my $test_instance_name = $test_instance->test_instance_name;
208 46 my $instance_report = Test::Class::Moose::Report::Instance->new(
209 { name => $test_instance_name,
210 }
211 );
212  
213 46 ▶ local $0 = "$0 - $test_instance_name"
Branch: 1 branch
BranchTrueFalseTotal
if $self->test_configuration->set_process_name 3 43 46
214 if $self->test_configuration->set_process_name;
215  
216 46 $instance_report->_start_benchmark;
217  
218 46 $class_report->add_test_instance($instance_report);
219  
220 46 my @test_methods = $self->_test_methods_for($test_instance);
221  
222 46 ▶ context_do {
Subroutine __ANON__: called CC=9 SCAR=23.0
223 46 my $ctx = shift;
224  
225 46 ▶ unless (@test_methods) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@test_methods) 0 46 46
226  
227 0 my $message
228 = "Skipping '$test_instance_name': no test methods found";
229 0 $instance_report->skipped($message);
230 0 $instance_report->passed(1);
231 0 $ctx->plan( 0, SKIP => $message );
232 0 return;
233 }
234  
235 46 my $report = $self->test_report;
236  
237 46 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->run_test_control_method($test_instance, "test_startup", $instance_report)) 2 44 46
238 $self->run_test_control_method(
239 $test_instance, 'test_startup', $instance_report,
240 )
241 )
242 {
243 2 $instance_report->passed(0);
244 2 return;
245 }
246  
247 44 ▶ if ( my $message = $test_instance->test_skip ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $message = $test_instance->test_skip) 4 40 44
248  
249 # test_startup skipped the class
250 4 $instance_report->skipped($message);
251  
252 4 ▶ if ( $test_instance->run_control_methods_on_skip ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test_instance->run_control_methods_on_skip) 1 3 4
253 1 ▶ $self->_run_shutdown( $test_instance, $instance_report )
Branch: 1 branch
BranchTrueFalseTotal
$self->_run_shutdown($test_instance, $instance_report) or return 1 0 1
254 or return;
255 }
256  
257 4 $instance_report->passed(1);
258 4 $ctx->plan( 0, SKIP => $message );
259 4 return;
260 }
261  
262 40 $ctx->plan( scalar @test_methods );
263  
264 40 my $all_passed = 1;
265 40 foreach my $test_method (@test_methods) {
266 110 my $method_report = $self->run_test_method(
267 $test_instance,
268 $test_method,
269 $instance_report,
270 );
271 110 ▶ $all_passed = 0 if not $method_report->passed;
Branch: 1 branch
BranchTrueFalseTotal
unless $method_report->passed 7 103 110
272 }
273 40 $instance_report->passed($all_passed);
274  
275 40 $self->_run_shutdown( $test_instance, $instance_report );
276  
277 # finalize reporting
278 40 $instance_report->_end_benchmark;
279 40 ▶ if ( $self->test_configuration->show_timing ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->test_configuration->show_timing) 0 40 40
280 0 my $time = $instance_report->time->duration;
281 0 $ctx->diag("$test_instance_name: $time");
282 }
283 46 };
284  
285 46 return $instance_report;
286 }
287  
288 41 ▶sub _run_shutdown {
Subroutine _run_shutdown: called CC=2 SCAR=9.2
289 41 my ( $self, $test_instance, $instance_report ) = @_;
290  
291 41 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if $self->run_test_control_method($test_instance, "test_shutdown", $instance_report) 41 0 41
292 if $self->run_test_control_method(
293 $test_instance, 'test_shutdown', $instance_report,
294 );
295  
296 0 $instance_report->passed(0);
297  
298 0 return 0;
299 }
300  
301 187 ▶sub _test_methods_for {
Subroutine _test_methods_for: called CC=2 SCAR=7.1
302 187 my ( $self, $thing ) = @_;
303  
304 187 my @filtered = $self->_filtered_test_methods($thing);
305 187 ▶ return uniq(
Branch: 1 branch
BranchTrueFalseTotal
$self->test_configuration->randomize ? : 0 187 187
306 $self->test_configuration->randomize
307 ? shuffle(@filtered)
308 : sort @filtered
309 );
310 }
311  
312 187 ▶sub _filtered_test_methods {
Subroutine _filtered_test_methods: called CC=4 SCAR=13.9
313 187 my ( $self, $thing ) = @_;
314  
315 187 my @method_list = $thing->test_methods;
316 187 ▶ if ( my $include = $self->test_configuration->include ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $include = $self->test_configuration->include) 4 183 187
317 4 @method_list = grep {/$include/} @method_list;
318 }
319 187 ▶ if ( my $exclude = $self->test_configuration->exclude ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $exclude = $self->test_configuration->exclude) 4 183 187
320 4 @method_list = grep { !/$exclude/ } @method_list;
321 }
322  
323 187 ▶ my $test_class = ref $thing ? $thing->test_class : $thing;
Branch: 1 branch
BranchTrueFalseTotal
ref $thing ? : 66 121 187
324 187 return $self->_filter_by_tag(
325 $test_class,
326 \@method_list
327 );
328 }
329  
330 187 ▶sub _filter_by_tag {
Subroutine _filter_by_tag: called CC=9 SCAR=22.0
331 187 my ( $self, $class, $methods ) = @_;
332  
333 187 my @filtered_methods = @$methods;
334 187 ▶ if ( my $include = $self->test_configuration->include_tags ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $include = $self->test_configuration->include_tags) 12 175 187
335 12 my @new_method_list;
336 12 foreach my $method (@filtered_methods) {
337 57 foreach my $tag (@$include) {
338 76 ▶ if (Test::Class::Moose::AttributeRegistry->method_has_tag(
Branch: 1 branch
BranchTrueFalseTotal
if ("Test::Class::Moose::AttributeRegistry"->method_has_tag($class, $method, $tag)) 18 58 76
339 $class, $method, $tag
340 )
341 )
342 {
343 18 push @new_method_list => $method;
344 }
345 }
346 }
347 12 @filtered_methods = @new_method_list;
348 }
349 187 ▶ if ( my $exclude = $self->test_configuration->exclude_tags ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $exclude = $self->test_configuration->exclude_tags) 8 179 187
350 8 my @new_method_list = @filtered_methods;
351 8 foreach my $method (@filtered_methods) {
352 22 foreach my $tag (@$exclude) {
353 25 ▶ if (Test::Class::Moose::AttributeRegistry->method_has_tag(
Branch: 1 branch
BranchTrueFalseTotal
if ("Test::Class::Moose::AttributeRegistry"->method_has_tag($class, $method, $tag)) 8 17 25
354 $class, $method, $tag
355 )
356 )
357 {
358 @new_method_list
359 8 = grep { $_ ne $method } @new_method_list;
360 }
361 }
362 }
363 8 @filtered_methods = @new_method_list;
364 }
365 187 return @filtered_methods;
366 }
367  
368 30 my %TEST_CONTROL_METHODS = map { $_ => 1 } qw/
369 test_startup
370 test_setup
371 test_teardown
372 test_shutdown
373 /;
374  
375 305 ▶sub run_test_control_method {
Subroutine run_test_control_method: called CC=4 SCAR=13.9
Pod documented
376 305 my ( $self, $test_instance, $phase, $report_object ) = @_;
377  
378 305 ▶ local $0 = "$0 - $phase"
Branch: 1 branch
BranchTrueFalseTotal
if $self->test_configuration->set_process_name 12 293 305
379 if $self->test_configuration->set_process_name;
380  
381 305 ▶ $TEST_CONTROL_METHODS{$phase}
Branch: 1 branch
BranchTrueFalseTotal
$TEST_CONTROL_METHODS{$phase} or croak("Unknown test control method ($phase)") 305 0 305
382 or croak("Unknown test control method ($phase)");
383  
384 305 ▶ my %report_args = (
Branch: 1 branch
BranchTrueFalseTotal
$report_object->isa('Test::Class::Moose::Report::Method') ? : 218 87 305
385 name => $phase,
386 instance => (
387 $report_object->isa('Test::Class::Moose::Report::Method')
388 ? $report_object->instance
389 : $report_object
390 )
391 );
392 305 my $phase_method_report
393 = Test::Class::Moose::Report::Method->new( \%report_args );
394  
395 305 my $set_meth = "set_${phase}_method";
396 305 $report_object->$set_meth($phase_method_report);
397  
398 # It'd be nicer to start and end immediately after we call
399 # $test_instance->$phase but we can't guarantee that those calls would
400 # happen inside the try block.
401 305 $phase_method_report->_start_benchmark;
402  
403 305 ▶ my $success = context_do {
Subroutine __ANON__: called CC=1 SCAR=0.0
404 305 my $ctx = shift;
405  
406 305 ▶ return try {
Subroutine __ANON__: called CC=2 SCAR=6.9
407 305 my $count = $ctx->hub->count;
408 305 $test_instance->$phase($report_object);
409 304 ▶ croak "Tests may not be run in test control methods ($phase)"
Branch: 1 branch
BranchTrueFalseTotal
unless $count == $ctx->hub->count 1 303 304
410 unless $count == $ctx->hub->count;
411 303 1;
412 }
413 2 ▶ catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
414 2 my $error = $_;
415 2 my $class = $test_instance->test_class;
416 2 $ctx->ok( 0, "$class->$phase failed", [$error] );
417 2 0;
418 305 };
419 305 };
420  
421 305 $phase_method_report->_end_benchmark;
422  
423 305 return $success;
424 }
425  
426 110 ▶sub run_test_method {
Subroutine run_test_method: called CC=5 SCAR=16.1
Pod documented
427 110 my ( $self, $test_instance, $test_method, $instance_report ) = @_;
428  
429 110 ▶ local $0 = "$0 - $test_method"
Branch: 1 branch
BranchTrueFalseTotal
if $self->test_configuration->set_process_name 3 107 110
430 if $self->test_configuration->set_process_name;
431  
432 110 my $method_report = Test::Class::Moose::Report::Method->new(
433 { name => $test_method, instance => $instance_report } );
434  
435 110 $instance_report->add_test_method($method_report);
436  
437 110 $test_instance->test_skip_clear;
438 110 $self->run_test_control_method(
439 $test_instance,
440 'test_setup',
441 $method_report,
442 );
443  
444 110 $method_report->_start_benchmark;
445  
446 110 my $num_tests = 0;
447 110 my $test_class = $test_instance->test_class;
448  
449 110 ▶ context_do {
Subroutine __ANON__: called CC=6 SCAR=18.0
450 110 my $ctx = shift;
451  
452 110 my $skipped;
453  
454 # If the call to ->$test_method fails then this subtest will fail and
455 # Test2::API will also include a diagnostic message with the error.
456 my $p = async_subtest(
457 $test_method,
458 { manual_skip_all => 1 },
459 110 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
460 110 my $hub = test2_stack()->top;
461 110 ▶ if ( my $message = $test_instance->test_skip ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $message = $test_instance->test_skip) 3 107 110
462 3 $method_report->skipped($message);
463  
464 # I can't figure out how to get our current context in
465 # order to call $ctx->plan instead.
466 3 ▶ context_do {
Subroutine __ANON__: called CC=1 SCAR=0.0
467 3 shift->plan( 0, SKIP => $message );
468 3 };
469 3 $skipped = 1;
470 3 return 1;
471 }
472  
473 107 $test_instance->$test_method($method_report);
474 102 $num_tests = $hub->count;
475 },
476 110 )->finish;
477  
478 110 $method_report->_end_benchmark;
479 110 ▶ if ( $self->test_configuration->show_timing ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->test_configuration->show_timing) 0 110 110
480 0 my $time = $method_report->time->duration;
481 0 $ctx->diag( $method_report->name . ": $time" );
482 }
483  
484 # $p will be undef if the tests failed but we want to stick to 0
485 # or 1.
486 110 ▶ $method_report->passed( $p ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$p ? : 103 7 110
487  
488 110 ▶ if ( !$skipped || $test_instance->run_control_methods_on_skip ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $skipped or $test_instance->run_control_methods_on_skip) 108 2 110
Condition100%3/3
not $skipped or $test_instance->run_control_methods_on_skip
l!l&&r!l&&!r
10712
MC/DC100%2/2
not $skipped or $test_instance->run_control_methods_on_skip
not $skipped $test_instance->run_control_methods_on_skip
Truth table100%3/3
not(A) or B
A= not $skippedB= $test_instance->run_control_methods_on_skip
ABresult
1X1
011
000
489 108 ▶ $self->run_test_control_method(
Branch: 1 branch
BranchTrueFalseTotal
$self->run_test_control_method($test_instance, "test_teardown", $method_report) or $method_report->passed(0) 108 0 108
490 $test_instance,
491 'test_teardown',
492 $method_report,
493 ) or $method_report->passed(0);
494 }
495  
496 110 return $p;
497 110 };
498  
499 110 ▶ return $method_report unless $num_tests && !$method_report->is_skipped;
Branch: 1 branch
BranchTrueFalseTotal
unless $num_tests and not $method_report->is_skipped 8 102 110
Condition66%2/3
$num_tests and not $method_report->is_skipped
!ll&&!rl&&r
80102
MC/DC50%1/2
$num_tests and not $method_report->is_skipped
$num_tests not $method_report->is_skipped
Truth table66%2/3
A and not(B)
A= $num_testsB= not $method_report->is_skipped
ABresult
0X0
100
111
500  
501 102 $method_report->num_tests_run($num_tests);
502 102 ▶ $method_report->tests_planned($num_tests)
Branch: 1 branch
BranchTrueFalseTotal
unless $method_report->has_plan 91 11 102
503 unless $method_report->has_plan;
504  
505 102 return $method_report;
506 }
507  
508 39 ▶sub test_classes {
Subroutine test_classes: called CC=7 SCAR=19.6
Pod documented
509 39 my $self = shift;
510  
511 39 ▶ if ( my $classes = $self->test_configuration->test_classes ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $classes = $self->test_configuration->test_classes) 5 34 39
512 5 ▶ return @{$classes} if @{$classes};
Branch: 1 branch
BranchTrueFalseTotal
if @{$classes;} 5 0 5
513 }
514  
515 34 my %metaclasses = Class::MOP::get_all_metaclasses();
516 34 my @classes;
517 34 foreach my $class ( keys %metaclasses ) {
518 3618 ▶ next if $class eq 'Test::Class::Moose';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "Test::Class::Moose" 34 3584 3618
519 3584 ▶ push @classes => $class if $class->isa('Test::Class::Moose');
Branch: 1 branch
BranchTrueFalseTotal
if $class->isa("Test::Class::Moose") 178 3406 3584
520 }
521  
522 34 ▶ if ( $self->test_configuration->randomize_classes ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->test_configuration->randomize_classes) 0 34 34
523 0 return shuffle(@classes);
524 }
525  
526 34 @classes = sort @classes;
527 34 return @classes;
528 }
529  
530 30 1;
531  
532 __END__
« Moose/AttributeRegistry.pm ↑ Summary Moose/Util.pm »