Changeset 13773
- Timestamp:
- 01/21/12 01:49:56 (4 months ago)
- Location:
- branches/Release01x01
- Files:
-
- 2 edited
-
UnitTestContrib/test/unit/PluginHandlerTests.pm (modified) (6 diffs)
-
core/lib/Foswiki/Meta.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x01/UnitTestContrib/test/unit/PluginHandlerTests.pm
r13729 r13773 152 152 $Foswiki::cfg{Plugins}{ $this->{plugin_name} }{Module} = 153 153 "Foswiki::Plugins::$this->{plugin_name}"; 154 $this->{session}->finish(); 155 $this->{session} = new Foswiki(); # default user 154 $this->createNewFoswikiSession(); 156 155 eval "\$Foswiki::Plugins::$this->{plugin_name}::tester = \$this;"; 157 156 $this->checkCalls( 1, 'initPlugin' ); … … 190 189 191 190 my $q = Foswiki::Func::getRequestObject(); 192 $this->{session}->finish(); 193 $this->{session} = new Foswiki( $Foswiki::cfg{GuestUserLogin}, $q ); 191 $this->createNewFoswikiSession( $Foswiki::cfg{GuestUserLogin}, $q ); 194 192 195 193 $this->makePlugin( 'saveHandlers', <<'HERE'); … … 216 214 $tester->assert_str_equals('Wibble', $_[4]->get('WIBBLE')->{wibble}); 217 215 $tester->assert_matches( qr/B4SAVE/, $_[0]); 218 Foswiki::Func::pushTopicContext( $this->{test_web}, 'Tropic' ); 219 220 #SMELL: This fails due to cached preferences 221 #$tester->assert_str_equals( "AFTER", 222 # $_[4]->getPreference("BLAH")); 216 217 $tester->assert_str_equals( "AFTER", 218 $_[4]->getPreference("BLAH")); 223 219 224 220 #SMELL: And for some reason this returns null instead of either BEFORE or AFTER 225 #Foswiki::Func::getPreferencesValue("BLAH") ); 221 # Foswiki::Func::pushTopicContext( $this->{test_web}, 'Tropic' ); 222 # $tester->assert_str_equals( "AFTER", 223 # Foswiki::Func::getPreferencesValue("BLAH") ); 224 226 225 $called->{afterSaveHandler}++; 227 226 } … … 237 236 $this->checkCalls( 1, 'afterSaveHandler' ); 238 237 238 $this->createNewFoswikiSession(); # undef, $topicquery ); 239 Foswiki::Func::pushTopicContext( $this->{test_web}, 'Tropic' ); 240 239 241 my $newMeta = 240 242 Foswiki::Meta->load( $this->{session}, $this->{test_web}, "Tropic" ); … … 243 245 $this->assert_str_equals( "AFTER", $newMeta->getPreference("BLAH") ); 244 246 245 #SMELL: Without this call, getPreferences returns BEFORE246 Foswiki::Func::pushTopicContext( $this->{test_web}, 'Tropic' );247 247 $this->assert_str_equals( "AFTER", 248 248 Foswiki::Func::getPreferencesValue("BLAH") ); … … 687 687 HERE 688 688 689 $this-> {session}->finish();689 $this->createNewFoswikiSession(); 690 690 $this->checkCalls( 1, 'finishPlugin' ); 691 $this->{session} = new Foswiki();692 691 } 693 692 -
branches/Release01x01/core/lib/Foswiki/Meta.pm
r13769 r13773 1939 1939 if ( $plugins->haveHandlerFor('afterSaveHandler') ) { 1940 1940 my $text = $this->getEmbeddedStoreForm(); 1941 delete $this->{_preferences}; # Make sure handler has changed prefs 1941 1942 my $error = $signal ? $signal->{-text} : undef; 1942 1943 $plugins->dispatch( 'afterSaveHandler', $text, $this->{_topic},
Note: See TracChangeset
for help on using the changeset viewer.
