| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Interchange6::Test::Role::SQLite; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Interchange6::Test::Role::SQLite |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7372
|
use Class::Load qw/try_load_class/; |
|
|
1
|
|
|
|
|
16159
|
|
|
|
1
|
|
|
|
|
70
|
|
|
10
|
1
|
|
|
1
|
|
848
|
use File::Temp; |
|
|
1
|
|
|
|
|
14246
|
|
|
|
1
|
|
|
|
|
75
|
|
|
11
|
1
|
|
|
1
|
|
552
|
use Test::Roo::Role; |
|
|
1
|
|
|
|
|
286
|
|
|
|
1
|
|
|
|
|
7
|
|
|
12
|
|
|
|
|
|
|
with 'Interchange6::Test::Role::Database'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
See also L which is consumed by this role. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 BUILD |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Check that all required modules load or else plan skip_all |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
|
25
|
0
|
0
|
|
0
|
1
|
|
try_load_class('DBD::SQLite') |
|
26
|
|
|
|
|
|
|
or plan skip_all => "DBD::SQLite required to run these tests"; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $fh = File::Temp->new( |
|
30
|
|
|
|
|
|
|
TEMPLATE => 'ic6s_test_XXXXX', |
|
31
|
|
|
|
|
|
|
EXLOCK => 0, |
|
32
|
|
|
|
|
|
|
TMPDIR => 1, |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
my $dbfile = $fh->filename; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
after teardown => sub { |
|
37
|
|
|
|
|
|
|
shift->clear_database; |
|
38
|
|
|
|
|
|
|
}; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 clear_database |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Attempt to unlink temporary database file |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub clear_database { |
|
47
|
0
|
|
|
0
|
1
|
|
close($fh); |
|
48
|
0
|
0
|
|
|
|
|
unlink($dbfile) or diag "Could not unlink $dbfile: $!"; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _build_database { |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# does nothing atm for SQLite |
|
54
|
0
|
|
|
0
|
|
|
return; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _build_dbd_version { |
|
58
|
0
|
|
|
0
|
|
|
return "DBD::SQLite $DBD::SQLite::VERSION"; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 connect_info |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns appropriate DBI connect info for this role. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub connect_info { |
|
68
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
return ( "dbi:SQLite:dbname=$dbfile", undef, undef, |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
|
|
|
|
|
|
sqlite_unicode => 1, |
|
73
|
|
|
|
|
|
|
on_connect_call => 'use_foreign_keys', |
|
74
|
|
|
|
|
|
|
on_connect_do => 'PRAGMA synchronous = OFF', |
|
75
|
|
|
|
|
|
|
quote_names => 1, |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _build_database_info { |
|
81
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
82
|
0
|
|
|
|
|
|
return "SQLite library version: " |
|
83
|
|
|
|
|
|
|
. $self->ic6s_schema->storage->dbh->{sqlite_version}; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |