geoff 2004/10/26 09:55:49
Modified: perl-framework/Apache-Test/lib/Apache TestConfigPHP.pm TestRunPHP.pm Log: move more.php to a more idiomatic test_more.inc Revision Changes Path 1.7 +9 -3 httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPHP.pm Index: TestConfigPHP.pm =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPHP.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestConfigPHP.pm 26 Oct 2004 01:24:52 -0000 1.6 +++ TestConfigPHP.pm 26 Oct 2004 16:55:49 -0000 1.7 @@ -126,7 +126,7 @@ my $self = shift; my $dir = catfile $self->{vars}->{serverroot}, 'conf'; - my $file = catfile $dir, 'more.php'; + my $file = catfile $dir, 'test_more.inc'; $self->gendir($dir); my $fh = $self->genfile($file, undef, 1); @@ -183,8 +183,14 @@ __DATA__ <?php -# based on initial work from Andy Lester +# emulation of Perl's Test::More for PHP +# +# see +# http://search.cpan.org/dist/Test-Simple/lib/Test/More.pm +# for Perl's documentation - these functions should behave +# in the same way # +# based on initial work from Andy Lester # extensive rework by Chris Shiflett $_no_plan = false; @@ -292,7 +298,7 @@ return true; } - if (basename($caller['0']['file']) == 'more.php') + if (basename($caller['0']['file']) == 'test_more.inc') { $file = $caller['1']['file']; $line = $caller['1']['line']; 1.3 +13 -12 httpd-test/perl-framework/Apache-Test/lib/Apache/TestRunPHP.pm Index: TestRunPHP.pm =================================================================== RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRunPHP.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestRunPHP.pm 23 Oct 2004 15:51:47 -0000 1.2 +++ TestRunPHP.pm 26 Oct 2004 16:55:49 -0000 1.3 @@ -152,20 +152,21 @@ something much better. here is a much better example: <?php - // import the Test::More emulation layer - // see - // http://www.perldoc.com/perl5.8.4/lib/Test/More.html - // for more information - require 'more.php'; + # import the Test::More emulation layer + # see + # http://search.cpan.org/dist/Test-Simple/lib/Test/More.pm + # for Perl's documentation - these functions should behave + # in the same way + require 'test_more.inc'; - // plan() the number of tests + # plan() the number of tests plan(6); - // call ok() for each test you plan + # call ok() for each test you plan ok ('foo' == 'foo', 'foo is equal to foo'); ok ('foo' != 'foo', 'foo is not equal to foo'); - // ok() can be other things as well + # ok() can be other things as well is ('bar', 'bar', 'bar is bar'); is ('baz', 'bar', 'baz is baz'); isnt ('bar', 'beer', 'bar is not beer'); @@ -173,14 +174,14 @@ diag("printing some debugging information"); - // whoops! one too many tests. I wonder what will happen... + # whoops! one too many tests. I wonder what will happen... is ('biff', 'biff', 'baz is a baz'); -?> + ?> -the include library C<more.php> is automatically generated by +the include library C<test_more.inc> is automatically generated by C<Apache::TestConfigPHP> and configurations tweaked in such a a way that your PHP scripts can find it without issue. the -functions provided by C<more.php> are equivalent in name and +functions provided by C<test_more.inc> are equivalent in name and function to those in C<Test::More>, a standard Perl testing library, so you can see that manpage for details on the syntax and functionality of each.