PseudoRequest shouldn't clobber Apache2::Cookies if the package already exists; mock requests are sometimes useful under mod_perl and this is a bit of a gotcha

This commit is contained in:
Scott Walters 2012-06-19 16:17:26 -04:00
parent db3058c0b7
commit 225df67d1f
2 changed files with 19 additions and 14 deletions

View file

@ -1,4 +1,5 @@
7.10.25 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 #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 #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 - fixed #12010 related link duplication where links have group view restrictions

View file

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