File Coverage

blib/lib/Class/Scaffold/Test.pm
Criterion Covered Total %
statement 30 32 93.7
branch n/a
condition n/a
subroutine 10 11 90.9
pod 3 3 100.0
total 43 46 93.4


line stmt bran cond sub pod time code
1 1     1   573 use 5.008;
  1         4  
  1         44  
2 1     1   5 use warnings;
  1         2  
  1         24  
3 1     1   4 use strict;
  1         2  
  1         45  
4              
5             package Class::Scaffold::Test;
6             BEGIN {
7 1     1   15 $Class::Scaffold::Test::VERSION = '1.102280';
8             }
9             # ABSTRACT: Base classes for framework test classes
10 1     1   6 use Test::More;
  1         2  
  1         6  
11 1     1   1247 use Class::Value; # see run() below
  1         19457  
  1         13  
12              
13             # Also inherit from Class::Scaffold::Base so we get a delegate; put it first
14             # so its new() is found, not the very basic new() from Project::Build::Test
15 1         7 use parent qw(
16             Class::Scaffold::Base
17             Test::CompanionClasses::Base
18 1     1   56 );
  1         3  
19 1     1   2836 use constant PLAN => 1;
  1         3  
  1         161  
20              
21             sub obj_ok {
22 0     0 1 0 my ($self, $object, $object_type_const) = @_;
23 0         0 isa_ok($object, $self->delegate->get_class_name_for($object_type_const));
24             }
25              
26             # Override planned_test_count() with a version that uses every_list().
27             # Project::Build::Test->planned_test_count() couldn't use that because
28             # every_list() is implemented in Data::Inherited, which in turn uses
29             # Project::Build.
30             sub planned_test_count {
31 4     4 1 95 my $self = shift;
32 4         6 my $plan;
33              
34             # so that PLANs can use the delegate:
35 4         63 $::delegate = $self->delegate;
36 4         43 $plan += $_ for $self->every_list('PLAN');
37 4         3026 $plan;
38             }
39              
40             sub run {
41 4     4 1 9 my $self = shift;
42 4         72 $self->SUPER::run(@_);
43              
44             # check that test prerequisites are ok
45 4         23 is($Class::Value::SkipChecks, 1, '$Class::Value::SkipChecks is on');
46             }
47             1;
48              
49              
50             __END__