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;
|
use Test::MockObject;
|
||||||
|
|
||||||
my $mocker = Test::MockObject->new();
|
Test::MockObject->fake_module(
|
||||||
$mocker->fake_module(
|
'Apache2::Cookie',
|
||||||
'Apache2::Cookie',
|
new => sub {
|
||||||
new => sub { return bless {}, 'Apache2::Cookie'; },
|
my $class = shift;
|
||||||
expires => sub { 1; },
|
my $self = Test::MockObject->new;
|
||||||
domain => sub { 1; },
|
$self->set_isa($class);
|
||||||
bake => sub { 1; },
|
$self->set_true(qw(expires domain bake));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
=head1 LEGAL
|
=head1 LEGAL
|
||||||
|
|
|
||||||
|
|
@ -144,23 +144,20 @@ BEGIN {
|
||||||
# http://thread.gmane.org/gmane.comp.apache.apreq/3378
|
# http://thread.gmane.org/gmane.comp.apache.apreq/3378
|
||||||
# http://article.gmane.org/gmane.comp.apache.apreq/3388
|
# http://article.gmane.org/gmane.comp.apache.apreq/3388
|
||||||
if ( $^O eq 'darwin' && $Config::Config{osvers} lt '8.0.0' ) {
|
if ( $^O eq 'darwin' && $Config::Config{osvers} lt '8.0.0' ) {
|
||||||
|
|
||||||
require Class::Null;
|
|
||||||
require IO::File;
|
|
||||||
|
|
||||||
unshift @INC, sub {
|
unshift @INC, sub {
|
||||||
return undef unless $_[1] =~ m/^Apache2|APR/;
|
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::OK = sub { 0 };
|
||||||
*Apache2::Const::DECLINED = sub { -1 };
|
*Apache2::Const::DECLINED = sub { -1 };
|
||||||
*Apache2::Const::NOT_FOUND = sub { 404 };
|
*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/;
|
warn qq/Failed to require package 'WebGUI::Session'. Reason: '$@'.\n/;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +168,6 @@ BEGIN {
|
||||||
$SESSION->{_request} = $pseudoRequest;
|
$SESSION->{_request} = $pseudoRequest;
|
||||||
|
|
||||||
$originalSetting = clone $SESSION->setting->get;
|
$originalSetting = clone $SESSION->setting->get;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END {
|
END {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue