cleanup tests, make testCodebase.pl work with traditional --configFile syntax

This commit is contained in:
Colin Kuskie 2006-03-09 01:00:27 +00:00
parent d0fca48a32
commit 9a6e77c4eb
3 changed files with 14 additions and 19 deletions

View file

@ -13,6 +13,7 @@ $|=1;
use strict;
use FindBin;
use lib "$FindBin::Bin/../t/lib";
use File::Spec qw[];
use Getopt::Long;
my $configFile;
@ -45,16 +46,23 @@ my $helpmsg=<<STOP;
STOP
my $verboseFlag = "-v" if ($verbose);
my $config = $ENV{WEBGUI_CONFIG};
$perlBase .= '/bin/' if ($perlBase);
if ( $configFile ) {
system("WEBGUI_CONFIG=".$configFile." ".$perlBase."prove ".$verboseFlag." -r ../t");
exit;
if (! -e $configFile) {
##Probably given the name of the config file with no path, prepend
##the path to it.
$configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$configFile);
}
if (-e $configFile) {
system("WEBGUI_CONFIG=".$configFile." ".$perlBase."prove ".$verboseFlag." -r ../t");
}
else {
die "Unable to use $configFile as a WebGUI config file\n";
}
} elsif ( defined @ENV{WEBGUI_CONFIG} ) {
system($perlBase."prove ".$verboseFlag." -r ../t");
exit;
} else {
print $helpmsg;
}

View file

@ -47,6 +47,7 @@ SKIP: {
foreach my $asset ( @assets ) {
diag("Checking $asset");
eval "use $asset";
my $def = $asset->definition($session);
my $tableName = $def->[0]->{tableName};
my $classIds = $session->db->buildArrayRef("select distinct(assetId) from asset where className=? order by assetId", [$asset]);

View file

@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 63; # increment this value for each test you create
use Test::More tests => 26; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -75,18 +75,4 @@ is($session->datetime->timeToSeconds("08:00:00"), 60*60*8, "timeToSeconds()");
"%Y" => "%y"
);
diag("check WebGUI to DateTime conversion");
foreach my $wg (keys %conversion) {
is( $session->datetime->wgToDt($wg), $conversion{$wg},
sprintf "WG to DT format conversion: %s => %s", $wg, $conversion{$wg});
}
%conversion = reverse %conversion;
delete $conversion{'%_varmonth_'};
diag("check DateTime to WebGUI conversion");
foreach my $dt (keys %conversion) {
is( $session->datetime->dtToWg($dt), $conversion{$dt},
sprintf "WG to DT format conversion: %s => %s", $dt, $conversion{$dt});
}