All test sessions are automatically outfitted with a PseudoRequest object.

Check to see if there is an exportPath defined in the config file, if
not, safely skip all of the tests.
This commit is contained in:
Colin Kuskie 2008-04-21 19:10:19 +00:00
parent a5b06fdfbd
commit 404258f7c6

View file

@ -33,17 +33,26 @@ use Test::Deep;
#----------------------------------------------------------------------------
# Init
my $session = WebGUI::Test->session;
$session->{_request} = WebGUI::PseudoRequest->new();
#----------------------------------------------------------------------------
# Tests
plan tests => 145; # Increment this number for each test you create
my $configExportPath = $session->config->get('exportPath');
my $testRan = 1;
if ($configExportPath) {
plan tests => 145; # Increment this number for each test you create
}
else {
$testRan = 0;
plan skip_all => 'No exportPath in the config file';
}
#----------------------------------------------------------------------------
# exportCheckPath()
my $e;
# ensure exportCheckPath barfs if not given a session as its first argument.
@ -977,17 +986,18 @@ is($home->exportGetUrlAsPath->absolute->stringify, readlink $rootUrlSymlink->abs
#----------------------------------------------------------------------------
# Cleanup
END {
if ($testRan) {
# remove $tempDirectory since it now exists in the filesystem
rmtree($tempDirectory);
# remove $tempDirectory since it now exists in the filesystem
rmtree($tempDirectory);
# restore the original exportPath setting, now that we're done testing
# exportCheckPath.
$session->config->set('exportPath', $originalExportPath);
# restore the original exportPath setting, now that we're done testing
# exportCheckPath.
$session->config->set('exportPath', $originalExportPath);
# we created a couple of assets; roll them back so they don't stick around
$versionTag->rollback();
# we created a couple of assets; roll them back so they don't stick around
$versionTag->rollback();
# make sure people can view /home
$home->update( { groupIdView => 7 } ); # everyone
# make sure people can view /home
$home->update( { groupIdView => 7 } ); # everyone
}
}