DBIx-Custom / t / dbix-custom-mysql-private.t /
Newer Older
52 lines | 1.021kb
packaging one directory
yuki-kimoto authored on 2009-11-16
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

            
update document
yuki-kimoto authored on 2010-05-27
47
test 'attributes';
48
$dbi = DBIx::Custom::MySQL->new;
49
$dbi->host('a');
50
is($dbi->host, 'a', "$test: host");
51
$dbi->port('b');
52
is($dbi->port, 'b', "$test: port");