in reply to Where can I buy an $r with which to test Apache2::Cookie?
UPDATE: maybe solved. Thanks to everyone for the help.
Having chosen Door Number 3, it seems at least some of it is easier than I'd feared. This, for example, seems to work, except for the last test:
use strict; use warnings; use Test::More tests => 5; use CGI; use Test::MockObject; use Apache2::Cookie 2.08; # This gets me started. my $r = Test::MockObject->new(); $r->mock( pool => sub { return APR::Pool->new; } ); # This part looks good. my $c = Apache2::Cookie->new( $r, # mocked -name => 'mycookie', -value => 'whatever' ) or die "no cookie for you"; isa_ok( $c, 'Apache2::Cookie' ); is( $c->value, 'whatever', "value" ); # This works for some values, but doing random # stuff via chr() can break it. I need to write # more tests to figure out whether that's my fault. my $val = "über die Straße"; my $c2 = Apache2::Cookie->new( $r, # mocked -name => 'mycookie', -value => $val ) or die "no cookie for you"; like( $c2->as_string, qr/[a-zA-Z0-9%=]+/, "as_string encoded" ); is( $c2->value, $val, "value not encoded" ); # Uh-oh, this is busted. I think I can live # without it, but it's annoying. eval { $c2->raw_value(); }; is( $@, '', "raw_value() doesn't die" );
That last test gets me this error:
Can't locate auto/Apache2/Cookie/raw_value.al in @INC
Joy. If it's just a case of the docs being wrong, yet the code working, then I'm OK with that. I can file a documentation bug, with a test and a patch, if I can prove it.
I'm sure I have the right version installed, and as I built it from source I'm also sure all its non-skipped tests.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Where can I buy an $r with which to test Apache2::Cookie?
by dbooth (Novice) on Jan 04, 2012 at 03:55 UTC |