1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use strict; |
use strict; |
4 |
use Test::More tests => 12; |
use lib 'lib'; |
|
use Test::Exception; |
|
|
use blib; |
|
5 |
|
|
6 |
use Data::Dump qw/dump/; |
use Test::More tests => 28; |
|
use Cwd qw/abs_path/; |
|
7 |
|
|
8 |
BEGIN { |
BEGIN { |
9 |
|
use_ok( 'WebPAC::Test' ); |
10 |
use_ok( 'WebPAC::Config' ); |
use_ok( 'WebPAC::Config' ); |
11 |
} |
} |
12 |
|
|
|
my $debug = shift @ARGV; |
|
|
|
|
|
ok(my $abs_path = abs_path($0), "abs_path"); |
|
|
$abs_path =~ s#/[^/]*$#/#; |
|
|
|
|
13 |
my $path = "$abs_path/conf/test.yml"; |
my $path = "$abs_path/conf/test.yml"; |
14 |
|
|
15 |
ok(my $config = new WebPAC::Config( path => $path ), "new"); |
ok(my $config = new WebPAC::Config( path => $path ), "new"); |
33 |
diag "inputs = ",dump( @inputs ) if ($debug); |
diag "inputs = ",dump( @inputs ) if ($debug); |
34 |
isa_ok(\@inputs, 'ARRAY', "inputs"); |
isa_ok(\@inputs, 'ARRAY', "inputs"); |
35 |
cmp_ok(@inputs, '==', 2, "got 2 webpac inputs"); |
cmp_ok(@inputs, '==', 2, "got 2 webpac inputs"); |
36 |
|
|
37 |
|
$config->iterate_inputs(sub { |
38 |
|
my ($input,$database,$db_config) = @_; |
39 |
|
isa_ok($input, 'HASH', 'input'); |
40 |
|
ok($database, 'database'); |
41 |
|
isa_ok($db_config, 'HASH', 'database config'); |
42 |
|
isa_ok($input->{normalize}, 'ARRAY', 'normalize'); |
43 |
|
}); |