Hi, attached are a t/php/getlastmod.t and t/htdocs/php/getlastmod.php, a regression test for the PHP getlastmod() function.
Please excuse my poor Perl code in these... :)
use strict; use warnings FATAL => 'all'; use Apache::Test; use Apache::TestRequest; use Apache::TestUtil; use POSIX qw(strftime); plan tests => 1, have_module 'php4'; my $vars = Apache::Test::vars(); my $docroot = $vars->{documentroot}; my $fname = $docroot . "/php/getlastmod.php"; my $mtime = (stat($fname))[9] || die "could not find file"; my $month = strftime "%B", gmtime($mtime); printf "# debug: month is %s\n", $month; my $result = GET_BODY "/php/getlastmod.php"; ok t_cmp($result, $month);
<?php echo date("F", getlastmod()); ?>