diff --git a/t/lib/WebGUI/PseudoRequest.pm b/t/lib/WebGUI/PseudoRequest.pm index 4ef9e2747..f489ebd8d 100644 --- a/t/lib/WebGUI/PseudoRequest.pm +++ b/t/lib/WebGUI/PseudoRequest.pm @@ -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 diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 47e9bc509..6811a99c9 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -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 {