some small test library cleanups
This commit is contained in:
parent
79b849262c
commit
86bacc54c6
2 changed files with 13 additions and 16 deletions
|
|
@ -4,13 +4,14 @@ use strict;
|
|||
|
||||
use Test::MockObject;
|
||||
|
||||
my $mocker = Test::MockObject->new();
|
||||
$mocker->fake_module(
|
||||
'Apache2::Cookie',
|
||||
new => sub { return bless {}, 'Apache2::Cookie'; },
|
||||
expires => sub { 1; },
|
||||
domain => sub { 1; },
|
||||
bake => sub { 1; },
|
||||
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));
|
||||
}
|
||||
);
|
||||
|
||||
=head1 LEGAL
|
||||
|
|
|
|||
|
|
@ -144,23 +144,20 @@ BEGIN {
|
|||
# http://thread.gmane.org/gmane.comp.apache.apreq/3378
|
||||
# http://article.gmane.org/gmane.comp.apache.apreq/3388
|
||||
if ( $^O eq 'darwin' && $Config::Config{osvers} lt '8.0.0' ) {
|
||||
|
||||
require Class::Null;
|
||||
require IO::File;
|
||||
|
||||
unshift @INC, sub {
|
||||
return undef unless $_[1] =~ m/^Apache2|APR/;
|
||||
return IO::File->new( $INC{'Class/Null.pm'}, &IO::File::O_RDONLY );
|
||||
my $buffer = '1';
|
||||
open my $fh, '<', \$buffer;
|
||||
return $fh;
|
||||
};
|
||||
|
||||
no strict 'refs';
|
||||
|
||||
no warnings 'redefine';
|
||||
*Apache2::Const::OK = sub { 0 };
|
||||
*Apache2::Const::DECLINED = sub { -1 };
|
||||
*Apache2::Const::NOT_FOUND = sub { 404 };
|
||||
}
|
||||
|
||||
unless ( eval "require WebGUI::Session;" ) {
|
||||
unless ( eval { require WebGUI::Session; } ) {
|
||||
warn qq/Failed to require package 'WebGUI::Session'. Reason: '$@'.\n/;
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -171,7 +168,6 @@ BEGIN {
|
|||
$SESSION->{_request} = $pseudoRequest;
|
||||
|
||||
$originalSetting = clone $SESSION->setting->get;
|
||||
|
||||
}
|
||||
|
||||
END {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue