Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PseudoRequest shouldn't clobber Apache2::Cookies if the package alrea…
…dy exists; mock requests are sometimes useful under mod_perl and this is a bit of a gotcha
  • Loading branch information
scottwalters committed Jun 19, 2012
1 parent db3058c commit 225df67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/changelog/7.x.x.txt
@@ -1,4 +1,5 @@
7.10.25
- fixed: don't clobber the request handler if WebGUI::Test was loaded inside of mod_perl
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
- fixed #12346: toVersion in upgrade_7.9.34-7.10.22.pl was "0.0.0"
- fixed #12010 related link duplication where links have group view restrictions
Expand Down
34 changes: 19 additions & 15 deletions t/lib/WebGUI/PseudoRequest.pm
Expand Up @@ -19,21 +19,25 @@ use strict;
use Test::MockObject;

BEGIN {
Test::MockObject->fake_module(
'Apache2::Cookie',
new => sub {
my $class = shift;
my $self = Test::MockObject->new;
$self->set_isa($class);
$self->set_true(qw(expires domain bake));
},
);

Test::MockObject->fake_module('APR::Request::Apache2',
handle => sub {
return $_[1];
},
);
if( do { no strict 'refs'; ! exists ${"Apache2::"}{"Cookie::"} } ) {
Test::MockObject->fake_module(
'Apache2::Cookie',
new => sub {
my $class = shift;
my $self = Test::MockObject->new;
$self->set_isa($class);
$self->set_true(qw(expires domain bake));
},
);
}

if( do { no strict 'refs'; ! exists ${"APR::"}{"Request::"} } ) {
Test::MockObject->fake_module('APR::Request::Apache2',
handle => sub {
return $_[1];
},
);
}
}

use WebGUI::PseudoRequest::Headers;
Expand Down

0 comments on commit 225df67

Please sign in to comment.