11 if (gethostbyname('blahblahblah.xx-only-testing.')) {
12 plan skip_all => 'Found an A record for the non-existent domain';
18 delete @ENV{ grep { lc eq 'http_proxy' } keys %ENV };
19 delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
20 use_ok( 'WWW::Mechanize' );
23 my $server = LocalServer->spawn;
24 isa_ok( $server, 'LocalServer' );
27 my $mech = WWW::Mechanize->new;
28 isa_ok( $mech, 'WWW::Mechanize', 'Created object' );
31 my $response = $mech->get($server->url);
32 isa_ok( $response, 'HTTP::Response' );
33 ok( $response->is_success, 'Success' );
34 ok( $mech->success, 'Get webpage' );
35 ok( $mech->is_html, 'It\'s HTML' );
36 is( $mech->title, 'WWW::Mechanize::Shell test page', 'Correct title' );
38 my @links = $mech->links;
39 is( scalar @links, 10, '10 links, please' );
40 my @forms = $mech->forms;
41 is( scalar @forms, 1, 'One form' );
42 isa_ok( $forms[0], 'HTML::Form' );
46 my $badurl = "http://blahblahblah.xx-only-testing.";
47 $mech->get( $badurl );
49 ok( !$mech->success, 'Failed the fetch' );
50 ok( !$mech->is_html, "Isn't HTML" );
51 ok( !defined $mech->title, "No title" );
53 my @links = $mech->links;
54 is( scalar @links, 0, "No links" );
56 my @forms = $mech->forms;
57 is( scalar @forms, 0, "No forms" );