1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!perl
use warnings;
use strict;
use Test::More tests => 7;
BEGIN {
use_ok( 'Test::WWW::Mechanize' );
}
NEW: {
my $m = Test::WWW::Mechanize->new;
isa_ok( $m, 'Test::WWW::Mechanize' );
}
# Stolen from WWW::Mechanize's t/new.t.
# If this works, then subclassing works OK.
CONSTRUCTOR_PARMS: {
my $alias = "Windows IE 6";
my $m = Test::WWW::Mechanize->new( agent => $alias );
isa_ok( $m, 'Test::WWW::Mechanize' );
can_ok( $m, 'request' );
is( $m->agent, $alias, "Aliases don't get translated in the constructor" );
$m->agent_alias( $alias );
like( $m->agent, qr/^Mozilla.+compatible.+Windows/, "Alias sets the agent" );
$m->agent( "ratso/bongo v.43" );
is( $m->agent, "ratso/bongo v.43", "Can still set the agent" );
}
|