packaging one directory
|
1 |
use Test::More; |
2 |
use strict; |
|
3 |
use warnings; |
|
4 |
|
|
5 |
# user password database |
|
6 |
our ($USER, $PASSWORD, $DATABASE) = connect_info(); |
|
7 |
|
|
8 |
plan skip_all => 'private MySQL test' unless $USER; |
|
9 |
|
|
10 |
plan 'no_plan'; |
|
11 |
|
|
12 |
# Function for test name |
|
13 |
my $test; |
|
14 |
sub test { |
|
15 |
$test = shift; |
|
16 |
} |
|
17 |
|
|
18 |
|
|
19 |
# Functions for tests |
|
20 |
sub connect_info { |
|
21 |
my $file = 'password.tmp'; |
|
22 |
open my $fh, '<', $file |
|
23 |
or return; |
|
24 |
|
|
25 |
my ($user, $password, $database) = split(/\s/, (<$fh>)[0]); |
|
26 |
|
|
27 |
close $fh; |
|
28 |
|
|
29 |
return ($user, $password, $database); |
|
30 |
} |
|
31 |
|
|
32 |
|
|
33 |
# Constat variables for tests |
|
34 |
my $CLASS = 'DBIx::Custom::MySQL'; |
|
35 |
|
|
36 |
# Varialbes for tests |
|
37 |
my $dbi; |
|
38 |
|
|
39 |
use DBIx::Custom::MySQL; |
|
40 |
|
|
41 |
test 'connect'; |
|
42 |
$dbi = $CLASS->new(user => $USER, password => $PASSWORD, |
|
43 |
database => $DATABASE); |
|
44 |
$dbi->connect; |
|
45 |
is(ref $dbi->dbh, 'DBI::db', $test); |
|
46 |
|
|
47 |
|