cleanup tests, make testCodebase.pl work with traditional --configFile syntax
This commit is contained in:
parent
d0fca48a32
commit
9a6e77c4eb
3 changed files with 14 additions and 19 deletions
|
|
@ -13,6 +13,7 @@ $|=1;
|
||||||
use strict;
|
use strict;
|
||||||
use FindBin;
|
use FindBin;
|
||||||
use lib "$FindBin::Bin/../t/lib";
|
use lib "$FindBin::Bin/../t/lib";
|
||||||
|
use File::Spec qw[];
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
|
||||||
my $configFile;
|
my $configFile;
|
||||||
|
|
@ -45,16 +46,23 @@ my $helpmsg=<<STOP;
|
||||||
STOP
|
STOP
|
||||||
|
|
||||||
my $verboseFlag = "-v" if ($verbose);
|
my $verboseFlag = "-v" if ($verbose);
|
||||||
my $config = $ENV{WEBGUI_CONFIG};
|
|
||||||
|
|
||||||
$perlBase .= '/bin/' if ($perlBase);
|
$perlBase .= '/bin/' if ($perlBase);
|
||||||
|
|
||||||
if ( $configFile ) {
|
if ( $configFile ) {
|
||||||
system("WEBGUI_CONFIG=".$configFile." ".$perlBase."prove ".$verboseFlag." -r ../t");
|
if (! -e $configFile) {
|
||||||
exit;
|
##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} ) {
|
} elsif ( defined @ENV{WEBGUI_CONFIG} ) {
|
||||||
system($perlBase."prove ".$verboseFlag." -r ../t");
|
system($perlBase."prove ".$verboseFlag." -r ../t");
|
||||||
exit;
|
|
||||||
} else {
|
} else {
|
||||||
print $helpmsg;
|
print $helpmsg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ SKIP: {
|
||||||
|
|
||||||
foreach my $asset ( @assets ) {
|
foreach my $asset ( @assets ) {
|
||||||
diag("Checking $asset");
|
diag("Checking $asset");
|
||||||
|
eval "use $asset";
|
||||||
my $def = $asset->definition($session);
|
my $def = $asset->definition($session);
|
||||||
my $tableName = $def->[0]->{tableName};
|
my $tableName = $def->[0]->{tableName};
|
||||||
my $classIds = $session->db->buildArrayRef("select distinct(assetId) from asset where className=? order by assetId", [$asset]);
|
my $classIds = $session->db->buildArrayRef("select distinct(assetId) from asset where className=? order by assetId", [$asset]);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
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;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
|
@ -75,18 +75,4 @@ is($session->datetime->timeToSeconds("08:00:00"), 60*60*8, "timeToSeconds()");
|
||||||
"%Y" => "%y"
|
"%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});
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue