Add a new method to t/lib/WebGUI/Test.pm to return the path to the test
collateral. Update all tests to use the new method. Change testCodebase.pl to run long tests by default. To disable the long tests, use the --noLongTests switch.
This commit is contained in:
parent
40e3967b19
commit
9d0894b674
6 changed files with 55 additions and 29 deletions
|
|
@ -3,6 +3,10 @@
|
||||||
- fix: Miscellaneous Calendar template fixes
|
- fix: Miscellaneous Calendar template fixes
|
||||||
- fix: Cannot manageAssets with a locked Thread -- NOTE: Kludgy, but any other
|
- fix: Cannot manageAssets with a locked Thread -- NOTE: Kludgy, but any other
|
||||||
way would probably have to break API.
|
way would probably have to break API.
|
||||||
|
- t/lib/WebGUI/Test.pm now has a method for returning the path to the
|
||||||
|
test collateral directory. The method is called getTestCollateralPath.
|
||||||
|
Existing tests using that directory have been modified to use the new
|
||||||
|
method instead of finding the path manually.
|
||||||
|
|
||||||
7.3.1
|
7.3.1
|
||||||
- Fixed a problem with IE and resizable text areas that caused IE to crash
|
- Fixed a problem with IE and resizable text areas that caused IE to crash
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,11 @@ upgrading from one version to the next, or even between multiple
|
||||||
versions. Be sure to heed the warnings contained herein as they will
|
versions. Be sure to heed the warnings contained herein as they will
|
||||||
save you many hours of grief.
|
save you many hours of grief.
|
||||||
|
|
||||||
|
7.3.2
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
* The testCodebase.pl script will now automatically set the CODE_COP
|
||||||
|
script unless you give it the --noLongTests switch.
|
||||||
|
|
||||||
7.3.0
|
7.3.0
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
* The i18n/label.t and help/setHelp.t test now require that you set
|
* The i18n/label.t and help/setHelp.t test now require that you set
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,13 @@ my $configFile;
|
||||||
my $help;
|
my $help;
|
||||||
my $verbose;
|
my $verbose;
|
||||||
my $perlBase;
|
my $perlBase;
|
||||||
|
my $noLongTests;
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'verbose'=>\$verbose,
|
'verbose'=>\$verbose,
|
||||||
'configFile=s'=>\$configFile,
|
'configFile=s'=>\$configFile,
|
||||||
'perl-base=s'=>\$perlBase,
|
'perl-base=s'=>\$perlBase,
|
||||||
|
'noLongTests'=>\$noLongTests,
|
||||||
'help'=>\$help,
|
'help'=>\$help,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -43,26 +45,31 @@ my $helpmsg=<<STOP;
|
||||||
use. Defaults to the perl installation in your
|
use. Defaults to the perl installation in your
|
||||||
PATH.
|
PATH.
|
||||||
|
|
||||||
|
--noLongTests Prevent long tests from being run
|
||||||
|
|
||||||
STOP
|
STOP
|
||||||
|
|
||||||
my $verboseFlag = "-v" if ($verbose);
|
my $verboseFlag = "-v" if ($verbose);
|
||||||
|
|
||||||
$perlBase .= '/bin/' if ($perlBase);
|
$perlBase .= '/bin/' if ($perlBase);
|
||||||
|
|
||||||
if ( $configFile ) {
|
##Defaults to command-line switch
|
||||||
if (! -e $configFile) {
|
$configFile ||= $ENV{WEBGUI_CONFIG};
|
||||||
##Probably given the name of the config file with no path, prepend
|
|
||||||
##the path to it.
|
if (! -e $configFile) {
|
||||||
$configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$configFile);
|
##Probably given the name of the config file with no path,
|
||||||
}
|
##attempt to prepend the path to it.
|
||||||
if (-e $configFile) {
|
$configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$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");
|
|
||||||
} else {
|
|
||||||
print $helpmsg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
die "Unable to use $configFile as a WebGUI config file\n"
|
||||||
|
unless(-e $configFile and -f _);
|
||||||
|
|
||||||
|
my $prefix = "WEBGUI_CONFIG=".$configFile;
|
||||||
|
|
||||||
|
##Run all tests unless explicitly forbidden
|
||||||
|
$prefix .= " CODE_COP=1" unless $noLongTests;
|
||||||
|
|
||||||
|
print(join ' ', $prefix, $perlBase."prove", $verboseFlag, '-r ../t'); print "\n";
|
||||||
|
system(join ' ', $prefix, $perlBase."prove", $verboseFlag, '-r ../t');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use FindBin;
|
use FindBin;
|
||||||
use strict;
|
use strict;
|
||||||
|
use File::Spec;
|
||||||
use lib "$FindBin::Bin/../../lib";
|
use lib "$FindBin::Bin/../../lib";
|
||||||
|
|
||||||
##The goal of this test is to test the creation of Article Wobjects.
|
##The goal of this test is to test the creation of Article Wobjects.
|
||||||
|
|
@ -64,13 +65,12 @@ foreach my $newSetting (keys %{$newArticleSettings}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the duplicate method... not for assets, just the extended duplicate functionality of the article wobject
|
# Test the duplicate method... not for assets, just the extended duplicate functionality of the article wobject
|
||||||
my $path = $session->config->getWebguiRoot()."/t/supporting_collateral/";
|
|
||||||
my $filename = "page_title.jpg";
|
my $filename = "page_title.jpg";
|
||||||
|
my $pathedFile = File::Spec->catfile(WebGUI::Test->getTestCollateralPath, $filename);
|
||||||
|
|
||||||
# Use some test collateral to create a storage location and assign it to our article
|
# Use some test collateral to create a storage location and assign it to our article
|
||||||
my $storage = WebGUI::Storage::Image->create($session);
|
my $storage = WebGUI::Storage::Image->create($session);
|
||||||
system("pwd");
|
my $storedFilename = $storage->addFileFromFilesystem($pathedFile);
|
||||||
my $storedFilename = $storage->addFileFromFilesystem($path.$filename);
|
|
||||||
my $filenameOK = is ($storedFilename, $filename, 'storage created correctly');
|
my $filenameOK = is ($storedFilename, $filename, 'storage created correctly');
|
||||||
|
|
||||||
diag(join("\n", @{ $storage->getErrors })) unless $filenameOK;
|
diag(join("\n", @{ $storage->getErrors })) unless $filenameOK;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@ use lib "$FindBin::Bin/lib";
|
||||||
use WebGUI::Test;
|
use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use Test::More; # increment this value for each test you create
|
use Test::More; # increment this value for each test you create
|
||||||
use File::Copy qw(cp);
|
use File::Copy;
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
|
@ -71,15 +72,19 @@ SKIP: {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub installPigLatin {
|
sub installPigLatin {
|
||||||
my $wgLib = WebGUI::Test->lib;
|
mkdir File::Spec->catdir(WebGUI::Test->lib, 'WebGUI', 'i18n', 'PigLatin');
|
||||||
mkdir join('/', $wgLib, 'WebGUI/i18n/PigLatin');
|
copy(
|
||||||
cp 'supporting_collateral/WebGUI.pm', join('/', $wgLib, 'WebGUI/i18n/PigLatin/WebGUI.pm');
|
File::Spec->catfile(WebGUI::Test->getTestCollateralPath, 'WebGUI.pm'),
|
||||||
cp 'supporting_collateral/PigLatin.pm', join('/', $wgLib, 'WebGUI/i18n/PigLatin.pm');
|
File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin WebGUI.pm/)
|
||||||
|
);
|
||||||
|
copy(
|
||||||
|
File::Spec->catfile(WebGUI::Test->getTestCollateralPath, 'PigLatin.pm'),
|
||||||
|
File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin.pm/)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
END: {
|
END: {
|
||||||
my $wgLib = WebGUI::Test->lib;
|
unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin WebGUI.pm/);
|
||||||
unlink join('/', $wgLib, 'WebGUI/i18n/PigLatin/WebGUI.pm');
|
unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin.pm/);
|
||||||
unlink join('/', $wgLib, 'WebGUI/i18n/PigLatin.pm');
|
rmdir File::Spec->catdir(WebGUI::Test->lib, qw/WebGUI i18n PigLatin/);
|
||||||
rmdir join('/', $wgLib, 'WebGUI/i18n/PigLatin');
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package WebGUI::Test;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
our ( $SESSION, $WEBGUI_ROOT, $CONFIG_FILE, $WEBGUI_LIB );
|
our ( $SESSION, $WEBGUI_ROOT, $CONFIG_FILE, $WEBGUI_LIB, $WEBGUI_TEST_COLLATERAL );
|
||||||
|
|
||||||
use Config qw[];
|
use Config qw[];
|
||||||
use IO::Handle qw[];
|
use IO::Handle qw[];
|
||||||
|
|
@ -50,6 +50,7 @@ BEGIN {
|
||||||
$CONFIG_FILE = ( File::Spec->splitpath( $WEBGUI_ROOT ) )[2];
|
$CONFIG_FILE = ( File::Spec->splitpath( $WEBGUI_ROOT ) )[2];
|
||||||
$WEBGUI_ROOT = substr( $WEBGUI_ROOT, 0, index( $WEBGUI_ROOT, File::Spec->catdir( 'etc', $CONFIG_FILE ) ) );
|
$WEBGUI_ROOT = substr( $WEBGUI_ROOT, 0, index( $WEBGUI_ROOT, File::Spec->catdir( 'etc', $CONFIG_FILE ) ) );
|
||||||
$WEBGUI_ROOT = File::Spec->canonpath($WEBGUI_ROOT);
|
$WEBGUI_ROOT = File::Spec->canonpath($WEBGUI_ROOT);
|
||||||
|
$WEBGUI_TEST_COLLATERAL = File::Spec->catdir($WEBGUI_ROOT, 't', 'supporting_collateral');
|
||||||
|
|
||||||
$WEBGUI_LIB ||= File::Spec->catpath( (File::Spec->splitpath($WEBGUI_ROOT))[0], $WEBGUI_ROOT, 'lib' );
|
$WEBGUI_LIB ||= File::Spec->catpath( (File::Spec->splitpath($WEBGUI_ROOT))[0], $WEBGUI_ROOT, 'lib' );
|
||||||
|
|
||||||
|
|
@ -107,4 +108,8 @@ sub root {
|
||||||
return $WEBGUI_ROOT;
|
return $WEBGUI_ROOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub getTestCollateralPath {
|
||||||
|
return $WEBGUI_TEST_COLLATERAL;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue