lib/Reaction/Test/WithDB.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 96.5% 28 / 29 CC 2 SCAR 2.9
CC
2
Cov
96%
BUILD
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/Reaction/UI/Widget/SiteLayout.pm ↑ Summary lib/Reaction/Types/File.pm »
1 package Reaction::Test::WithDB;
2  
3 3 ▶use base qw/Reaction::Test/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 has 'schema' => (
7 isa => 'DBIx::Class::Schema', is => 'rw',
8 set_or_lazy_build('schema')
9 );
10  
11 3 has 'schema_class' => (
12 isa => 'Str', is => 'rw', set_or_lazy_fail('schema_class')
13 );
14  
15 has 'connect_info' => (
16 isa => 'ArrayRef', is => 'rw', required => 1, lazy => 1,
17 2 ▶ default => sub { [ 'dbi:SQLite:t/var/reaction_test_withdb.db' ] },
Subroutine __ANON__: called CC=1 SCAR=0.0
18 3 );
19  
20 2 ▶override 'new' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
21 2 my $self = super();
22 2 $self->BUILDALL;
23 2 return $self;
24 3 };
25  
26 2 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=7.0
Pod documented
27 2 my ($self) = @_;
28 2 my $schema = $self->schema_class->connect(@{$self->connect_info});
29 2 $schema->deploy({ add_drop_table => 1 });
30 2 ▶ $schema->setup_test_data if $schema->can('setup_test_data');
Branch: 1 branch
BranchTrueFalseTotal
if $schema->can("setup_test_data") 2 0 2
31 2 $self->schema($schema);
32 }
33  
34 3 1;
35  
36 =head1 NAME
37  
38 Reaction::Test::WithDB
39  
40 =head1 DESCRIPTION
41  
42 =head2 new
43  
44 =head2 BUILD
45  
46 Deploys database schema, dropping tables if they already exist.
47  
48 =head1 ATTRIBUTES
49  
50 =head2 schema
51  
52 L<DBIx::Class::Schema>
53  
54 =head2 schema_class
55  
56 =head2 connect_info
57  
58 Uses C<[ dbi:SQLite:t/var/reaction_test_withdb.db ]> by default.
59  
60 =head1 SEE ALSO
61  
62 L<Reaction::Test>
63  
64 =head1 AUTHORS
65  
66 See L<Reaction::Class> for authors.
67  
68 =head1 LICENSE
69  
70 See L<Reaction::Class> for the license.
71  
72 =cut
« lib/Reaction/UI/Widget/SiteLayout.pm ↑ Summary lib/Reaction/Types/File.pm »