From dae8e37ad14df81820ac87b2f06216caf5db1250 Mon Sep 17 00:00:00 2001 From: Vadim Belman Date: Sun, 6 Mar 2016 23:26:30 -0500 Subject: [PATCH] Item13897: Getting rid of ->finish() calls. --- .../test/unit/ExtensionInstallerTests.pm | 19 +-- UnitTestContrib/test/unit/Fn_FORMAT.pm | 3 +- UnitTestContrib/test/unit/Fn_FORMFIELD.pm | 7 +- UnitTestContrib/test/unit/Fn_GROUPINFO.pm | 21 ++- UnitTestContrib/test/unit/Fn_GROUPS.pm | 11 +- UnitTestContrib/test/unit/Fn_IF.pm | 17 +-- UnitTestContrib/test/unit/Fn_INCLUDE.pm | 1 - UnitTestContrib/test/unit/Fn_QUERY.pm | 9 -- UnitTestContrib/test/unit/Fn_REVINFO.pm | 25 +--- UnitTestContrib/test/unit/Fn_SEARCH.pm | 121 +++++++-------- UnitTestContrib/test/unit/Fn_SECTION.pm | 2 +- UnitTestContrib/test/unit/Fn_TOPICLIST.pm | 8 +- UnitTestContrib/test/unit/Fn_USERINFO.pm | 5 +- UnitTestContrib/test/unit/Fn_VAR.pm | 4 +- UnitTestContrib/test/unit/Fn_WEBLIST.pm | 8 +- UnitTestContrib/test/unit/FormDefTests.pm | 42 ++---- UnitTestContrib/test/unit/FormattingTests.pm | 16 +- UnitTestContrib/test/unit/FuncTests.pm | 62 ++++---- UnitTestContrib/test/unit/FuncUsersTests.pm | 19 ++- .../test/unit/HTMLValidationTests.pm | 2 - .../test/unit/HierarchicalWebsTests.pm | 48 +++--- UnitTestContrib/test/unit/ManageDotPmTests.pm | 20 +-- UnitTestContrib/test/unit/MetaTests.pm | 43 ++---- .../test/unit/PluginHandlerTests.pm | 4 +- UnitTestContrib/test/unit/PrefsTests.pm | 2 +- UnitTestContrib/test/unit/RegisterTests.pm | 26 ++-- UnitTestContrib/test/unit/RenameTests.pm | 139 +++++++++--------- UnitTestContrib/test/unit/SaveScriptTests.pm | 49 ++---- UnitTestContrib/test/unit/TOCTests.pm | 10 +- UnitTestContrib/test/unit/VariableTests.pm | 1 - UnitTestContrib/test/unit/ViewScriptTests.pm | 29 ++-- core/lib/Foswiki.pm | 2 + core/lib/Foswiki/Configure/Package.pm | 1 - core/lib/Foswiki/Exception.pm | 5 + core/lib/Foswiki/Object.pm | 4 +- core/lib/Foswiki/Plugin.pm | 2 +- core/lib/Foswiki/Plugins.pm | 14 +- core/lib/Foswiki/Request/Upload.pm | 13 +- core/lib/Foswiki/Tables/Table.pm | 3 +- 39 files changed, 351 insertions(+), 466 deletions(-) diff --git a/UnitTestContrib/test/unit/ExtensionInstallerTests.pm b/UnitTestContrib/test/unit/ExtensionInstallerTests.pm index 4b07e1d93a..dc93cc27da 100644 --- a/UnitTestContrib/test/unit/ExtensionInstallerTests.pm +++ b/UnitTestContrib/test/unit/ExtensionInstallerTests.pm @@ -73,16 +73,16 @@ around set_up => sub { $this->createNewFoswikiSession( $this->user ); $this->test_web('Testsystemweb1234'); my $webObject = $this->populateNewWeb( $this->test_web ); - $webObject->finish(); + undef $webObject; $this->trash_web('Testtrashweb1234'); $webObject = $this->populateNewWeb( $this->trash_web ); - $webObject->finish(); + undef $webObject; $this->sandbox_web('Testsandboxweb1234'); $webObject = $this->populateNewWeb( $this->sandbox_web ); - $webObject->finish(); + undef $webObject; $this->sandbox_subweb('Testsandboxweb1234/Subweb'); $webObject = $this->populateNewWeb( $this->sandbox_subweb ); - $webObject->finish(); + undef $webObject; $this->tempdir( $Foswiki::cfg{TempfileDir} . '/test_ConfigureTests' ); rmtree( $this->tempdir ) if ( -e $this->tempdir ); # Cleanup any old tests @@ -966,7 +966,7 @@ sub test_Package_makeBackup { notes => $this->toolsdir . "/shbtest2" ); - $pkg->finish(); + undef $pkg; return; } @@ -1225,7 +1225,6 @@ DONE $this->assert_matches( qr/Foswiki::Plugins::TriggerSyntaxError.*-- syntax error/ms, $missing ); - $pkg->finish(); undef $pkg; } @@ -1267,7 +1266,6 @@ DONE $this->sniff(); $this->assert( $pkg->uninstall($reporter) ); $this->sniff(); - $pkg->finish(); undef $pkg; # @@ -1353,7 +1351,6 @@ DONE '#! /usr/bin/perl' ); - $pkg->finish(); undef $pkg; # Clean out and restart the reporter @@ -1541,7 +1538,6 @@ qr/^Foswiki::Contrib::OptionalDependency version >=14754 required(.*)[- ]+perl m notes => $this->toolsdir . "/shbtest2", ); - $pkg2->finish(); undef $pkg2; eval { rmtree($tempdir) }; @@ -1579,7 +1575,6 @@ DONE $this->assert( $pkg->uninstall($reporter) ); $this->sniff(); - $pkg->finish(); undef $pkg; # @@ -1667,7 +1662,6 @@ qr/Foswiki::Plugins::RequiredTriggeredModule version >=0.1 required[- ]+perl mod warnings => "htmldoc is type 'c', and cannot be automatically checked." ); - $pkg->finish(); undef $pkg; eval { rmtree($tempdir) }; @@ -1912,7 +1906,6 @@ sub test_Package_loadInstaller { $this->assert_str_equals( '1', $plugins{EmptyPlugin}, 'Failed to discover plugin in manifest' ); - $pkg->finish(); undef $pkg; return; @@ -2012,7 +2005,6 @@ DONE $this->sniff( errors => 'Failed to unpack archive(.*)MyPlugin.tgz' ); unlink $tempdir . "/MyPlugin.tgz"; - $pkg->finish(); undef $pkg; return; @@ -2072,7 +2064,6 @@ DONE $this->assert( !$pkg->install($reporter) ); $this->sniff( errors => '(format error|unzip failed|Unpack failed)' ); unlink $tempdir . "/MyPlugin.zip"; - $pkg->finish(); undef $pkg; return; diff --git a/UnitTestContrib/test/unit/Fn_FORMAT.pm b/UnitTestContrib/test/unit/Fn_FORMAT.pm index ccfdd61681..734ac0207d 100644 --- a/UnitTestContrib/test/unit/Fn_FORMAT.pm +++ b/UnitTestContrib/test/unit/Fn_FORMAT.pm @@ -231,7 +231,6 @@ HERE } ); $topicObject->save(); - $topicObject->finish(); } sub test_same_topic_listed_twice { @@ -357,7 +356,7 @@ sub test_formatOfLinks { Apache is the [[http://www.apache.org/httpd/][well known web server]]. HERE $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( diff --git a/UnitTestContrib/test/unit/Fn_FORMFIELD.pm b/UnitTestContrib/test/unit/Fn_FORMFIELD.pm index b4fbf30e95..98aa43ea30 100644 --- a/UnitTestContrib/test/unit/Fn_FORMFIELD.pm +++ b/UnitTestContrib/test/unit/Fn_FORMFIELD.pm @@ -37,7 +37,7 @@ sub _createTopic { | Summary | textarea | 100 | FORM $formTopicObject->save(); - $formTopicObject->finish(); + undef $formTopicObject; $topicObject->put( 'FORM', { name => 'TestForm' } ); $topicObject->putKeyed( 'FIELD', @@ -170,7 +170,7 @@ sub test_FORMFIELD_topic { $result = $topicObject->expandMacros( '%FORMFIELD{"Marjorie" topic="' . $this->test_topic . '"}%' ); $this->assert_str_equals( '99', $result ); - $topicObject->finish; + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $Foswiki::cfg{SystemWebName}, $Foswiki::cfg{HomeTopicName} ); $result = $topicObject->expandMacros( @@ -182,7 +182,6 @@ sub test_FORMFIELD_topic { . $this->test_topic . '"}%' ); $this->assert_str_equals( '99', $result ); - $topicObject->finish; } # web="..." @@ -192,7 +191,7 @@ sub test_FORMFIELD_web { # create other web $this->other_web( $this->test_web . "other" ); my $webObject = $this->populateNewWeb( $this->other_web ); - $webObject->finish(); + undef $webObject; my ($topicObject) = Foswiki::Func::readTopic( $this->other_web, $this->test_topic ); $this->_createTopic( $this->other_web, $topicObject ); diff --git a/UnitTestContrib/test/unit/Fn_GROUPINFO.pm b/UnitTestContrib/test/unit/Fn_GROUPINFO.pm index 8fc098c227..6ec5dc490c 100644 --- a/UnitTestContrib/test/unit/Fn_GROUPINFO.pm +++ b/UnitTestContrib/test/unit/Fn_GROUPINFO.pm @@ -28,49 +28,48 @@ around set_up => sub { Foswiki::Func::readTopic( $this->users_web, "GropeGroup" ); $topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "PopGroup" ); $topicObject->text(" * Set GROUP = WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "NobodyGroup" ); $topicObject->text(" * Set GROUP = \n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "NestingGroup" ); $topicObject->text(" * Set GROUP = GropeGroup\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "OnlyAdminCanChangeGroup" ); $topicObject->text( " * Set GROUP = WikiGuest\n * Set TOPICCHANGE = AdminGroup\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "GroupWithHiddenGroup" ); $topicObject->text(" * Set GROUP = HiddenGroup,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HiddenGroup" ); $topicObject->text( " * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HiddenUserGroup" ); $topicObject->text(" * Set GROUP = ScumBag,HidemeGood\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HidemeGood" ); my $topText = $topicObject->text(); $topText .= " * Set ALLOWTOPICVIEW = AdminUser\n"; $topText = $topicObject->text($topText); $topicObject->save(); - $topicObject->finish(); }; sub test_basic { @@ -226,7 +225,7 @@ sub test_expandHiddenUserAsAdmin { my $this = shift; $this->createNewFoswikiSession( $Foswiki::cfg{AdminUserLogin} ); - $this->test_topicObject->finish if $this->test_topicObject; + $this->clear_test_topicObject; $this->test_topicObject( Foswiki::Func::readTopic( $this->test_web, $this->test_topic ) ); $this->test_topicObject->text("BLEEGLE\n"); @@ -240,7 +239,7 @@ sub test_expandHiddenUserAsAdmin { $this->assert_matches( qr/$users_web.HidemeGood/, $ui ); my @u = split( /,/, $ui ); $this->assert_equals( 2, scalar(@u) ); - $this->test_topicObject->finish; + $this->clear_test_topicObject; return; } diff --git a/UnitTestContrib/test/unit/Fn_GROUPS.pm b/UnitTestContrib/test/unit/Fn_GROUPS.pm index ddaef83f38..a8f4e9d7db 100644 --- a/UnitTestContrib/test/unit/Fn_GROUPS.pm +++ b/UnitTestContrib/test/unit/Fn_GROUPS.pm @@ -23,37 +23,36 @@ around set_up => sub { Foswiki::Func::readTopic( $this->users_web, "GropeGroup" ); $topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "NestingGroup" ); $topicObject->text(" * Set GROUP = GropeGroup\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "GroupWithHiddenGroup" ); $topicObject->text(" * Set GROUP = HiddenGroup,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HiddenGroup" ); $topicObject->text( " * Set GROUP = ScumBag\n * Set ALLOWTOPICVIEW = AdminUser\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HiddenUserGroup" ); $topicObject->text(" * Set GROUP = ScumBag,HidemeGood\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "HidemeGood" ); my $topText = $topicObject->text(); $topText .= " * Set ALLOWTOPICVIEW = AdminUser\n"; $topText = $topicObject->text($topText); $topicObject->save(); - $topicObject->finish(); }; diff --git a/UnitTestContrib/test/unit/Fn_IF.pm b/UnitTestContrib/test/unit/Fn_IF.pm index faebcb9ff1..962fa4c992 100644 --- a/UnitTestContrib/test/unit/Fn_IF.pm +++ b/UnitTestContrib/test/unit/Fn_IF.pm @@ -1316,14 +1316,13 @@ sub set_up { . Foswiki::Func::getWikiName( $this->session->user ) . "\n" ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; # Create WebHome topic to trap existance errors related to # normalizeWebTopicName ($topicObject) = Foswiki::Func::readTopic( $this->test_web, "WebHome" ); $topicObject->text("Gormless gimboid\n"); $topicObject->save(); - $topicObject->finish(); return; } @@ -1374,7 +1373,7 @@ two %IF{ "$ NAME='%NAME%'" then="1" else="0" }% three %IF{ "$ NAME=$ 'NAME{}'" then="1" else="0" }% SMELL $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $text = <<'PONG'; %INCLUDE{"DeadHerring" NAME="Red" warn="on"}% PONG @@ -1419,7 +1418,7 @@ one %IF{ "BleaghForm.Wibble='Woo'" then="1" else="0" }% %META:FIELD{name="Wibble" title="Wobble" value="Woo"}% SMELL $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $text = <<'PONG'; %INCLUDE{"DeadHerring" NAME="Red" warn="on"}% PONG @@ -1438,7 +1437,7 @@ sub test_ALLOWS_and_EXISTS { * Set ALLOWTOPICCHANGE = $wn PONG $meta->save(); - $meta->finish(); + undef $meta; my @tests; push( @@ -1587,7 +1586,7 @@ PONG $this->assert_str_equals( $test->{expect}, $result, "$text: '$result'" ); } - $meta->finish(); + undef $meta; return; } @@ -1601,7 +1600,7 @@ PONG Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $topicObject->text($text); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros($text); $this->assert_str_equals( " * Set LOOP = pong\n", $result ); @@ -1618,7 +1617,7 @@ sub test_TOPICINFO { oneapeny twoapenny we all fall down PONG $meta->save(); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, $topicName ); $meta->getRevisionInfo(); @@ -1689,7 +1688,7 @@ PONG $this->assert_str_equals( $test->{expect}, $result, "$text: '$result'" ); } - $meta->finish(); + undef $meta; return; } diff --git a/UnitTestContrib/test/unit/Fn_INCLUDE.pm b/UnitTestContrib/test/unit/Fn_INCLUDE.pm index 544b7859a3..9abb9ddd42 100644 --- a/UnitTestContrib/test/unit/Fn_INCLUDE.pm +++ b/UnitTestContrib/test/unit/Fn_INCLUDE.pm @@ -26,7 +26,6 @@ around set_up => sub { $orig->( $this, @_ ); $this->other_web( $this->test_web . "other" ); my $webObject = $this->populateNewWeb( $this->other_web ); - $webObject->finish(); }; around tear_down => sub { diff --git a/UnitTestContrib/test/unit/Fn_QUERY.pm b/UnitTestContrib/test/unit/Fn_QUERY.pm index 5c0af1e067..b866fafd3c 100644 --- a/UnitTestContrib/test/unit/Fn_QUERY.pm +++ b/UnitTestContrib/test/unit/Fn_QUERY.pm @@ -176,7 +176,6 @@ Woo Woo whatsnot.gif,World.gif THIS - $topicObject->finish(); } sub test_perl { @@ -222,7 +221,6 @@ PONG ], $result ); - $topicObject->finish(); } sub test_json { @@ -264,7 +262,6 @@ PONG ] THIS } - $topicObject->finish(); } #style defaults to Simplified (ie style=default) @@ -292,7 +289,6 @@ Woo Woo whatsnot.gif,World.gif THIS - $topicObject->finish(); } sub test_ref { @@ -318,7 +314,6 @@ PONG BleaghForm whatsnot.gif,World.gif THIS - $topicObject->finish(); } sub test_cfg { @@ -499,10 +494,6 @@ PONG $this->assert_equals( <finish(); - $topicObject0Att->finish(); - $topicObject2Att->finish(); } sub test_FormTypes { diff --git a/UnitTestContrib/test/unit/Fn_REVINFO.pm b/UnitTestContrib/test/unit/Fn_REVINFO.pm index 13762d1921..f586dc060d 100644 --- a/UnitTestContrib/test/unit/Fn_REVINFO.pm +++ b/UnitTestContrib/test/unit/Fn_REVINFO.pm @@ -32,11 +32,10 @@ around set_up => sub { Foswiki::Func::readTopic( $this->users_web, "GropeGroup" ); $topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, "GlumDrop" ); $topicObject->text("Burble\n"); $topicObject->save(); - $topicObject->finish(); return; }; @@ -68,7 +67,6 @@ sub test_basic2 { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -85,7 +83,6 @@ sub test_basic3 { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -103,7 +100,6 @@ sub test_thisWebVars { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -121,7 +117,6 @@ sub BROKENtest_thisTopicVars { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -139,7 +134,6 @@ sub BROKENtest_thisWebTopicVars { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -159,7 +153,6 @@ sub test_otherWeb { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -178,7 +171,6 @@ sub test_otherWeb2 { { $this->assert( 0, $ui ); } - $topicObject->finish(); return; } @@ -196,7 +188,6 @@ sub test_formatUser { . $this->test_user_wikiname, $ui ); - $topicObject->finish(); return; } @@ -214,7 +205,6 @@ sub test_std_escapes { . $this->test_user_wikiname . ">", $ui ); - $topicObject->finish(); return; } @@ -242,12 +232,11 @@ sub test_compatibility1 { } ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'CrikeyMoses' ); my $ui = $topicObject->expandMacros('%REVINFO{format="$username $wikiname"}%'); $this->assert_str_equals( "scum ScumBag", $ui ); - $topicObject->finish(); return; } @@ -274,12 +263,11 @@ sub test_compatibility2 { } ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'CrikeyMoses' ); my $ui = $topicObject->expandMacros('%REVINFO{format="$username $wikiname"}%'); $this->assert_str_equals( "scum ScumBag", $ui ); - $topicObject->finish(); return; } @@ -314,7 +302,6 @@ HERE $ui = $topicObject->expandMacros( '%REVINFO{format="$username $wikiname $wikiusername"}%'); $this->assert_str_equals( "unknown unknown unknown", $ui ); - $topicObject->finish(); return; } @@ -325,7 +312,7 @@ sub test_42 { Foswiki::Func::readTopic( $this->test_web, "HappyPill" ); $topicObject->text(" * Set ALLOWTOPICVIEW = CarlosCastenada\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->createNewFoswikiSession(); ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'GlumDrop' ); my $ui = $topicObject->expandMacros( @@ -334,7 +321,6 @@ sub test_42 { . '.HappyPill" format="$username $wikiname $wikiusername"}%', ); $this->assert( $ui =~ m/No permission to view/ ); - $topicObject->finish(); return; } @@ -349,7 +335,6 @@ sub test_CaseSensitiveFormatString { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'GlumDrop' ); my $ui = $topicObject->expandMacros( '%REVINFO{format="$DATE"}%', ); $this->assert_str_equals( '$DATE', $ui ); - $topicObject->finish(); return; } @@ -401,7 +386,6 @@ OFNIVER $y = $topicObject->expandMacros("%REVINFO{\"$tf\"}%"); $this->assert_str_equals( $x, $y ); } - $topicObject->finish(); return; } @@ -419,7 +403,6 @@ sub test_Item10476 { my $epoch = $topicObject->expandMacros('%REVINFO{"$epoch"}%'); my $expected = Foswiki::Time::formatTime( $epoch, $format ); $this->assert_str_equals( $ui, $expected ); - $topicObject->finish(); return; } diff --git a/UnitTestContrib/test/unit/Fn_SEARCH.pm b/UnitTestContrib/test/unit/Fn_SEARCH.pm index 8bec7a6008..6fd447b518 100644 --- a/UnitTestContrib/test/unit/Fn_SEARCH.pm +++ b/UnitTestContrib/test/unit/Fn_SEARCH.pm @@ -58,21 +58,21 @@ around set_up => sub { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, $AElig ); $topicObject->text("BLEEGLE blah/matchme.blah"); $topicObject->save( forcedate => $timestamp + 120 ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'OkATopic' ); $topicObject->text("BLEEGLE dontmatchme.blah"); $topicObject->save( forcedate => $timestamp + 240 ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'OkBTopic' ); $topicObject->text("BLEEGLE dont.matchmeblah"); $topicObject->save( forcedate => $timestamp + 480 ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, $this->toSiteCharSet('SomeOtherÆØÅTopic') ); $topicObject->text("forrin speak"); $topicObject->save( forcedate => $timestamp + 720 ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'InvisibleTopic' ); @@ -80,7 +80,7 @@ around set_up => sub { $topicObject->putKeyed( 'PREFERENCE', { name => 'ALLOWTOPICVIEW', value => 'OnlySuperman' } ); $topicObject->save( forcedate => $timestamp + 480 ); - $topicObject->finish(); + undef $topicObject; return; }; @@ -350,21 +350,21 @@ sub verify_scope_all_type_word { Foswiki::Func::readTopic( $this->test_web, 'VirtualBeer' ); $topicObject->text("There are alot of Virtual Beers to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'RealBeer' ); $topicObject->text("There are alot of Virtual Beer to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'FamouslyBeered' ); $topicObject->text( "Virtually speaking there could be alot of famous Beers"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'VirtualLife' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -388,21 +388,21 @@ sub verify_scope_all_type_keyword { Foswiki::Func::readTopic( $this->test_web, 'VirtualBeer' ); $topicObject->text("There are alot of Virtual Beers to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'RealBeer' ); $topicObject->text("There are alot of Virtual Beer to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'FamouslyBeered' ); $topicObject->text( "Virtually speaking there could be alot of famous Beers"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'VirtualLife' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -427,21 +427,21 @@ sub verify_scope_all_type_literal { Foswiki::Func::readTopic( $this->test_web, 'VirtualBeer' ); $topicObject->text("There are alot of Virtual Beers to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'RealBeer' ); $topicObject->text("There are alot of Virtual Beer to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'FamouslyBeered' ); $topicObject->text( "Virtually speaking there could be alot of famous Beers"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'VirtualLife' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -832,7 +832,7 @@ sub test_headingoffset { ---+ H4 HERE $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $test_web = $this->test_web; my $result = $this->test_topicObject->expandMacros(<text($text); $topicObject->save(); - $topicObject->finish(); return; } @@ -1687,7 +1686,7 @@ HERE ); $topicObject->text($text); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $text = $this->toSiteCharSet(<<'HERE'); first line @@ -1783,7 +1782,7 @@ HERE } ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $query = Unit::Request->new( initializer => '' ); $query->path_info( "/" . $this->test_web . "/" . $this->test_topic ); @@ -2140,7 +2139,7 @@ HERE ); $topicObject->text($text); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; } require Benchmark; @@ -2202,13 +2201,12 @@ sub verify_likeQuery { $topicObject->expandMacros( '%SEARCH{"text ~ \'*SMONG*\'" ' . $stdCrap ); $this->assert_str_equals( 'QueryTopicTwo', $result ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'QueryTopicTwo' ); $result = $topicObject->expandMacros( '%SEARCH{"text ~ \'*QueryTopicTwo*\'" ' . $stdCrap ); $this->assert_str_equals( 'QueryTopicTwo', $result ); - $topicObject->finish(); return; } @@ -2222,7 +2220,7 @@ HERE Foswiki::Func::readTopic( $this->test_web, 'QueryTopicTwo' ); $topicObject->text($text); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( '%SEARCH{"text ~ \'*QueryTopicTwo*\'" ' . $stdCrap ); @@ -2243,7 +2241,7 @@ HERE # in order for this test to pass. We know that it's in the cache because the # previous assert has passed. $topicObject->inMetaCache(1); - $topicObject->finish(); + undef $topicObject; $this->assert( !$this->session->search->metacache->hasCached( $this->test_web, 'QueryTopicTwo' @@ -2282,7 +2280,6 @@ Assertion (this is not a topic object) failed! ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'QueryTopicTwo' ); - $topicObject->finish(); return; } @@ -2314,7 +2311,7 @@ sub verify_likeQuery2 { . $stdCrap ); $this->assert_str_equals( 'QueryTopicTwo', $result ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'QueryTopicTwo' ); $result = @@ -2323,7 +2320,7 @@ sub verify_likeQuery2 { . $stdCrap ); $this->assert_str_equals( 'QueryTopicTwo', $result ); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'QueryTopicTwo' ); $result = @@ -2331,7 +2328,7 @@ sub verify_likeQuery2 { . $this->test_web . '" ' . $stdCrap ); $this->assert_str_equals( '', $result ); - $topicObject->finish(); + undef $topicObject; $result = $this->test_topicObject->expandMacros( @@ -2364,7 +2361,7 @@ sub test_extract { Foswiki::Func::readTopic( $this->test_web, 'ExtractTopic' ); $topicObject->text("BLEEGLE \"<>&%\$\"blah"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -2444,7 +2441,7 @@ sub test_formatOfLinks { Apache is the [[http://www.apache.org/httpd/][well known web server]]. HERE $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -2517,7 +2514,7 @@ sub _getTopicList { next if ( $t eq 'InvisibleTopic' ); #and user != admin or... push( @topicList, $t ); } - $webObject->finish(); + undef $webObject; my $l1 = join( ',', @{$expected} ); my $l2 = join( ',', @topicList ); @@ -2840,7 +2837,7 @@ sub verify_Item6082_Search { | Ecks | select | 1 | %SEARCH{"TestForm.Ecks~'Blah*'" type="query" order="topic" separator="," format="$topic;$formfield(Ecks)" nonoise="on"}% | | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); $topicObject->put( 'FORM', { name => "TestForm" } ); $topicObject->putKeyed( 'FIELD', @@ -2852,7 +2849,6 @@ FORM ); my $expected = 'SplodgeOne;Blah'; $this->assert_str_equals( $expected, $actual ); - $topicObject->finish(); return; } @@ -2867,7 +2863,7 @@ sub verify_quotemeta { | Ecks | select | 1 | %SEARCH{"TestForm.Ecks~'Blah*'" type="query" order="topic" separator="," format="$topic;$formfield(Ecks)" nonoise="on"}% | | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); $topicObject->put( 'FORM', { name => "TestForm" } ); $topicObject->putKeyed( 'FIELD', @@ -2879,7 +2875,6 @@ FORM ); my $expected = 'SplodgeOne;Blah'; $this->assert_str_equals( $expected, $actual ); - $topicObject->finish(); return; } @@ -3862,32 +3857,31 @@ sub test_groupby_none_using_subwebs { my $test_web = $this->test_web; my $webObject = $this->populateNewWeb( $this->test_web . "/A" ); - $webObject->finish(); my ($topicObject) = Foswiki::Func::readTopic( $test_web . "/A", 'TheTopic' ); $topicObject->put( 'FORM', { name => "TestForm" } ); $topicObject->putKeyed( 'FIELD', { name => "Order", title => "Order", value => "3" } ); $topicObject->save( forcedate => 1000 ); - $topicObject->finish(); + undef $topicObject; $webObject = $this->populateNewWeb( $test_web . "/B" ); - $webObject->finish(); + undef $webObject; ($topicObject) = Foswiki::Func::readTopic( $test_web . "/B", 'TheTopic' ); $topicObject->put( 'FORM', { name => "TestForm" } ); $topicObject->putKeyed( 'FIELD', { name => "Order", title => "Order", value => "1" } ); $topicObject->save( forcedate => 100 ); - $topicObject->finish(); + undef $topicObject; $webObject = $this->populateNewWeb( $test_web . "/C" ); - $webObject->finish(); + undef $webObject; ($topicObject) = Foswiki::Func::readTopic( $test_web . "/C", 'TheTopic' ); $topicObject->put( 'FORM', { name => "TestForm" } ); $topicObject->putKeyed( 'FIELD', { name => "Order", title => "Order", value => "2" } ); $topicObject->save( forcedate => 500 ); - $topicObject->finish(); + undef $topicObject; my $result; #order by formfield, with groupby=none @@ -4025,7 +4019,6 @@ GNURF Just some dummy search topic. CRUD $ltopicObject->save( forcedate => $now - 240 + $delay ); - $ltopicObject->finish(); } $result = $this->test_topicObject->expandMacros( <<"GNURF" ); @@ -4098,7 +4091,7 @@ CRUD Foswiki::Func::readTopic( 'TemporarySEARCHUsersWeb', 'WikiGuest' ); $userTopic->text('Just this poor old WikiGuest'); $userTopic->save(); - $userTopic->finish(); + undef $userTopic; } $this->assert( $session->topicExists( 'TemporarySEARCHUsersWeb', 'WikiGuest' ), @@ -4544,7 +4537,7 @@ sub verify_stop_words_regex_meta_search_word { Foswiki::Func::readTopic( $this->test_web, $TEST_TOPIC ); $topicObject->text($TEST_TEXT); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -4583,7 +4576,7 @@ sub verify_stop_words_search_word { Foswiki::Func::readTopic( $this->test_web, $TEST_TOPIC ); $topicObject->text($TEST_TEXT); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -4634,7 +4627,6 @@ sub createSummaryTestTopic { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, $topicName ); $topicObject->text($TEST_SUMMARY_TEXT); $topicObject->save(); - $topicObject->finish(); return; } @@ -4888,7 +4880,7 @@ HERE ); my $rev = $topicObject->save( forcedate => 86420 ); # > 86400, see Item10389 $this->assert_num_equals( 1, $rev ); - $topicObject->finish(); + undef $topicObject; #TODO: sadly, the core Handlers don't set the filedate # even though they could @@ -4932,7 +4924,7 @@ HERE } ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result; @@ -5649,7 +5641,7 @@ HERE author => 'simon', forcenewrevision => 1 ); - $topicObject->finish(); + undef $topicObject; $text = $this->toSiteCharSet(<<'HERE'); first line @@ -5763,7 +5755,7 @@ HERE author => 'simon', forcenewrevision => 1 ); - $topicObject->finish(); + undef $topicObject; $text = $this->toSiteCharSet(<<'HERE'); first line @@ -5868,7 +5860,7 @@ HERE } ); $topicObject->save( forcedate => 1108413782, author => 'Gerald' ); - $topicObject->finish(); + undef $topicObject; my $query = Unit::Request->new( initializer => '' ); $query->path_info( "/" . $this->test_web . "/" . $this->test_topic ); @@ -6192,7 +6184,7 @@ sub test_Item13995 { $topicObject->save( forcenewrevision => 1 ); $topicObject->text("BELLS Ring"); $topicObject->save( forcenewrevision => 1 ); - $topicObject->finish(); + undef $topicObject; #Simple $changes - compare Rev 2 - Rev 3 my $result = $this->{test_topicObject}->expandMacros( @@ -6377,7 +6369,6 @@ sub test_format_tokens { "Expansion of SEARCH token $token failed!\n" . "Expected:'$expected'\n But got:'$result'\n" ); } - $topicObject->finish(); return; } @@ -6418,7 +6409,6 @@ sub test_format_percent_tokens { $this->assert_equals( $expectedFail, $result, "Expansion of SEARCH failed remotely (expandvariables=\"off\")!\n" . "Expected:'$expectedFail'\n But got:'$result'\n" ); - $topicObject->finish(); return; } @@ -6445,33 +6435,33 @@ sub test_minus_scope_all { Foswiki::Func::readTopic( $this->test_web, 'VirtualBeer' ); $topicObject->text("There are alot of Virtual Beers to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'RealBeer' ); $topicObject->text("There are alot of Virtual Beer to go around"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'FamouslyBeered' ); $topicObject->text( "Virtually speaking there could be alot of famous Beers"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'VirtualLife' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NoLife' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NoBeer' ); $topicObject->text("In a all life, I would expect to find fine Beer"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SomeBeer' ); $topicObject->text("In a all life, I would expect to find fine Wine"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -6560,7 +6550,7 @@ sub verify_Item10398 { Foswiki::Func::readTopic( $this->test_web, 'Trash.MainBobTest' ); $topicObject->text("BLEEGLE blah/matchme.blah"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $result = $this->test_topicObject->expandMacros( @@ -6644,7 +6634,7 @@ TOPICTEXT #' $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $test_web = $this->test_web; my $result = @@ -6837,7 +6827,6 @@ HERE ($topicObj) = Foswiki::Func::readTopic( $web, $topic ); $topicObj->setEmbeddedStoreForm($metatext); $topicObj->save(); - $topicObj->finish(); } while ( my ( $querysearch, $expected ) = each %tests ) { my $result = $this->_test_query( $querysearch, "$test_web/LLB" ); diff --git a/UnitTestContrib/test/unit/Fn_SECTION.pm b/UnitTestContrib/test/unit/Fn_SECTION.pm index 14b7007d30..644085a6bb 100644 --- a/UnitTestContrib/test/unit/Fn_SECTION.pm +++ b/UnitTestContrib/test/unit/Fn_SECTION.pm @@ -260,7 +260,7 @@ HERE my $time; $topicObj->save(); - $topicObj->finish(); + undef $topicObj; return ( 1 => $c1, diff --git a/UnitTestContrib/test/unit/Fn_TOPICLIST.pm b/UnitTestContrib/test/unit/Fn_TOPICLIST.pm index e0add04246..a829f46cc0 100644 --- a/UnitTestContrib/test/unit/Fn_TOPICLIST.pm +++ b/UnitTestContrib/test/unit/Fn_TOPICLIST.pm @@ -26,10 +26,10 @@ around set_up => sub { $orig->( $this, @_ ); $Foswiki::cfg{EnableHierarchicalWebs} = 1; my $webObject = $this->populateNewWeb( $this->test_web . "/SubWeb" ); - $webObject->finish(); + undef $webObject; my $webObjectH = $this->populateNewWeb( $this->test_web . "Hidden" ); - $webObjectH->finish(); + undef $webObjectH; my ($webPrefsObj) = Foswiki::Func::readTopic( $this->test_web . "Hidden", $Foswiki::cfg{WebPrefsTopicName} ); @@ -40,7 +40,7 @@ If ALLOW is set to a list of wikiname * Set ALLOWWEBVIEW = $users_web.AdminUser THIS $webPrefsObj->save(); - $webPrefsObj->finish(); + undef $webPrefsObj; Foswiki::Func::readTemplate('foswiki'); @@ -116,7 +116,7 @@ sub test_otherWeb_NOSEARCHALL { $Foswiki::cfg{WebPrefsTopicName} ); $to->text( $to->text() . "\n * Set NOSEARCHALL = on\n" ); $to->save(); - $to->finish(); + undef $to; my $text = $this->test_topicObject->expandMacros( diff --git a/UnitTestContrib/test/unit/Fn_USERINFO.pm b/UnitTestContrib/test/unit/Fn_USERINFO.pm index 4b628ad02d..1cf2310cc5 100644 --- a/UnitTestContrib/test/unit/Fn_USERINFO.pm +++ b/UnitTestContrib/test/unit/Fn_USERINFO.pm @@ -27,18 +27,17 @@ around set_up => sub { Foswiki::Func::readTopic( $this->users_web, "GropeGroup" ); $topicObject->text(" * Set GROUP = ScumBag,WikiGuest\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "FriendsOfGropeGroup" ); $topicObject->text(" * Set GROUP = AdminUser, GropeGroup\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, "FriendsOfFriendsOfGropeGroup" ); $topicObject->text(" * Set GROUP = AdminUser, FriendsOfGropeGroup\n"); $topicObject->save(); - $topicObject->finish(); }; sub test_basic { diff --git a/UnitTestContrib/test/unit/Fn_VAR.pm b/UnitTestContrib/test/unit/Fn_VAR.pm index 1b353542e6..9dbd1cbbeb 100644 --- a/UnitTestContrib/test/unit/Fn_VAR.pm +++ b/UnitTestContrib/test/unit/Fn_VAR.pm @@ -23,7 +23,7 @@ sub test_VAR { * Set BLEEGLE = gibbut SPLOT $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, @@ -32,7 +32,7 @@ SPLOT * Set BLEEGLE = frabbeque SPLOT $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->createNewFoswikiSession(); ($topicObject) = diff --git a/UnitTestContrib/test/unit/Fn_WEBLIST.pm b/UnitTestContrib/test/unit/Fn_WEBLIST.pm index 441eb58569..247b3ea0b0 100644 --- a/UnitTestContrib/test/unit/Fn_WEBLIST.pm +++ b/UnitTestContrib/test/unit/Fn_WEBLIST.pm @@ -25,17 +25,17 @@ around set_up => sub { $orig->( $this, @_ ); $Foswiki::cfg{EnableHierarchicalWebs} = 1; my $webObject = $this->populateNewWeb( $this->test_web . "/Dive1" ); - $webObject->finish(); + undef $webObject; $webObject = $this->populateNewWeb( $this->test_web . "/Dive1/Dive2" ); - $webObject->finish(); + undef $webObject; $webObject = $this->populateNewWeb( $this->test_web . "/Dive1/Dive2/Dive3" ); - $webObject->finish(); + undef $webObject; $webObject = $this->populateNewWeb( $this->test_web . "/Dive1/_Dive2tmpl" ); - $webObject->finish(); + undef $webObject; Foswiki::Func::readTemplate('foswiki'); @allWebs = Foswiki::Func::getListOfWebs('user,public,allowed'); diff --git a/UnitTestContrib/test/unit/FormDefTests.pm b/UnitTestContrib/test/unit/FormDefTests.pm index 8a2fa63e88..9b6c6c907a 100644 --- a/UnitTestContrib/test/unit/FormDefTests.pm +++ b/UnitTestContrib/test/unit/FormDefTests.pm @@ -22,7 +22,7 @@ sub test_minimalForm { | Date | date | 30 | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); $this->assert($def); @@ -54,7 +54,7 @@ sub test_allCols { | DoLink | textarea | 80x20 | some initial | Write Something | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -113,7 +113,6 @@ FORM $this->assert_str_equals( 'DoLink', $f->name ); $this->assert_str_equals( 'DoLink', $f->title ); $this->assert_str_equals( '', $f->definingTopic ); - $def->finish(); return; } @@ -127,7 +126,7 @@ sub test_valsFromOtherTopic { | Vals Elsewhere | select | | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'ValsElsewhere' ); $topicObject->text( <<'FORM'); @@ -137,7 +136,7 @@ FORM | Age | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -153,7 +152,6 @@ FORM $this->assert_str_equals( 'ValOne,RowName,Age', join( ',', @{ $f->getOptions() } ) ); $this->assert_str_equals( '', $f->definingTopic ); - $def->finish(); return; } @@ -168,7 +166,7 @@ sub test_squabValRef { | [[$test_web.Splodge][Vals Elsewhere]] | select | | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $test_web, 'Splodge' ); $topicObject->text( <<'FORM'); | *Name* | @@ -177,7 +175,7 @@ FORM | Age | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $test_web, 'TestForm' ); @@ -189,7 +187,6 @@ FORM $this->assert_str_equals( 'ValOne,RowName,Age', join( ',', @{ $f->getOptions() } ) ); $this->assert_str_equals( $test_web . '.Splodge', $f->definingTopic ); - $def->finish(); return; } @@ -203,19 +200,19 @@ sub test_searchForOptions { | Ecks | select | 1 | %SEARCH{"^\\| (Age\|Beauty)" type="regex" nonoise="on" separator="," format="$topic"}% | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); $topicObject->text( <<'FORM'); | Age | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeTwo' ); $topicObject->text( <<'FORM'); | Beauty | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -223,7 +220,6 @@ FORM my $f = $def->getField('Ecks'); $this->assert_str_equals( 'SplodgeOne,SplodgeTwo', join( ',', sort @{ $f->getOptions() } ) ); - $def->finish(); return; } @@ -237,19 +233,19 @@ sub test_searchForOptionsQuery { | Ecks | select | 1 | %SEARCH{"text=~'^\\| (Age\|Beauty)'" type="query" nonoise="on" separator="," format="$topic"}% | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); $topicObject->text( <save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeTwo' ); $topicObject->text( <save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -257,7 +253,6 @@ FORM my $f = $def->getField('Ecks'); $this->assert_str_equals( 'SplodgeOne,SplodgeTwo', join( ',', sort @{ $f->getOptions() } ) ); - $def->finish(); } sub test_Item6082 { @@ -272,14 +267,14 @@ sub test_Item6082 { | Ecks | select | 1 | %SEARCH{"TestForm.Ecks~'Blah*'" type="query" order="topic" separator="," format="$topic;$formfield(Ecks)" nonoise="on"}% | | | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); $topicObject->text( <<'FORM'); %META:FORM{name="TestForm"}% %META:FIELD{name="Ecks" title="X" value="Blah"}% FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -290,8 +285,6 @@ FORM my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'TestForm' ); $meta->renderFormForDisplay(); - $def->finish(); - $meta->finish(); return; } @@ -305,7 +298,7 @@ sub test_makeFromMeta { %META:FIELD{name="Ecks" title="X" value="Blah"}% FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'SplodgeOne' ); my $form = Foswiki::Form->loadCached( $this->session, $this->test_web, @@ -315,8 +308,6 @@ FORM $this->assert_str_equals( 'Ecks', $f->name ); $this->assert_str_equals( 'X', $f->title ); $this->assert_str_equals( '', $f->size ); - $form->finish(); - $meta->finish(); return; } @@ -330,7 +321,7 @@ sub test_Item972_selectPlusValues { | Select | select+values | 5 | , =0, One, Two=2, Th%72ee=III, Four | Various values | FORM $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $def = Foswiki::Form->loadCached( $this->session, $this->test_web, 'TestForm' ); @@ -340,7 +331,6 @@ FORM $this->assert_str_equals( ',0,One,2,III,Four', join( ',', @{ $f->getOptions() } ) ); $this->assert_str_equals( 'Various values', $f->description ); - $def->finish(); return; } diff --git a/UnitTestContrib/test/unit/FormattingTests.pm b/UnitTestContrib/test/unit/FormattingTests.pm index 44e9b92f65..a67922efd4 100644 --- a/UnitTestContrib/test/unit/FormattingTests.pm +++ b/UnitTestContrib/test/unit/FormattingTests.pm @@ -230,17 +230,17 @@ around set_up => sub { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'H_' ); $topicObject->text("BLEEGLE"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'Underscore_topic' ); $topicObject->text("BLEEGLE"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, $Foswiki::cfg{HomeTopicName} ); $topicObject->text("BLEEGLE"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'Numeric1Wikiword' ); $topicObject->text("BLEEGLE"); @@ -255,7 +255,6 @@ around set_up => sub { $Foswiki::cfg{AntiSpam}{EmailPadding} = 'STUFFED'; $Foswiki::cfg{AntiSpam}{EntityEncode} = 1; $Foswiki::cfg{AllowInlineScript} = 1; - $topicObject->finish(); }; around tear_down => sub { @@ -1033,9 +1032,9 @@ sub test_shortAcronyms { my $abbrevLength = 2; $Foswiki::regex{abbrevRegex} = qr/[[:upper:]]{$abbrevLength,}s?\b/; require Class::Unload; - $this->session->renderer->finish(); + $this->session->clear_renderer; Class::Unload->unload('Foswiki::Render'); - require Foswiki::Render; + Foswiki::load_class('Foswiki::Render'); $this->session->renderer( Foswiki::Render->( $this->session ) ); my ( $sup, $test_web ) = ( $this->sup, $this->test_web ); @@ -1063,9 +1062,9 @@ ACTUAL $abbrevLength = $Foswiki::cfg{AcronymLength} || 3; $Foswiki::regex{abbrevRegex} = qr/[[:upper:]]{$abbrevLength,}s?\b/; require Class::Unload; - $this->session->renderer->finish; + $this->session->clear_renderer; Class::Unload->unload('Foswiki::Render'); - require Foswiki::Render; + Foswiki::load_class('Foswiki::Render'); $this->session->renderer( Foswiki::Render->new( $this->session ) ); } @@ -1898,7 +1897,6 @@ sub _create_topic { my ($topicObject) = Foswiki::Func::readTopic( $web, $topic ); $topicObject->save(); - $topicObject->finish(); return; } diff --git a/UnitTestContrib/test/unit/FuncTests.pm b/UnitTestContrib/test/unit/FuncTests.pm index 8edddfcbb8..7e0581c831 100644 --- a/UnitTestContrib/test/unit/FuncTests.pm +++ b/UnitTestContrib/test/unit/FuncTests.pm @@ -108,7 +108,7 @@ around set_up => sub { my ($topicObject) = Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, $Foswiki::cfg{DefaultUserWikiName} ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->registerUser( 'white', 'Mr', "White", 'white@example.com' ); $MrWhite = $this->session->users->getCanonicalUserID('white'); @@ -116,7 +116,6 @@ around set_up => sub { $this->tmpdatafile2( $Foswiki::cfg{TempfileDir} . '/tmpity-tmp2.gif' ); $this->test_web2( $this->test_web . 'Extra' ); my $webObject = $this->populateNewWeb( $this->test_web2 ); - $webObject->finish(); return; }; @@ -420,9 +419,9 @@ sub test_moveWeb { $Foswiki::cfg{EnableHierarchicalWebs} = 1; my $webObject = $this->populateNewWeb( $this->test_web . "Blah" ); - $webObject->finish(); + undef $webObject; $webObject = $this->populateNewWeb( $this->test_web . "Blah/SubWeb" ); - $webObject->finish(); + undef $webObject; $this->assert( Foswiki::Func::webExists( $this->test_web . 'Blah' ) ); $this->assert( @@ -628,7 +627,7 @@ NONNY my ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, $topic ); Foswiki::Func::saveTopic( $this->test_web, $topic, $meta, $text, { comment => 'atp save', forcenewrevision => 1 } ); - $meta->finish(); + undef $meta; my $text2 = Foswiki::Func::readTopicText( $this->test_web, $topic ); my $matchText = '%META:TOPICINFO\{author="BaseUserMapping_666" comment="atp save" date=".*?" format="1.1" version="2"\}%' @@ -663,7 +662,7 @@ NONNY # This should succeed Foswiki::Func::saveTopic( $this->test_web, $topic, $m, 'Gasp', { forcenewrevision => 1, ignorepermissions => 1 } ); - $m->finish(); + undef $m; @ri = Foswiki::Func::getRevisionInfo( $this->test_web, $topic ); $this->assert_matches( qr/2$/, $ri[2] ); @@ -671,7 +670,7 @@ NONNY # Make sure the meta is still there $el = $m->get( 'PREFERENCE', 'Bird' ); - $m->finish(); + undef $m; $this->assert_equals( 'Kakapo', $el->{value} ); $this->assert_equals( 'Gasp', $t ); @@ -767,10 +766,10 @@ sub test_attachments { ); $this->assert( !$e, $e ); - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, $topic ); @attachments = $meta->find('FILEATTACHMENT'); - $meta->finish(); + undef $meta; $this->assert_str_equals( $name1, $attachments[0]->{name} ); $this->assert_str_equals( $name2, $attachments[1]->{name} ); @@ -991,7 +990,6 @@ qr/^AccessControlException: Access to CHANGE TemporaryFuncTestWebFunc.BlahBlahcw "Unexpected error $errStr" ); }; - $meta->finish(); return; } @@ -1039,7 +1037,7 @@ sub test_subweb_attachments { #$web = Assert::TAINT($web); # my $webObject = $this->populateNewWeb($web); - $webObject->finish(); + undef $webObject; my $stream = $this->write_file( $this->tmpdatafile, $data, @@ -1114,10 +1112,10 @@ sub test_subweb_attachments { "Attachment file $ft/$name2 was not written to disk?" ); } - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $web, $topic ); @attachments = $meta->find('FILEATTACHMENT'); - $meta->finish(); + undef $meta; $this->assert_str_equals( $name1, $attachments[0]->{name} ); # Make sure it has a non-0 date @@ -1171,7 +1169,7 @@ sub test_getrevinfo { $Foswiki::cfg{EnableHierarchicalWebs} = 1; my $webObject = $this->populateNewWeb( $this->test_web . "/Blah" ); - $webObject->finish(); + undef $webObject; Foswiki::Func::saveTopicText( $this->test_web, $topic, 'blah' ); Foswiki::Func::saveTopicText( $this->test_web . "/Blah", $topic, 'blah' ); @@ -1213,7 +1211,6 @@ sub _checkMoveTopic { next if ( $_->{from} ne "$oldWeb.$oldTopic" ); return 1; } - $meta->finish(); return 0; } @@ -1395,7 +1392,7 @@ sub test_moveAttachment { ); # Verify that the source topic still contains the string "Wibble" following attachment move - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "SourceTopic" ); $this->assert( $text =~ m/Wibble/ ); @@ -1418,7 +1415,7 @@ sub test_moveAttachment { ); # Verify that the target topic contains the string "Wibble" - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "TargetTopic" ); $this->assert( $text =~ m/Wibble/ ); @@ -1441,11 +1438,10 @@ sub test_moveAttachment { ); # Verify that the target topic still contains the string "Wibble" following attachment move - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "TargetTopic" ); $this->assert( $text =~ m/Wibble/ ); - $meta->finish(); return; } @@ -1503,7 +1499,7 @@ sub test_copyAttachment { # Verify that the source topic still contains the string "Wibble" # following attachment copy - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "SourceTopic" ); $this->assert( $text =~ m/Wibble/ ); @@ -1527,7 +1523,7 @@ sub test_copyAttachment { ); # Verify that the target topic contains the string "Wibble" - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "TargetTopic" ); $this->assert( $text =~ m/Wibble/ ); @@ -1552,11 +1548,10 @@ sub test_copyAttachment { # Verify that the target topic still contains the string "Wibble" # following attachment copy - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, "TargetTopic" ); $this->assert( $text =~ m/Wibble/ ); - $meta->finish(); return; } @@ -1940,7 +1935,7 @@ END "VIEW access denied for " . $Foswiki::cfg{DefaultUserWikiName} ) ; # got access now as META's ALLOW overrides the text's ALLOW - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, $topic ); $meta->putKeyed( 'PREFERENCE', @@ -1959,7 +1954,7 @@ END $this->test_web, $meta ); - $meta->finish(); + undef $meta; $this->assert( !$access ); # no access as META overrides text #I'm not clear from the docco so... @@ -2107,7 +2102,7 @@ END "VIEW access denied for " . $Foswiki::cfg{DefaultUserLogin} ) ; # ACCESS as META's ALLOW overrides the text's ALLOW - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, $topic ); $meta->putKeyed( 'PREFERENCE', @@ -2125,7 +2120,6 @@ END $topic, $this->test_web, $meta ); $this->assert( !$access ); - $meta->finish(); return; } @@ -2276,7 +2270,7 @@ sub test_eachChangeSince { $meta->save(); $this->createNewFoswikiSession($user2); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, "PiggleNut" ); $meta->text("One"); $meta->save(); @@ -2286,17 +2280,17 @@ sub test_eachChangeSince { my $mid = time(); $this->createNewFoswikiSession($user2); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, "ClutterBuck" ); $meta->text("One"); $meta->save(); $this->createNewFoswikiSession($user1); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, "PiggleNut" ); $meta->text("Two"); $meta->save(); - $meta->finish(); + undef $meta; my $change; my $it = Foswiki::Func::eachChangeSince( $this->test_web, $start ); @@ -2493,7 +2487,7 @@ sub test_getAttachmentList { comment => "a comment" ); $meta->save(); - $meta->finish(); + undef $meta; unlink $filename; my @list = Foswiki::Func::getAttachmentList( $this->test_web, $this->test_topic ); @@ -2694,7 +2688,7 @@ sub do_attachment { $this->createNewFoswikiSession( undef, $query ); $this->request($query); $this->response( Unit::Response->new() ); - $this->test_topicObject->finish() if $this->test_topicObject; + $this->clear_test_topicObject; $this->test_topicObject( Foswiki::Func::readTopic( $this->test_web, $this->test_topic ) ); $this->test_topicObject->text("BLEEGLE\n"); @@ -2740,7 +2734,7 @@ sub do_attachment { my ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); my @attachments = $meta->find('FILEATTACHMENT'); - $meta->finish(); + undef $meta; $this->assert( $name eq $attachments[0]->{name}, "Got $attachments[0]->{name} but expected $name " ); diff --git a/UnitTestContrib/test/unit/FuncUsersTests.pm b/UnitTestContrib/test/unit/FuncUsersTests.pm index a9f2fc5e2d..7a66901b27 100644 --- a/UnitTestContrib/test/unit/FuncUsersTests.pm +++ b/UnitTestContrib/test/unit/FuncUsersTests.pm @@ -225,36 +225,35 @@ sub set_up_for_verify { $topicObject->text( " * Set GROUP = UserA, UserB, $Foswiki::cfg{AdminUserWikiName}"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, 'AandCGroup' ); $topicObject->text(" * Set GROUP = UserA, UserC"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, 'BandCGroup' ); $topicObject->text(" * Set GROUP = UserC, UserB"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, 'NestingGroup' ); $topicObject->text(" * Set GROUP = UserE, AandCGroup, BandCGroup"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, 'ScumGroup' ); $topicObject->text( " * Set GROUP = UserA, $Foswiki::cfg{DefaultUserWikiName}, $loginname{UserZ}" ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, $Foswiki::cfg{SuperAdminGroup} ); $topicObject->text( " * Set GROUP = UserA, $Foswiki::cfg{AdminUserWikiName}"); $topicObject->save(); - $topicObject->finish(); } catch { my $e = $_; @@ -1493,7 +1492,7 @@ sub verify_topic_meta_usermapping { my ($topicObject) = Foswiki::Func::readTopic( $web, $topic ); $topicObject->text($text); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $web, $topic ) ); my ($readMeta) = Foswiki::Func::readTopic( $web, $topic ); @@ -1512,7 +1511,7 @@ sub verify_topic_meta_usermapping { comment => "a comment", filedate => 1262347200, # 01 Jan 2010 12:00 ); - $readMeta->finish(); + undef $topicObject; ($readMeta) = Foswiki::Func::readTopic( $web, $topic ); my @attachments = $readMeta->find('FILEATTACHMENT'); @@ -1525,7 +1524,7 @@ sub verify_topic_meta_usermapping { #META my $metainfo = $readMeta->expandMacros('%META{"attachments"}%'); - $readMeta->finish(); + undef $topicObject; #Task:Item6000 $metainfo =~ s/^.*?(\|.*\|).*?$/$1/s; @@ -1998,7 +1997,7 @@ sub DISABLEDverify_denyNonAdminReadOfAdminGroupTopic { $topicObject->text( $topicObject . "\n\n * Set ALLOWTOPICVIEW = AdminGroup\n\n" ); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; { diff --git a/UnitTestContrib/test/unit/HTMLValidationTests.pm b/UnitTestContrib/test/unit/HTMLValidationTests.pm index 716ee0d424..60371e16b6 100644 --- a/UnitTestContrib/test/unit/HTMLValidationTests.pm +++ b/UnitTestContrib/test/unit/HTMLValidationTests.pm @@ -99,7 +99,6 @@ around set_up => sub { ALLOWWEBRENAME => '' } ); - $webObject->finish(); return; }; @@ -351,7 +350,6 @@ sub add_form_and_data { put_field( $meta, 'State', 'State', 'Invisible' ); put_field( $meta, 'Anothertopic', 'Another topic', 'GRRR ' ); $meta->save(); - $meta->finish(); return; } diff --git a/UnitTestContrib/test/unit/HierarchicalWebsTests.pm b/UnitTestContrib/test/unit/HierarchicalWebsTests.pm index d1c468d9f0..c5a932c8bd 100644 --- a/UnitTestContrib/test/unit/HierarchicalWebsTests.pm +++ b/UnitTestContrib/test/unit/HierarchicalWebsTests.pm @@ -30,7 +30,6 @@ around set_up_for_verify => sub { # subweb of test web, so default tear_down will nosh it my $webObject = $this->populateNewWeb( $this->sub_web_path ); - $webObject->finish(); }; sub verify_createSubSubWeb { @@ -39,13 +38,13 @@ sub verify_createSubSubWeb { $this->createNewFoswikiSession(); my $webTest = 'Item0'; my $webObject = $this->populateNewWeb( $this->sub_web_path . "/$webTest" ); - $webObject->finish(); + undef $webObject; $this->assert( $this->session->webExists( $this->sub_web_path . "/$webTest" ) ); $webTest = 'Item0_'; $webObject = $this->populateNewWeb( $this->sub_web_path . "/$webTest" ); - $webObject->finish(); + undef $webObject; $this->assert( $this->session->webExists( $this->sub_web_path . "/$webTest" ) ); @@ -60,7 +59,7 @@ sub verify_createSubWebTopic { Foswiki::Func::readTopic( $this->sub_web_path, $this->test_topic ); $topicObject->text("page stuff\n"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $this->sub_web_path, $this->test_topic ) ); @@ -83,7 +82,7 @@ sub verify_include_subweb_non_wikiword_topic { %INCLUDE{ "$sub_web_path/$includeTopic" }% TOPIC $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $this->sub_web_path, $baseTopic ) ); @@ -92,7 +91,7 @@ TOPIC Foswiki::Func::readTopic( $this->sub_web_path, $includeTopic ); $topicObject->text($testText); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $this->sub_web_path, $includeTopic ) ); @@ -100,7 +99,7 @@ TOPIC ($topicObject) = Foswiki::Func::readTopic( $this->sub_web_path, $includeTopic ); $this->assert_matches( qr/$testText\s*$/, $topicObject->text ); - $topicObject->finish(); + undef $topicObject; # base page should evaluate (more or less) to the included page's text ($topicObject) = @@ -108,7 +107,6 @@ TOPIC my $text = $topicObject->text; $text = $topicObject->expandMacros($text); $this->assert_matches( qr/$testText\s*$/, $text ); - $topicObject->finish(); return; } @@ -132,8 +130,8 @@ sub verify_create_subweb_with_same_name_as_a_topic { my ($meta) = Foswiki::Func::readTopic( $this->sub_web_path, $this->test_topic ); $this->assert_matches( qr/$testText\s*$/, $topicObject->text ); - $topicObject->finish(); - $meta->finish(); + undef $topicObject; + undef $meta; # create the subweb with the same name as the page my $webObject = @@ -147,10 +145,10 @@ sub verify_create_subweb_with_same_name_as_a_topic { ($topicObject) = Foswiki::Func::readTopic( $this->sub_web_path, $this->test_topic ); $this->assert_matches( qr/$testText\s*$/, $topicObject->text ); - $topicObject->finish(); + undef $topicObject; $webObject->removeFromStore(); - $webObject->finish(); + undef $webObject; $this->assert( !$this->session->webExists( @@ -180,7 +178,7 @@ sub verify_create_sub_web_missingParent { $this->assert_matches( qr/^Parent web Missingweb does not exist.*/, $errStr, "Unexpected error $errStr" ); }; - $webObject->finish(); + undef $webObject; $this->assert( !$this->session->webExists( "Missingweb/" . $this->sub_web ) ); $this->assert( !$this->session->webExists("Missingweb") ); @@ -209,7 +207,7 @@ sub verify_createWeb_InvalidBase { $this->assert_matches( qr/^Template web Missingbase does not exist.*/, $errStr, "Unexpected error $errStr" ); }; - $webObject->finish(); + undef $webObject; $this->assert( !$this->session->webExists( $this->sub_web_path . "/$webTest" ) ); @@ -240,7 +238,7 @@ sub verify_createWeb_hierarchyDisabled { qr/^Unable to create .* Hierarchical webs are disabled.*/, $errStr, "Unexpected error '$errStr'" ); }; - $webObject->finish(); + undef $webObject; $this->assert( !$this->session->webExists( $this->sub_web_path . "/$webTest" . 'x' ) ); @@ -292,7 +290,7 @@ sub verify_url_parameters { Foswiki::Func::readTopic( $this->test_web, $this->sub_web ); $topicObject->text("nowt"); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $topicquery = Unit::Request->new( initializer => { @@ -340,7 +338,7 @@ sub test_squab_simple { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NonExistant' ); $text = $topicObject->renderTML($text); - $topicObject->finish(); + undef $topicObject; my $test_web = $this->test_web; $this->assert_matches( qr!renderTML($text); - $topicObject->finish(); + undef $topicObject; $this->assert_matches( qr!sub_web . "]]"; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NonExistant' ); $text = $topicObject->renderTML($text); - $topicObject->finish(); + undef $topicObject; my $scripturl = $this->session->getScriptUrl( 0, 'view' ) . "/" . $this->test_web . "/" @@ -459,14 +457,14 @@ sub test_squab_full_path_with_topic { Foswiki::Func::readTopic( $this->test_web, $this->sub_web ); $topicObject->text(''); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $this->test_web, $this->sub_web ) ); my $text = "[[" . $this->test_web . "." . $this->sub_web . "]]"; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NonExistant' ); $text = $topicObject->renderTML($text); - $topicObject->finish(); + undef $topicObject; my $test_web = $this->test_web; my $sub_web = $this->sub_web; @@ -490,14 +488,14 @@ sub test_squab_path_to_topic_in_subweb { Foswiki::Func::readTopic( $this->test_web, $this->sub_web ); $topicObject->text(''); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->assert( $this->session->topicExists( $this->test_web, $this->sub_web ) ); my $text = "[[" . $this->test_web . "." . $this->sub_web . ".WebHome]]"; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NonExistant' ); $text = $topicObject->renderTML($text); - $topicObject->finish(); + undef $topicObject; my $scripturl = Foswiki::Func::getScriptUrl( $this->test_web . "/" . $this->sub_web, diff --git a/UnitTestContrib/test/unit/ManageDotPmTests.pm b/UnitTestContrib/test/unit/ManageDotPmTests.pm index ac1d2f6834..1856343849 100644 --- a/UnitTestContrib/test/unit/ManageDotPmTests.pm +++ b/UnitTestContrib/test/unit/ManageDotPmTests.pm @@ -1420,7 +1420,7 @@ sub test_createDefaultWeb { my $webObject = $this->getWebObject($newWeb); $this->assert_equals( 'fuchsia', $webObject->getPreference('WEBBGCOLOR') ); $this->assert_equals( 'on', $webObject->getPreference('SITEMAPLIST') ); - $webObject->finish(); + undef $webObject; #check that the topics from _default web are actually in the new web, and make sure they are expectently similar my @expectedTopicsItr = Foswiki::Func::getTopicList('_default'); @@ -1428,10 +1428,10 @@ sub test_createDefaultWeb { $this->assert( Foswiki::Func::topicExists( $newWeb, $expectedTopic ) ); my ( $eMeta, $eText ) = Foswiki::Func::readTopic( '_default', $expectedTopic ); - $eMeta->finish(); + undef $eMeta; my ( $nMeta, $nText ) = Foswiki::Func::readTopic( $newWeb, $expectedTopic ); - $nMeta->finish(); + undef $nMeta; #change the params set above to what they were in the template WebPreferences $nText =~ @@ -1465,7 +1465,7 @@ But never a one who thinks %META:PREFERENCE{name="METALOCAL" type="Local" value="meta local"}% TEXT $testTopic->save(); - $testTopic->finish(); + undef $testTopic; my $query = Unit::Request->new( initializer => { @@ -1524,7 +1524,7 @@ But never a one who thinks %META:PREFERENCE{name="METALOCAL" type="Local" value="meta local"}% TEXT $testTopic->save(); - $testTopic->finish(); + undef $testTopic; my $query = Unit::Request->new( initializer => { @@ -1586,7 +1586,7 @@ But never a one who thinks %META:PREFERENCE{name="METALOCAL" type="Local" value="meta local"}% TEXT $testTopic->save(); - $testTopic->finish(); + undef $testTopic; my $query = Unit::Request->new( initializer => { @@ -1643,7 +1643,7 @@ But never a one who thinks %META:PREFERENCE{name="METALOCAL" type="Local" value="meta local"}% TEXT $testTopic->save(); - $testTopic->finish(); + undef $testTopic; my $query = Unit::Request->new( initializer => { @@ -1754,7 +1754,7 @@ sub test_createEmptyWeb { $this->assert_equals( 'fuchsia', $webObject->getPreference('WEBBGCOLOR') ); $this->assert_equals( 'somenewskin,another', $webObject->getPreference('SKIN') ); - $webObject->finish(); + undef $webObject; #nope, SITEMAPLIST isn't required #$this->assert_equals('on', $webObject->getPreference('SITEMAPLIST')); @@ -1770,10 +1770,10 @@ sub test_createEmptyWeb { my ( $eMeta, $eText ) = Foswiki::Func::readTopic( '_empty', $expectedTopic ); - $eMeta->finish(); + undef $eMeta; my ( $nMeta, $nText ) = Foswiki::Func::readTopic( $newWeb, $expectedTopic ); - $nMeta->finish(); + undef $nMeta; #change the params set above to what they were in the template WebPreferences $nText =~ diff --git a/UnitTestContrib/test/unit/MetaTests.pm b/UnitTestContrib/test/unit/MetaTests.pm index beccbf6930..51180d0ec8 100644 --- a/UnitTestContrib/test/unit/MetaTests.pm +++ b/UnitTestContrib/test/unit/MetaTests.pm @@ -71,7 +71,6 @@ sub test_single { $this->assert_str_equals( "a", $vals1->{"name"} ); $this->assert_equals( 2, $vals1->{"value"} ); $this->assert_equals( 1, $meta->count("TOPICINFO"), "Should be one item" ); - $meta->finish(); return; } @@ -101,7 +100,6 @@ sub test_multiple { my $vals2 = $meta->get( "FIELD", "b" ); $this->assert_str_equals( $vals2->{"name"}, "b" ); $this->assert_str_equals( $vals2->{"value"}, "3" ); - $meta->finish(); return; } @@ -135,7 +133,6 @@ sub test_zero_empty { my $vals2 = $meta->get( "FIELD", "b" ); $this->assert_str_equals( $vals2->{"name"}, "b" ); $this->assert_str_equals( $vals2->{"value"}, "" ); - $meta->finish(); return; } @@ -153,7 +150,6 @@ sub test_removeSingle { $meta->remove("TOPICINFO"); $this->assert( $meta->count("TOPICINFO") == 0, "Should be no items after remove" ); - $meta->finish(); return; } @@ -182,7 +178,6 @@ sub test_removeMultiple { $meta->remove( "FIELD", "b" ); $this->assert( $meta->count("FIELD") == 1, "Should be one FIELD items after partial remove" ); - $meta->finish(); return; } @@ -229,7 +224,6 @@ sub test_foreach { $this->assert( $d->{collected} =~ s/FIELD.name:a;// ); $this->assert( $d->{collected} =~ s/FIELD.name:b;// ); $this->assert_str_equals( "", $d->{collected} ); - $meta->finish(); return; } @@ -293,8 +287,6 @@ sub test_copyFrom { $this->assert( $d->{collected} =~ s/FIELD.value:aval;// ); $this->assert( $d->{collected} =~ s/FIELD.value:bval;// ); $this->assert_str_equals( "", $d->{collected} ); - $new->finish(); - $meta->finish(); return; } @@ -316,7 +308,6 @@ sub test_formfield { $str = $m1->expandMacros('%META{"formfield" name="c"}%'); $this->assert_str_equals( "1", $str ); - $m1->finish(); } sub test_parent { @@ -407,7 +398,6 @@ sub test_parent { map { "[[$web.$testTopic$_][$testTopic$_]]" } reverse $depth + 1 .. 6 ) ); - $topicObject->finish(); } # Test nowebhome @@ -420,7 +410,7 @@ sub test_parent { $ttopicObject->put( "TOPICPARENT", { name => $web . '.' . $Foswiki::cfg{HomeTopicName} } ); $ttopicObject->save(); - $ttopicObject->finish(); + undef $ttopicObject; $ttopicObject = Foswiki::Meta->load( $this->session, $web, $testTopic . '1' ); my $str = $ttopicObject->expandMacros('%META{"parent"}%'); @@ -436,7 +426,6 @@ sub test_parent { join( " > ", map { "[[$web.$testTopic$_][$testTopic$_]]" } reverse 2 .. 6 ) ); - $ttopicObject->finish(); return; } @@ -699,7 +688,7 @@ EVIL $text = <<'EVIL'; %META:TOPICPARENT{}% EVIL - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->new( session => $this->session, web => $this->test_web, @@ -719,7 +708,7 @@ EVIL %META:TOPICMOVED{from="here" to="there" by="her" date="1234567890"}% $gunk GOOD - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->new( session => $this->session, web => $this->test_web, @@ -732,7 +721,6 @@ GOOD $topicObject->expandNewTopic(); $topicObject->renderTML( $topicObject->text() ); $topicObject->renderFormForDisplay(); - $topicObject->finish(); return; } @@ -837,7 +825,6 @@ sub test_registerMETA { 'TREE', { spread => '5', height => '15' } ) ); - $o->finish(); return; } @@ -888,7 +875,6 @@ Properties: System.SemanticIsPartOf,Example.Property,PreyOf,Eat,IsPartOf A property: Snakes Values: System.UserDocumentationCategory,UserDocumentationCategory,Snakes,Mosquitos,Flies,UserDocumentationCategory EXPECTED - $topicObject->finish(); return; } @@ -935,7 +921,6 @@ Properties: System.SemanticIsPartOf Alias: System.SemanticIsPartOf Values: System.UserDocumentationCategory EXPECTED - $topicObject->finish(); return; } @@ -949,7 +934,7 @@ sub test_getRevisionHistory { text => "Rev 1" ); $this->assert_equals( 1, $topicObject->save() ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); my $revIt = $topicObject->getRevisionHistory(); @@ -959,7 +944,7 @@ sub test_getRevisionHistory { $topicObject->text('Rev 2'); $this->assert_equals( 2, $topicObject->save( forcenewrevision => 1 ) ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); $revIt = $topicObject->getRevisionHistory(); @@ -971,7 +956,7 @@ sub test_getRevisionHistory { $topicObject->text('Rev 3'); $this->assert_equals( 3, $topicObject->save( forcenewrevision => 1 ) ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); $revIt = $topicObject->getRevisionHistory(); @@ -982,7 +967,6 @@ sub test_getRevisionHistory { $this->assert( $revIt->hasNext() ); $this->assert_equals( 1, $revIt->next() ); $this->assert( !$revIt->hasNext() ); - $topicObject->finish(); return; } @@ -996,7 +980,7 @@ sub test_summariseChanges { text => "Line 1\n\nLine 2\n\nLine 3" ); $this->assert_equals( 1, $topicObject->save() ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); my $revIt = $topicObject->getRevisionHistory(); @@ -1008,7 +992,7 @@ sub test_summariseChanges { $topicObject->text("Line 1\n\nLine 3"); $this->assert_equals( 2, $topicObject->save( forcenewrevision => 1 ) ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); $revIt = $topicObject->getRevisionHistory(); @@ -1022,7 +1006,7 @@ sub test_summariseChanges { $topicObject->text("Line 1\nSomeOtherData\nLine 3"); $this->assert_equals( 3, $topicObject->save( forcenewrevision => 1 ) ); - $topicObject->finish(); + undef $topicObject; $topicObject = Foswiki::Meta->load( $this->session, $this->test_web, 'RevIt' ); $revIt = $topicObject->getRevisionHistory(); @@ -1081,7 +1065,7 @@ RESULT #$topicObject = # Foswiki::Meta->load($this->session, $this->test_web, 'RevIt', '3' ); #print "REV3 \n====\n".$topicObject->text()."\n====\n"; - $topicObject->finish(); + undef $topicObject; return; } @@ -1096,18 +1080,17 @@ sub test_haveAccess { ); $this->assert( $topicObject->haveAccess('VIEW') ); $this->assert( $topicObject->haveAccess('CHANGE') ); - $topicObject->finish(); + undef $topicObject; my $webObject = Foswiki::Meta->new( session => $this->session, web => $this->test_web ); $this->assert( $webObject->haveAccess('VIEW') ); $this->assert( $webObject->haveAccess('CHANGE') ); - $webObject->finish(); + undef $webObject; my $rootObject = Foswiki::Meta->new( session => $this->session ); $this->assert( $rootObject->haveAccess('VIEW') ); $this->assert( not $rootObject->haveAccess('CHANGE') ); - $rootObject->finish(); return; } @@ -1145,7 +1128,6 @@ HERE $this->assert_equals( 'TemiVarghese', $ti->{author} ); $this->assert_equals( 10, $ti->{version} ); $this->assert_equals( 1306913758, $ti->{date} ); - $meta->finish(); return; } @@ -1188,7 +1170,6 @@ HERE $this->assert_equals( 'BaseUserMapping_666', $ti->{author} ); $this->assert_equals( 0, $ti->{version} ); $this->assert_equals( 0, $ti->{date} ); - $meta->finish(); return; } diff --git a/UnitTestContrib/test/unit/PluginHandlerTests.pm b/UnitTestContrib/test/unit/PluginHandlerTests.pm index cef43dfc0e..7e1d15bf4b 100644 --- a/UnitTestContrib/test/unit/PluginHandlerTests.pm +++ b/UnitTestContrib/test/unit/PluginHandlerTests.pm @@ -303,7 +303,7 @@ HERE "Zero%INCLUDE{\"" . $this->test_web . ".IncludedTopic\"}%", "Tropic", "Werb", $meta ); $this->assert_str_equals( $expanded, "TwoBOO" ); - $meta->finish(); + undef $meta; $this->checkCalls( 1, 'beforeCommonTagsHandler' ); $this->checkCalls( 2, 'commonTagsHandler' ); $this->checkCalls( 1, 'afterCommonTagsHandler' ); @@ -353,7 +353,7 @@ HERE $meta->put( 'WIBBLE', { wibble => 'Wibble' } ); Foswiki::Func::expandCommonVariables( "Zeroblah", "Tropic", "Werb", $meta ); - $meta->finish(); + undef $meta; $this->checkCalls( 1, 'beforeCommonTagsHandler' ); $this->checkCalls( 1, 'commonTagsHandler' ); $this->checkCalls( 1, 'afterCommonTagsHandler' ); diff --git a/UnitTestContrib/test/unit/PrefsTests.pm b/UnitTestContrib/test/unit/PrefsTests.pm index 463380c615..8a2d9c1529 100644 --- a/UnitTestContrib/test/unit/PrefsTests.pm +++ b/UnitTestContrib/test/unit/PrefsTests.pm @@ -38,7 +38,7 @@ around set_up => sub { try { my $webObject = $this->populateNewWeb( $Foswiki::cfg{SystemWebName}, $original ); - $webObject->finish(); + undef $webObject; my ($m) = Foswiki::Func::readTopic( $original, $Foswiki::cfg{SitePrefsTopicName} ); diff --git a/UnitTestContrib/test/unit/RegisterTests.pm b/UnitTestContrib/test/unit/RegisterTests.pm index 5bd242f1b8..7893723e0e 100644 --- a/UnitTestContrib/test/unit/RegisterTests.pm +++ b/UnitTestContrib/test/unit/RegisterTests.pm @@ -144,7 +144,7 @@ EOF2 # Make the test current user an admin; we will only use # them where necessary (e.g. for bulk registration) - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, $Foswiki::cfg{SuperAdminGroup} ); @@ -154,7 +154,7 @@ EOF2 EOF $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->users_web, 'UserForm' ); $topicObject->text(<<'EOF'); @@ -166,11 +166,11 @@ EOF | Comment | textarea | 50x6 | | | EOF $topicObject->save(); - $topicObject->finish(); + undef $topicObject; my $webObject = $this->populateNewWeb( $systemWeb, $Foswiki::cfg{SystemWebName} ); - $webObject->finish(); + undef $webObject; $Foswiki::cfg{SystemWebName} = $systemWeb; $Foswiki::cfg{EnableEmail} = 1; @@ -400,7 +400,7 @@ sub verify_userTopicWithPMWithoutForm { $this->new_user_fname, $this->new_user_sname, $this->new_user_fullname, $this->new_user_wikiname ); - $meta->finish(); + undef $meta; $this->assert( $text !~ /Ignore this%/, $text ); $this->assert( $text =~ s/But not this//, $text ); $this->assert( $text =~ s/^\s*\* First Name: $new_user_fname$//m, $text ); @@ -432,7 +432,7 @@ sub verify_userTopicWithoutPMWithoutForm { my ($meta) = Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, $this->new_user_wikiname ); my $text = $meta->text; - $meta->finish(); + undef $meta; my ( $new_user_fname, $new_user_sname, $new_user_fullname, $new_user_wikiname, $new_user_email @@ -514,7 +514,7 @@ BODY ); $m->save(); - $m->finish(); + undef $m; $this->registerAccount(); @@ -535,7 +535,7 @@ BODY $this->assert_str_equals( '', $field->{value} ); $field = $meta->get( 'FIELD', 'Email' ); - $meta->finish(); + undef $meta; if ($field) { $this->assert_str_equals( $this->new_user_email, $field->{value} ); } @@ -596,7 +596,7 @@ BODY } ); $m->save(); - $m->finish(); + undef $m; $this->registerAccount(); my ($meta) = Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, @@ -611,7 +611,7 @@ BODY $meta->get( 'FIELD', 'LastName' )->{value} ); $this->assert_str_equals( '', $meta->get( 'FIELD', 'Comment' )->{value} ); $this->assert_str_equals( '', $meta->get( 'FIELD', 'Email' )->{value} ); - $meta->finish(); + undef $meta; $this->assert_matches( qr/^\s*$/s, $text ); return; @@ -1488,7 +1488,7 @@ qr/.*Comment: <blah>.*Organization: <script>Bad stuff<\/scri Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, $this->new_user_wikiname ); my $text = $meta->text; - $meta->finish(); + undef $meta; $this->assert_matches( qr/.*Comment: <blah>.*Organization: <script>Bad stuff<\/script>/ms, $text @@ -2535,8 +2535,8 @@ sub verify_resetPassword_NoWikiUsersEntry { my ($to) = Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, $Foswiki::cfg{UsersTopicName} . 'DELETED' ); $from->move($to); - $from->finish(); - $to->finish(); + undef $from; + undef $to; #force a reload to unload existing user caches, and then restart as guest $this->createNewFoswikiSession(); diff --git a/UnitTestContrib/test/unit/RenameTests.pm b/UnitTestContrib/test/unit/RenameTests.pm index 6b9d43d327..15b1d480ca 100644 --- a/UnitTestContrib/test/unit/RenameTests.pm +++ b/UnitTestContrib/test/unit/RenameTests.pm @@ -205,13 +205,13 @@ THIS ); $meta->put( "TOPICPARENT", { name => $this->test_web . ".OldTopic" } ); $meta->save(); - $meta->finish(); + undef $meta; my ($topicObject) = Foswiki::Func::readTopic( $this->new_web, $Foswiki::cfg{HomeTopicName} ); $topicObject->text('junk'); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; # Topic text for template rename tests that contains all references. my $origTemplateRefs = <<"THIS"; @@ -255,7 +255,7 @@ THIS } ); $meta->save(); - $meta->finish(); + undef $meta; $this->assert( Foswiki::Func::topicExists( $this->test_web, 'TmplRefTopic' ) ); @@ -280,7 +280,7 @@ THIS } ); $meta->save(); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'TmplRefMeta1' ); $meta->text("Meta Only"); @@ -294,7 +294,7 @@ THIS } ); $meta->save(); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'TmplRefMeta2' ); $meta->text("Meta Only"); @@ -308,7 +308,7 @@ THIS } ); $meta->save(); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'TmplRefMeta3' ); $meta->text("Meta Only"); @@ -322,7 +322,7 @@ THIS } ); $meta->save(); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'OldViewTemplate' ); $meta->text("Template"); @@ -351,7 +351,7 @@ sub check { my @old = split( /\n+/, $expected ); my @new = split( /\n+/, $actual ); - $meta->finish(); + undef $meta; while ( scalar(@old) ) { my $o = "$num: " . shift(@old); my $n = "$num: " . shift(@new); @@ -371,7 +371,7 @@ sub checkReferringTopics { my ($m) = Foswiki::Func::readTopic( $web, $topic ); my $refs = Foswiki::UI::Rename::_getReferringTopics( $this->session, $m, $all ); - $m->finish(); + undef $m; $this->assert_str_equals( 'HASH', ref($refs) ); my $test_web = $this->test_web; @@ -502,7 +502,7 @@ sub test_renameTemplateThisWeb { my ($m) = Foswiki::Func::readTopic( $this->test_web, 'TmplRefTopic' ); my @lines = split( /\n/, $m->text() ); - $m->finish(); + undef $m; $this->assert_str_equals( " " . $this->test_web . ".OldView", $lines[0] ); $this->assert_str_equals( " " . $this->test_web . ".NewViewTemplate", $lines[1] ); @@ -551,38 +551,38 @@ sub test_referringTopicsThisWeb { [[$ott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeTwo' ); $topicObject->text( <<"THIS" ); [[$lott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'MatchMeThree' ); my $test_web = $this->test_web; $topicObject->text( <<"THIS" ); [[$test_web.$ott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'MatchMeFour' ); $topicObject->text(<<"THIS" ); [[$test_web.$lott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NoMatch' ); $topicObject->text(<<"THIS" ); Refer to $ott and $lott THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'NoMatch' ); $topicObject->text(<<"THIS" ); Refer to $ott and $lott THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; if ( $^O eq 'MSWin32' ) { $this->expect_failure(); @@ -624,38 +624,38 @@ sub test_renameTopic_find_referring_topics_in_all_webs { [[$ott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeTwo' ); $topicObject->text( <<"THIS" ); [[$lott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'MatchMeThree' ); my $test_web = $this->test_web; $topicObject->text( <<"THIS" ); [[$test_web.$ott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'MatchMeFour' ); $topicObject->text( <<"THIS" ); [[$test_web.$lott]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'NoMatch' ); $topicObject->text( <<"THIS" ); Refer to $ott and $lott THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->new_web, 'NoMatch' ); $topicObject->text(<<"THIS" ); Refer to $ott and $lott THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; # All webs $this->checkReferringTopics( @@ -685,52 +685,52 @@ sub test_renameTopic_find_referring_topics_when_renamed_topic_is_not_a_WikiWord $notawwtopic1 $notawwtopic1 $notawwtopic1 THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeTwo' ); $topicObject->text( <<"THIS" ); $notawwtopic3 $notawwtopic3 $notawwtopic3 THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeThree' ); $topicObject->text( <<"THIS" ); $notawwtopic2 $notawwtopic2 $notawwtopic2 THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeFour' ); $topicObject->text( <<'THIS' ); RanDom RanDom RanDom THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeFive' ); $topicObject->text( <<"THIS" ); [[$notawwtopic1]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeSix' ); $topicObject->text( <<"THIS" ); [[$notawwtopic3]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeSeven' ); $topicObject->text( <<"THIS" ); [[$notawwtopic2]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'MatchMeEight' ); $topicObject->text( <<'THIS' ); [[RanDom]] THIS $topicObject->save(); - $topicObject->finish(); + undef $topicObject; if ( $^O eq 'MSWin32' ) { $this->expect_failure(); @@ -794,7 +794,7 @@ sub test_rename_topic_reference_in_denied_web { my ($m) = Foswiki::Func::readTopic( $this->test_web, $fnord ); $m->text(""); $m->save(); - $m->finish(); + undef $m; # Create a subweb Foswiki::Func::createWeb( $this->test_web . "/Swamp" ); @@ -803,14 +803,14 @@ sub test_rename_topic_reference_in_denied_web { ($m) = Foswiki::Func::readTopic( $this->test_web . "/Swamp", 'TopSecret' ); $m->text( "[[" . $this->test_web . ".$fnord]]" ); $m->save(); - $m->finish(); + undef $m; # Make sure the subweb is unprotected (readable) ($m) = Foswiki::Func::readTopic( $this->test_web . "/Swamp", 'WebPreferences' ); $m->text(" * Set ALLOWWEBCHANGE = \n * Set ALLOWWEBVIEW = \n"); $m->save(); - $m->finish(); + undef $m; # Have to restart to clear prefs cache $this->_reset_session(); @@ -823,7 +823,7 @@ sub test_rename_topic_reference_in_denied_web { Foswiki::Func::readTopic( $this->test_web . "/Swamp", 'WebPreferences' ); $m->text(" * Set ALLOWWEBVIEW = PickMeOhPickMe"); $m->save(); - $m->finish(); + undef $m; # Have to restart to clear prefs cache $this->_reset_session(); @@ -843,7 +843,7 @@ sub test_rename_topic_reference_in_denied_web { Foswiki::Func::readTopic( $this->test_web . "/Swamp", 'WebPreferences' ); $m->text(" * Set ALLOWWEBCHANGE = PickMeOhPickMe"); $m->save(); - $m->finish(); + undef $m; # Have to restart to clear prefs cache $this->_reset_session(); @@ -1268,7 +1268,7 @@ sub test_renameTopic_new_web_same_topic_name_no_access { 'WebPreferences' ); $m->text(" * Set ALLOWWEBCHANGE = NotMe\n * Set ALLOWWEBVIEW = \n"); $m->save(); - $m->finish(); + undef $m; $this->_reset_session( { @@ -1313,7 +1313,7 @@ sub test_renameTopic_nonWikiWord_same_web_new_topic_name { my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'OldTopic' ); $meta->put( "TOPICPARENT", { name => 'Tmp1' } ); $meta->save(); - $meta->finish(); + undef $meta; $this->checkReferringTopics( $this->test_web, 'Tmp1', 0, [ $this->test_web . ".OldTopic", ] ); @@ -1344,7 +1344,6 @@ sub test_renameTopic_nonWikiWord_same_web_new_topic_name { ($meta) = Foswiki::Func::readTopic( $this->test_web, 'OldTopic' ); $this->assert_str_equals( 'Tmp2', $meta->getParent() ); - $meta->finish(); return; } @@ -1374,7 +1373,7 @@ THIS Foswiki::Func::readTopic( $this->test_web, 'lowercase' ); $topicObject->text($topictext); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->_reset_session( { action => 'rename', @@ -1412,7 +1411,7 @@ sub test_renameTopic_TOPICRENAME_access_denied { my ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'OldTopic' ); $topicObject->text($topictext); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->_reset_session( { action => 'rename', @@ -1455,7 +1454,7 @@ sub test_renameTopic_WEBRENAME_access_denied { $Foswiki::cfg{WebPrefsTopicName} ); $topicObject->text($topictext); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; $this->_reset_session( { action => 'rename', @@ -1502,7 +1501,6 @@ sub test_renameTopic_preserves_history { Foswiki::Func::readTopic( $this->test_web, $topicName ); $topicObject->text( $history[$depth] ); $topicObject->save( forcenewrevision => 1 ); - $topicObject->finish(); } $this->_reset_session( { @@ -1521,7 +1519,6 @@ sub test_renameTopic_preserves_history { my $info = $m->getRevisionInfo(); $this->assert_equals( scalar(@history), $info->{version} ) ; # rename adds a revision - $m->finish(); return; } @@ -1545,11 +1542,10 @@ sub test_renameTopic_ensure_leases_are_released { ); $this->captureWithKey( rename => $UI_FN, $this->session ); - $m->finish(); + undef $m; ($m) = Foswiki::Func::readTopic( $this->test_web, 'OldTopic' ); my $lease = $m->getLease(); $this->assert_null( $lease, $lease ); - $m->finish(); return; } @@ -1624,11 +1620,11 @@ CONTENT ); $this->assert( !Foswiki::Func::webExists( $this->test_web . "/Renamedweb" ) ); - $m->finish(); + undef $m; ($m) = Foswiki::Func::readTopic( $this->test_web . "/Notrenamedweb", 'ReferringTopic' ); my @lines = split( /\n/, $m->text() ); - $m->finish(); + undef $m; $this->assert_str_equals( $this->test_web . "/Notrenamedweb/Renamedweb.Subweb", $lines[0] ); @@ -1702,7 +1698,7 @@ EOF path_info => "/Renamed" . $this->test_web . "/WebHome" } ); - $m->finish(); + undef $m; my ($text) = $this->captureWithKey( rename => $UI_FN, $this->session ); $this->assert( @@ -1737,7 +1733,6 @@ EOF $this->assert_str_equals( "[[" . $this->test_web . "/Renamed" . $this->test_web . ".Subweb]]", $lines[8] ); - $m->finish(); return; } @@ -1779,7 +1774,7 @@ CONTENT * Set GROUP = $test_user_wikiname EOF $grope->save(); - $grope->finish(); + undef $grope; $this->_reset_session( { @@ -1789,7 +1784,7 @@ EOF path_info => "/" . $this->test_web . "EdNet/WebHome" } ); - $m->finish(); + undef $m; my ($text) = $this->captureWithKey( rename => $UI_FN, $this->session ); $this->assert( @@ -1801,7 +1796,7 @@ EOF ($m) = Foswiki::Func::readTopic( $this->test_web . "RenamedEdNet", 'ReferringTopic' ); my @lines = split( /\n/, $m->text() ); - $m->finish(); + undef $m; #foreach my $ln ( @lines ) { # print "LINE ($ln)\n"; @@ -1898,7 +1893,7 @@ EOF path_info => "/" . $this->test_web . "Root/EdNet/WebHome" } ); - $m->finish(); + undef $m; my ($text) = $this->captureWithKey( rename => $UI_FN, $this->session ); $this->assert( @@ -1910,7 +1905,7 @@ EOF ($m) = Foswiki::Func::readTopic( $this->test_web . "Root/NewEdNet", 'ReferringTopic' ); my @lines = split( /\n/, $m->text() ); - $m->finish(); + undef $m; #foreach my $ln ( @lines ) { # print "LINE ($ln)\n"; @@ -1968,7 +1963,7 @@ sub test_rename_attachment { my ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text('Wibble'); $to->save(); - $to->finish(); + undef $to; # returns undef on OSX with 3.15 version of CGI module (works on 3.42) my $stream = File::Temp->new( UNLINK => 0 ); @@ -1978,7 +1973,7 @@ sub test_rename_attachment { ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->attach( name => 'dis.dat', file => $stream->filename ); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2014,7 +2009,7 @@ sub test_move_attachment_RENAME_Topic_denied { my ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text('Wibble'); $to->save(); - $to->finish(); + undef $to; # returns undef on OSX with 3.15 version of CGI module (works on 3.42) my $stream = File::Temp->new( UNLINK => 0 ); @@ -2026,7 +2021,7 @@ sub test_move_attachment_RENAME_Topic_denied { $to->text("Wibble\n * Set ALLOWTOPICRENAME = NotMe\n"); $to->attach( name => 'dis.dat', file => $stream->filename ); $to->save(); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2057,7 +2052,7 @@ sub test_move_attachment_RENAME_Topic_denied { ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->text("Wibble\n * Set ALLOWTOPICCHANGE = NotMe\n"); $to->save(); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2107,12 +2102,12 @@ sub test_move_attachment_RENAME_Web_denied { my ($m) = Foswiki::Func::readTopic( $this->test_web, 'WebPreferences' ); $m->text(" * Set ALLOWWEBRENAME = NotMe\n"); $m->save(); - $m->finish(); + undef $m; my ($to) = Foswiki::Func::readTopic( $this->new_web, 'NewTopic' ); $to->text('Wibble'); $to->save(); - $to->finish(); + undef $to; # returns undef on OSX with 3.15 version of CGI module (works on 3.42) my $stream = File::Temp->new( UNLINK => 0 ); @@ -2123,7 +2118,7 @@ sub test_move_attachment_RENAME_Web_denied { ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->text("Wibble\n"); $to->attach( name => 'dis.dat', file => $stream->filename ); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2162,7 +2157,7 @@ sub test_rename_attachment_Rename_Denied_Change_Allowed { my ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text("Wibble\n * Set ALLOWTOPICRENAME = NotMe\n"); $to->save(); - $to->finish(); + undef $to; # returns undef on OSX with 3.15 version of CGI module (works on 3.42) my $stream = File::Temp->new( UNLINK => 0 ); @@ -2172,7 +2167,7 @@ sub test_rename_attachment_Rename_Denied_Change_Allowed { ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->attach( name => 'dis.dat', file => $stream->filename ); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2209,7 +2204,7 @@ sub test_rename_attachment_Rename_Allowed_Change_Denied { my ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text("Wibble\n * Set ALLOWTOPICCHANGE = NotMe\n"); $to->save(); - $to->finish(); + undef $to; # returns undef on OSX with 3.15 version of CGI module (works on 3.42) my $stream = File::Temp->new( UNLINK => 0 ); @@ -2219,7 +2214,7 @@ sub test_rename_attachment_Rename_Allowed_Change_Denied { ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->attach( name => 'dis.dat', file => $stream->filename ); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2264,11 +2259,11 @@ sub test_rename_attachment_not_in_meta { my ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text('Wibble'); $to->save(); - $to->finish(); + undef $to; ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); my $fh = $to->openAttachment( 'dis.dat', '>' ); - $to->finish(); + undef $to; print $fh "Oh no not again"; $this->assert( close($fh) ); @@ -2307,7 +2302,7 @@ sub test_rename_attachment_no_dest_topic { my ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); my $fh = $to->openAttachment( 'dis.dat', '>' ); - $to->finish(); + undef $to; print $fh "Oh no not again"; $this->assert( close($fh) ); @@ -2351,7 +2346,7 @@ sub do_not_test_rename_attachment_not_on_disc { my ($to) = Foswiki::Func::readTopic( $this->test_web, $this->test_topic ); $to->attach( name => 'dis.dat', file => $stream->filename ); - $to->finish(); + undef $to; unless ( -e "$Foswiki::cfg{PubDir}/" . $this->test_web . "/" @@ -2371,7 +2366,7 @@ sub do_not_test_rename_attachment_not_on_disc { ($to) = Foswiki::Func::readTopic( $this->test_web, 'NewTopic' ); $to->text('Wibble'); $to->save(); - $to->finish(); + undef $to; $this->_reset_session( { @@ -2424,7 +2419,7 @@ sub test_renameWeb_10990 { * Set GROUP = $test_user_wikiname EOF $grope->save(); - $grope->finish(); + undef $grope; $this->_reset_session( { diff --git a/UnitTestContrib/test/unit/SaveScriptTests.pm b/UnitTestContrib/test/unit/SaveScriptTests.pm index e75408fab1..639a6ec0f9 100644 --- a/UnitTestContrib/test/unit/SaveScriptTests.pm +++ b/UnitTestContrib/test/unit/SaveScriptTests.pm @@ -127,22 +127,22 @@ around set_up => sub { Foswiki::Func::readTopic( $this->test_web, 'TestForm1' ); $topicObject->text($testform1); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'TestForm2' ); $topicObject->text($testform2); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'TestForm3' ); $topicObject->text($testform3); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, 'TestForm4' ); $topicObject->text($testform4); $topicObject->save(); - $topicObject->finish(); + undef $topicObject; ($topicObject) = Foswiki::Func::readTopic( $this->test_web, @@ -152,7 +152,6 @@ around set_up => sub { * Set DENYWEBCHANGE = DuckDodgers CONTENT $topicObject->save(); - $topicObject->finish(); return; }; @@ -323,7 +322,6 @@ sub test_emptySave { my $text = $meta->text; $this->assert_matches( qr/^\s*$/, $text ); $this->assert_null( $meta->get('FORM') ); - $meta->finish(); return; } @@ -381,7 +379,6 @@ sub test_simpleTextSave { my $text = $meta->text; $this->assert_matches( qr/CORRECT/, $text ); $this->assert_null( $meta->get('FORM') ); - $meta->finish(); return; } @@ -456,7 +453,6 @@ sub test_templateTopicTextSave { my $text = $meta->text; $this->assert_matches( qr/Template Topic/, $text ); $this->assert_null( $meta->get('FORM') ); - $meta->finish(); return; } @@ -487,7 +483,6 @@ sub test_prevTopicTextSave { my $text = $meta->text; $this->assert_matches( qr/CORRECT/, $text ); $this->assert_null( $meta->get('FORM') ); - $meta->finish(); return; } @@ -545,7 +540,6 @@ sub test_prevTopicEmptyTextSave { my $text = $meta->text; $this->assert_matches( qr/^\s*CORRECT\s*$/, $text ); $this->assert_null( $meta->get('FORM') ); - $meta->finish(); return; } @@ -573,7 +567,6 @@ sub test_simpleFormSave { # field default values should be all '' $this->assert_str_equals( 'Flintstone', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -595,7 +588,7 @@ sub test_templateTopicFormSave { my ($xmeta) = Foswiki::Func::readTopic( $this->test_web, 'TemplateTopic' ); my $xtext = $xmeta->text; - $xmeta->finish(); + undef $xmeta; $query = Unit::Request->new( initializer => { templatetopic => ['TemplateTopic'], @@ -615,7 +608,6 @@ sub test_templateTopicFormSave { $meta->get( 'FIELD', 'Select' )->{value} ); $this->assert_str_equals( 'Fred', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -657,7 +649,6 @@ sub test_prevTopicFormSave { $meta->get( 'FIELD', 'Select' )->{value} ); $this->assert_str_equals( 'Barney', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -686,7 +677,6 @@ sub test_simpleFormSave1 { $this->assert_str_equals( 'TestForm1', $meta->get('FORM')->{name} ); $this->assert_str_equals( 'Test', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -704,7 +694,7 @@ sub test_simpleFormSave2 { my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'SimpleFormSave2' ); $meta->text($testform1); $meta->copyFrom($oldmeta); - $oldmeta->finish(); + undef $oldmeta; $meta->save( user => $this->test_user_login ); my $query = Unit::Request->new( @@ -724,14 +714,13 @@ sub test_simpleFormSave2 { $this->captureWithKey( save => $UI_FN, $this->session ); $this->assert( $this->session->topicExists( $this->test_web, 'SimpleFormSave2' ) ); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'SimpleFormSave2' ); my $text = $meta->text; $this->assert_str_equals( 'TestForm3', $meta->get('FORM')->{name} ); $this->assert_str_equals( 'Test', $meta->get( 'FIELD', 'Textfield' )->{value} ); $this->assert_null( $meta->get( 'FIELD', 'CheckboxandButtons' ) ); - $meta->finish(); return; } @@ -749,7 +738,7 @@ sub test_simpleFormSave3 { my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'SimpleFormSave3' ); $meta->text($testform1); $meta->copyFrom($oldmeta); - $oldmeta->finish(); + undef $oldmeta; $meta->save( user => $this->test_user_login ); my $query = Unit::Request->new( @@ -769,13 +758,12 @@ sub test_simpleFormSave3 { $this->captureWithKey( save => $UI_FN, $this->session ); $this->assert( $this->session->topicExists( $this->test_web, 'SimpleFormSave3' ) ); - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'SimpleFormSave3' ); my $text = $meta->text; $this->assert($meta); $this->assert_str_equals( 'UserTopic', $meta->get( 'PREFERENCE', 'VIEW_TEMPLATE' )->{value} ); - $meta->finish(); return; } @@ -805,7 +793,6 @@ sub test_simpleFormSaveZeroValue { $this->assert_str_equals( '0', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -833,7 +820,6 @@ sub test_simpleFormSaveEmptyValue { $this->assert_str_equals( 'TestForm1', $meta->get('FORM')->{name} ); $this->assert_str_equals( '', $meta->get( 'FIELD', 'Textfield' )->{value} ); - $meta->finish(); return; } @@ -860,7 +846,6 @@ sub test_templateTopicWithMeta { my $pref = $meta->get( 'PREFERENCE', 'VIEW_TEMPLATE' ); $this->assert_not_null($pref); $this->assert_str_equals( 'UserTopic', $pref->{value} ); - $meta->finish(); return; } @@ -929,7 +914,6 @@ sub test_templateTopicWithAttachments { "testfile.txt copied" ); $this->assert( $meta->testAttachment( "testfile2.txt", 'e' ), "testfile2.txt copied" ); - $meta->finish(); return; } @@ -947,7 +931,7 @@ sub test_merge { $oldmeta->text($testform4); $oldmeta->save( user => $this->test_user_2_login ); - $oldmeta->finish(); + undef $oldmeta; my ($meta) = Foswiki::Func::readTopic( $this->test_web, 'MergeSave' ); my $text = $meta->text; my $info = $meta->getRevisionInfo(); @@ -1024,7 +1008,7 @@ GUMP }; # Get the merged topic and pick it apart - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'MergeSave' ); $text = $meta->text; my $e = <<'END'; @@ -1175,7 +1159,7 @@ sub test_1897 { $meta->copyFrom($oldmeta); $meta->text("Smelly\ncat"); $meta->save(); - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, 'MergeSave' ); @@ -1237,7 +1221,7 @@ sub test_1897 { } }; - $meta->finish(); + undef $meta; ($meta) = Foswiki::Func::readTopic( $this->test_web, 'MergeSave' ); $text = $meta->text(); @@ -1249,7 +1233,6 @@ sub test_1897 { "Sweaty\nSmelly\ncat\nrat\n", $text ); - $meta->finish(); return; } @@ -1274,7 +1257,7 @@ sub test_cmdEqualsReprev { $meta->copyFrom($oldmeta); $meta->text("Les Miserables"); $meta->save(); - $meta->finish(); + undef $meta; ( $meta, $text ) = Foswiki::Func::readTopic( $this->test_web, 'RepRev' ); @@ -1314,7 +1297,6 @@ sub test_cmdEqualsReprev { # systems (see note in Meta.pm) print STDERR "$orgDate + 60, $repRevDate\n"; $this->assert( $orgDate < $repRevDate ); - $meta->finish(); return; } @@ -1420,7 +1402,7 @@ sub test_preferenceSave { $meta->get( 'PREFERENCE', 'SETME' )->{value} ); $this->assert_equals( 'set me 2', $meta->get( 'PREFERENCE', 'SETME2' )->{value} ); - $meta->finish(); + undef $meta; $query = Unit::Request->new( initializer => { @@ -1445,7 +1427,6 @@ sub test_preferenceSave { $this->assert_null( $meta->get( 'PREFERENCE', 'LOCALME' ) ); $this->assert_null( $meta->get( 'PREFERENCE', 'SETME2' ) ); $this->assert_null( $meta->get( 'PREFERENCE', 'LOCALME2' ) ); - $meta->finish(); return; } diff --git a/UnitTestContrib/test/unit/TOCTests.pm b/UnitTestContrib/test/unit/TOCTests.pm index 7a20d8dce4..e352dbf18a 100644 --- a/UnitTestContrib/test/unit/TOCTests.pm +++ b/UnitTestContrib/test/unit/TOCTests.pm @@ -177,7 +177,6 @@ s/
/<\/a>
/<\/a>/g; } $this->assert_html_equals( $expected, $res ); - $topicObject->finish(); } sub test_Item9009 { @@ -205,7 +204,7 @@ HERE $topicObject->save(); my $res2 = $topicObject2->expandMacros($text2); $res2 = $topicObject->renderTML($res2); - $topicObject->finish(); + undef $topicObject; #return; @@ -252,7 +251,7 @@ HERE $topicObject->save(); my $res2 = $topicObject2->expandMacros($text2); $res2 = $topicObject->renderTML($res2); - $topicObject->finish(); + undef $topicObject; my $expected = <