Skip to content

Commit 225df67

Browse files
committedJun 19, 2012
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

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed
 

‎docs/changelog/7.x.x.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
7.10.25
2+
- fixed: don't clobber the request handler if WebGUI::Test was loaded inside of mod_perl
23
- fixed #12365: editing a metadata may cause a fatal error (Arjan Widlak / United Knowledge)
34
- fixed #12346: toVersion in upgrade_7.9.34-7.10.22.pl was "0.0.0"
45
- fixed #12010 related link duplication where links have group view restrictions

‎t/lib/WebGUI/PseudoRequest.pm

+19-15
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,25 @@ use strict;
1919
use Test::MockObject;
2020

2121
BEGIN {
22-
Test::MockObject->fake_module(
23-
'Apache2::Cookie',
24-
new => sub {
25-
my $class = shift;
26-
my $self = Test::MockObject->new;
27-
$self->set_isa($class);
28-
$self->set_true(qw(expires domain bake));
29-
},
30-
);
31-
32-
Test::MockObject->fake_module('APR::Request::Apache2',
33-
handle => sub {
34-
return $_[1];
35-
},
36-
);
22+
if( do { no strict 'refs'; ! exists ${"Apache2::"}{"Cookie::"} } ) {
23+
Test::MockObject->fake_module(
24+
'Apache2::Cookie',
25+
new => sub {
26+
my $class = shift;
27+
my $self = Test::MockObject->new;
28+
$self->set_isa($class);
29+
$self->set_true(qw(expires domain bake));
30+
},
31+
);
32+
}
33+
34+
if( do { no strict 'refs'; ! exists ${"APR::"}{"Request::"} } ) {
35+
Test::MockObject->fake_module('APR::Request::Apache2',
36+
handle => sub {
37+
return $_[1];
38+
},
39+
);
40+
}
3741
}
3842

3943
use WebGUI::PseudoRequest::Headers;

0 commit comments

Comments
 (0)
Please sign in to comment.