diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d750239bd..dff84e823 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,10 @@ - fix: Miscellaneous Calendar template fixes - fix: Cannot manageAssets with a locked Thread -- NOTE: Kludgy, but any other 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 - Fixed a problem with IE and resizable text areas that caused IE to crash diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 0f2b1314a..4760099a2 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -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 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 -------------------------------------------------------------------- * The i18n/label.t and help/setHelp.t test now require that you set diff --git a/sbin/testCodebase.pl b/sbin/testCodebase.pl index 09e46dd69..ce2d89e80 100644 --- a/sbin/testCodebase.pl +++ b/sbin/testCodebase.pl @@ -20,11 +20,13 @@ my $configFile; my $help; my $verbose; my $perlBase; +my $noLongTests; GetOptions( 'verbose'=>\$verbose, 'configFile=s'=>\$configFile, 'perl-base=s'=>\$perlBase, + 'noLongTests'=>\$noLongTests, 'help'=>\$help, ); @@ -43,26 +45,31 @@ my $helpmsg=<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"); -} else { - print $helpmsg; +##Defaults to command-line switch +$configFile ||= $ENV{WEBGUI_CONFIG}; + +if (! -e $configFile) { + ##Probably given the name of the config file with no path, + ##attempt to prepend the path to it. + $configFile = File::Spec->canonpath($FindBin::Bin.'/../etc/'.$configFile); } + +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'); + diff --git a/t/Asset/Wobject/Article.t b/t/Asset/Wobject/Article.t index e97ec0162..dc27579a6 100644 --- a/t/Asset/Wobject/Article.t +++ b/t/Asset/Wobject/Article.t @@ -10,6 +10,7 @@ use FindBin; use strict; +use File::Spec; use lib "$FindBin::Bin/../../lib"; ##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 -my $path = $session->config->getWebguiRoot()."/t/supporting_collateral/"; 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 my $storage = WebGUI::Storage::Image->create($session); -system("pwd"); -my $storedFilename = $storage->addFileFromFilesystem($path.$filename); +my $storedFilename = $storage->addFileFromFilesystem($pathedFile); my $filenameOK = is ($storedFilename, $filename, 'storage created correctly'); diag(join("\n", @{ $storage->getErrors })) unless $filenameOK; diff --git a/t/International.t b/t/International.t index 0a5d4183c..40bceba63 100644 --- a/t/International.t +++ b/t/International.t @@ -14,7 +14,8 @@ use lib "$FindBin::Bin/lib"; use WebGUI::Test; use WebGUI::Session; 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; @@ -71,15 +72,19 @@ SKIP: { } sub installPigLatin { - my $wgLib = WebGUI::Test->lib; - mkdir join('/', $wgLib, 'WebGUI/i18n/PigLatin'); - cp 'supporting_collateral/WebGUI.pm', join('/', $wgLib, 'WebGUI/i18n/PigLatin/WebGUI.pm'); - cp 'supporting_collateral/PigLatin.pm', join('/', $wgLib, 'WebGUI/i18n/PigLatin.pm'); + mkdir File::Spec->catdir(WebGUI::Test->lib, 'WebGUI', 'i18n', 'PigLatin'); + copy( + File::Spec->catfile(WebGUI::Test->getTestCollateralPath, 'WebGUI.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: { - my $wgLib = WebGUI::Test->lib; - unlink join('/', $wgLib, 'WebGUI/i18n/PigLatin/WebGUI.pm'); - unlink join('/', $wgLib, 'WebGUI/i18n/PigLatin.pm'); - rmdir join('/', $wgLib, 'WebGUI/i18n/PigLatin'); + unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin WebGUI.pm/); + unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n PigLatin.pm/); + rmdir File::Spec->catdir(WebGUI::Test->lib, qw/WebGUI i18n PigLatin/); } diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index f15c3d2a1..152d0afad 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -3,7 +3,7 @@ package WebGUI::Test; use strict; 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 IO::Handle qw[]; @@ -50,6 +50,7 @@ BEGIN { $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 = 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' ); @@ -107,4 +108,8 @@ sub root { return $WEBGUI_ROOT; } +sub getTestCollateralPath { + return $WEBGUI_TEST_COLLATERAL; +} + 1;