added a test for the config api
and a fix to the config api
This commit is contained in:
parent
197dacadec
commit
75aed8bbc5
2 changed files with 39 additions and 1 deletions
|
|
@ -115,7 +115,7 @@ The path to the WebGUI installation.
|
|||
sub loadAllConfigs {
|
||||
my $class = shift;
|
||||
my $webguiPath = shift;
|
||||
my $configs = readAllConfigs($webguiPath);
|
||||
my $configs = $class->readAllConfigs($webguiPath);
|
||||
foreach my $filename (keys %{$configs}) {
|
||||
unless ($filename =~ /^demo\d/) {
|
||||
print "\tLoading ".$filename."\n";
|
||||
|
|
|
|||
38
t/Config.t
Normal file
38
t/Config.t
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../lib';
|
||||
use Getopt::Long;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
use WebGUI::Config;
|
||||
use Test::More tests => 6; # increment this value for each test you create
|
||||
|
||||
$|=1;
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
|
||||
my $config = WebGUI::Config->new("..", $configFile);
|
||||
|
||||
ok(defined $config, "load config");
|
||||
ok($config->get("dsn") ne "", "get()");
|
||||
is($config->getFilename,$configFile,"getFilename()");
|
||||
is($config->getWebguiRoot, "..", "getWebguiRoot()");
|
||||
WebGUI::Config->loadAllConfigs("..");
|
||||
ok(exists $WebGUI::Config::config{$configFile}, "loadAllConfigs");
|
||||
ok(defined WebGUI::Config->readAllConfigs(".."), "readAllConfigs");
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue