Data-Apache-mod_status
view release on metacpan or search on metacpan
t/01_Data-Apache-mod_status.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
use Test::Differences;
use Test::Exception;
use File::Slurp 'read_file';
use File::Which 'which';
use FindBin qw($Bin);
use lib "$Bin/lib";
use Data::Apache::mod_status;
exit main();
my $status_page;
sub main {
plan 'skip_all' => 'tidy executable not found'
if not defined which('tidy');
#plan 'no_plan';
plan 'tests' => 30;
throws_ok(sub { Data::Apache::mod_status->new()->refresh() }, qr/failed to fetch test/, 'check test mockup');
$status_page = read_file($Bin.'/data/server-status.html');
lives_ok(sub { Data::Apache::mod_status->new()->refresh() }, 'check test mockup')
or die 'hmm';
my $info = Data::Apache::mod_status->new->refresh->info;
is($info->server_version, 'Apache/2.2.9 (Debian) mod_ssl/2.2.9 OpenSSL/0.9.8g', 'server version');
is($info->server_build_str, 'Oct 1 2008 09:56:11', 'server build string');
eq_or_diff(
{
'month' => $info->server_build->month,
'day' => $info->server_build->day,
'year' => $info->server_build->year,
'hour' => $info->server_build->hour,
'minute' => $info->server_build->minute,
'second' => $info->server_build->second,
}, {
'month' => 10,
'day' => 1,
'year' => 2008,
'hour' => 9,
'minute' => 56,
'second' => 11,
}, 'server build datetime'
);
is($info->current_time_str, 'Tuesday, 11-Nov-2008 14:05:49 CET', 'current time string');
eq_or_diff(
{
'month' => $info->current_time->month,
'day' => $info->current_time->day,
'year' => $info->current_time->year,
'hour' => $info->current_time->hour,
'minute' => $info->current_time->minute,
'second' => $info->current_time->second,
'zone' => $info->current_time->offset,
}, {
'month' => 11,
( run in 0.453 second using v1.01-cache-2.11-cpan-39bf76dae61 )