Changeset 13791 for trunk/UnitTestContrib/test/unit/ExceptionTests.pm
- Timestamp:
- 01/23/12 06:00:05 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UnitTestContrib/test/unit/ExceptionTests.pm
r13730 r13791 1 1 package ExceptionTests; 2 use FoswikiFnTestCase; 2 use strict; 3 use warnings; 4 5 use FoswikiFnTestCase(); 3 6 our @ISA = qw( FoswikiFnTestCase ); 4 7 5 use strict;6 7 8 use Error qw( :try ); 8 use Foswiki::OopsException ;9 use Foswiki::AccessControlException ;9 use Foswiki::OopsException(); 10 use Foswiki::AccessControlException(); 10 11 11 12 my $UI_FN; … … 15 16 $this->SUPER::set_up(); 16 17 $UI_FN ||= $this->getUIFn('oops'); 18 19 return; 17 20 } 18 21 … … 44 47 ); 45 48 }; 49 50 return; 46 51 } 47 52 … … 70 75 ); 71 76 }; 77 78 return; 72 79 } 73 80 74 81 sub upchuck { 75 82 my $session = shift; 76 my $e = new Foswiki::OopsException(83 my $e = Foswiki::OopsException->new( 77 84 'templatename', 78 85 web => 'webname', … … 81 88 ); 82 89 $e->redirect($session); 90 91 return; 83 92 } 84 93 … … 86 95 sub deprecated_test_redirectOopsException { 87 96 my $this = shift; 88 my $t = new Foswiki(); 89 my ($output) = $this->capture( \&upchuck, $t ); 90 $t->finish(); 97 $this->createNewFoswikiSession(); 98 my ($output) = $this->capture( \&upchuck, $this->{session} ); 91 99 $this->assert_matches( qr/^Status: 302.*$/m, $output ); 92 100 $this->assert_matches( … … 94 102 $output 95 103 ); 104 105 return; 96 106 } 97 107 98 108 sub test_AccessControlException { 99 109 my $this = shift; 100 my $ace = new Foswiki::AccessControlException( 'FRY', 'burger', 'Spiders',110 my $ace = Foswiki::AccessControlException->new( 'FRY', 'burger', 'Spiders', 101 111 'FlumpNuts', 'Because it was there.' ); 102 112 $this->assert_str_equals( … … 105 115 ); 106 116 117 return; 107 118 } 108 119 109 120 sub test_oopsScript { 110 121 my $this = shift; 111 my $query = new Unit::Request(122 my $query = Unit::Request->new( 112 123 { 113 124 skin => 'none', … … 121 132 } 122 133 ); 123 my $session = new Foswiki( undef, $query );134 $this->createNewFoswikiSession( undef, $query ); 124 135 my ($output) = 125 $this->capture( $UI_FN, $ session, "Flum", "DeDum", $query, 0 );136 $this->capture( $UI_FN, $this->{session}, "Flum", "DeDum", $query, 0 ); 126 137 $this->assert_matches( qr/^phlegm$/m, $output ); 127 138 $this->assert_matches( qr/^<pus>$/m, $output ); … … 132 143 $this->assert_matches( qr/^phlegm$/m, $output ); 133 144 134 $session->finish();145 return; 135 146 } 136 147
Note: See TracChangeset
for help on using the changeset viewer.
