Skip to content
Browse files

Fixed bug in $r->server tests

  • Loading branch information...
1 parent d9881b4 commit f454af250ff7247bf07b5f8135284cf09cb4205f Salve J. Nilsen committed Dec 13, 2011
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/Test/Mock/Apache2.pm
  2. +1 −1 t/config.t
View
6 lib/Test/Mock/Apache2.pm
@@ -103,15 +103,16 @@ sub ap2_server {
=method ap2_request
Return a mock L<Apache2::RequestRec> B<empty> object, with the following
-methods: C<hostname>, C<dir_config>.
+methods: C<hostname>, C<dir_config>, C<server>.
=cut
sub ap2_request {
my $config = shift;
my $r = Test::MockObject->new();
$r->fake_module('Apache2::RequestRec',
- hostname => sub {},
+ hostname => sub {},
+ server => sub { ap2_server($config) },
dir_config => sub { $config->{ $_[1] } },
);
bless $r, 'Apache2::RequestRec';
@@ -165,7 +166,6 @@ sub ap2_requestutil {
my $ap2_ru = Test::MockObject->new();
$ap2_ru->fake_module('Apache2::RequestUtil',
request => sub { ap2_request($config) },
- server => sub { ap2_server($config) },
dir_config => sub { $config->{ $_[1] } },
);
$ap2_ru->fake_new('Apache2::RequestUtil');
View
2 t/config.t
@@ -23,7 +23,7 @@ is($r->dir_config("SomeConfig"), 42, "SomeConfig is 42");
is($r->dir_config("OtherConfig"), 'foo', "OtherConfig is 'foo'");
# $r->server->server_hostname
-my $s = $u->server();
+my $s = $r->server();
ok($s, 'Apache2::RequestUtil->server() returns something');
isa_ok($s, 'Apache2::ServerRec');
ok($s->server_hostname, "server_hostname (ServerName) exists");

0 comments on commit f454af2

Please sign in to comment.
Something went wrong with that request. Please try again.