.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Apache::TestRunPHP 3pm" .TH Apache::TestRunPHP 3pm "2021-05-21" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Apache::TestRunPHP \- configure and run a PHP\-based test suite .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Apache::TestRunPHP; \& Apache::TestRunPHP\->new\->run(@ARGV); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \f(CW\*(C`Apache::TestRunPHP\*(C'\fR package controls the configuration and running of the test suite for PHP-based tests. It's a subclass of \f(CW\*(C`Apache::TestRun\*(C'\fR and similar in function to \f(CW\*(C`Apache::TestRunPerl\*(C'\fR. .PP Refer to the \f(CW\*(C`Apache::TestRun\*(C'\fR manpage for information on the available \s-1API.\s0 .SH "EXAMPLE" .IX Header "EXAMPLE" \&\f(CW\*(C`TestRunPHP\*(C'\fR works almost identially to \f(CW\*(C`TestRunPerl\*(C'\fR, but in case you are new to \f(CW\*(C`Apache\-Test\*(C'\fR here is a quick getting started guide. be sure to see the links at the end of this document for places to find additional details. .PP because \f(CW\*(C`Apache\-Test\*(C'\fR is a Perl-based testing framework we start from a \f(CW\*(C`Makefile.PL\*(C'\fR, which should have the following lines (in addition to the standard \f(CW\*(C`Makefile.PL\*(C'\fR parts): .PP .Vb 2 \& use Apache::TestMM qw(test clean); \& use Apache::TestRunPHP (); \& \& Apache::TestMM::filter_args(); \& \& Apache::TestRunPHP\->generate_script(); .Ve .PP \&\f(CW\*(C`generate_script()\*(C'\fR will create a script named \f(CW\*(C`t/TEST\*(C'\fR, the gateway to the Perl testing harness and what is invoked when you call \&\f(CW\*(C`make test\*(C'\fR. \f(CW\*(C`filter_args()\*(C'\fR accepts some \f(CW\*(C`Apache::Test\*(C'\fR\-specific arguments and passes them along. for example, to point to a specific \&\f(CW\*(C`httpd\*(C'\fR installation you would invoke \f(CW\*(C`Makefile.PL\*(C'\fR as follows .PP .Vb 1 \& $ perl Makefile.PL \-httpd /my/local/apache/bin/httpd .Ve .PP and \f(CW\*(C`/my/local/apache/bin/httpd\*(C'\fR will be propagated throughout the rest of the process. note that \s-1PHP\s0 needs to be active within Apache prior to configuring the test framework as shown above, either by virtue of \s-1PHP\s0 being compiled into the \f(CW\*(C`httpd\*(C'\fR binary statically or through an active \f(CW\*(C`LoadModule\*(C'\fR statement within the configuration located in \f(CW\*(C`/my/local/apache/conf/httpd.conf\*(C'\fR. Other required modules are the (very common) mod_alias and mod_env. .PP now, like with \f(CW\*(C`Apache::TestRun\*(C'\fR and \f(CW\*(C`Apache::TestRunPerl\*(C'\fR, you can place client-side Perl test scripts under \f(CW\*(C`t/\*(C'\fR, such as \f(CW\*(C`t/01basic.t\*(C'\fR, and \f(CW\*(C`Apache\-Test\*(C'\fR will run these scripts when you call \f(CW\*(C`make test\*(C'\fR. however, what makes \f(CW\*(C`Apache::TestRunPHP\*(C'\fR unique is some added magic specifically tailored to a \s-1PHP\s0 environment. here are the mechanics. .PP \&\f(CW\*(C`Apache::TestRunPHP\*(C'\fR will look for \s-1PHP\s0 test scripts in that match the following pattern .PP .Vb 1 \& t/response/TestFoo/bar.php .Ve .PP where \f(CW\*(C`Foo\*(C'\fR and \f(CW\*(C`bar\*(C'\fR can be anything you like, and \f(CW\*(C`t/response/Test*\*(C'\fR is case sensitive. when this format is adhered to, \f(CW\*(C`Apache::TestRunPHP\*(C'\fR will create an associated Perl test script called \f(CW\*(C`t/foo/bar.t\*(C'\fR, which will be executed when you call \f(CW\*(C`make test\*(C'\fR. all \f(CW\*(C`bar.t\*(C'\fR does is issue a simple \s-1GET\s0 to \f(CW\*(C`bar.php\*(C'\fR, leaving the actual testing to \f(CW\*(C`bar.php\*(C'\fR. in essence, you can forget that \f(CW\*(C`bar.t\*(C'\fR even exists. .PP what does \f(CW\*(C`bar.php\*(C'\fR look like? here is an example: .PP .Vb 4 \& .Ve .PP if it looks odd, that's ok because it is. I could explain to you exactly what this means, but it isn't important to understand the gory details. instead, it is sufficient to understand that when \f(CW\*(C`Apache::Test\*(C'\fR calls \&\f(CW\*(C`bar.php\*(C'\fR it feeds the results directly to \f(CW\*(C`Test::Harness\*(C'\fR, a module that comes with every Perl installation, and \f(CW\*(C`Test::Harness\*(C'\fR expects what it receives to be formatted in a very specific way. by itself, all of this is pretty useless, so \f(CW\*(C`Apache::Test\*(C'\fR provides \s-1PHP\s0 testers with something much better. here is a much better example: .PP .Vb 7 \& .Ve .PP the include library \f(CW\*(C`test\-more.php\*(C'\fR is automatically generated by \&\f(CW\*(C`Apache::TestConfigPHP\*(C'\fR and configurations tweaked in such a a way that your \s-1PHP\s0 scripts can find it without issue. the functions provided by \f(CW\*(C`test\-more.php\*(C'\fR are equivalent in name and function to those in \f(CW\*(C`Test::More\*(C'\fR, a standard Perl testing library, so you can see that manpage for details on the syntax and functionality of each. .PP at this point, we have enough in place to run some tests from PHP-land \- a \f(CW\*(C`Makefile.PL\*(C'\fR to configure Apache for us, and a \s-1PHP\s0 script in \f(CW\*(C`t/response/TestFoo/bar.php\*(C'\fR to send some results out to the testing engine. issuing \f(CW\*(C`make test\*(C'\fR would start Apache, issue the request to \f(CW\*(C`bar.php\*(C'\fR, generate a report, and shut down Apache. the report would look like something like this after running the tests in verbose mode (eg \f(CW\*(C`make test TEST_VERBOSE=1\*(C'\fR): .PP .Vb 10 \& t/php/bar....1..6 \& ok 1 \- foo is equal to foo \& not ok 2 \- foo is not equal to foo \& # Failed test (/src/devel/perl\-php\-test/t/response/TestFoo/bar.php at line 13) \& ok 3 \- bar is bar \& not ok 4 \- baz is baz \& # Failed test (/src/devel/perl\-php\-test/t/response/TestFoo/bar.php at line 17) \& # got: \*(Aqbaz\*(Aq \& # expected: \*(Aqbar\*(Aq \& ok 5 \- bar is not beer \& ok 6 \- bar matches ar$ \& # printing some debugging information \& ok 7 \- baz is a baz \& FAILED tests 2, 4, 7 \& Failed 3/6 tests, 50.00% okay \& Failed Test Stat Wstat Total Fail Failed List of Failed \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& t/php/bar.t 6 3 50.00% 2 4 7 \& Failed 1/1 test scripts, 0.00% okay. 1/6 subtests failed, 83.33% okay. .Ve .PP note that the actual test file that was run was \f(CW\*(C`t/php/bar.t\*(C'\fR. this file is autogenerated based on the \f(CW\*(C`t/response/TestFoo/bar.php\*(C'\fR pattern of your \s-1PHP\s0 script. \f(CW\*(C`t/php/bar.t\*(C'\fR happens to be written in Perl, but you really don't need to worry about it too much. .PP as an interesting aside, if you are using perl\-5.8.3 or later you can actually create your own \f(CW\*(C`t/foo.php\*(C'\fR client-side scripts and they will be run via php (using our \f(CW\*(C`php.ini\*(C'\fR). but more on that later... .SH "SEE ALSO" .IX Header "SEE ALSO" the best source of information about using Apache-Test with \&\s-1PHP\s0 (at this time) is probably the talk given at ApacheCon 2004 (), as well as the code from the talk (). there is also the online tutorial which has all of the mod_perl\-specific syntax and features have been ported to \s-1PHP\s0 with this class. .SH "AUTHOR" .IX Header "AUTHOR" \&\f(CW\*(C`Apache\-Test\*(C'\fR is a community effort, maintained by a group of dedicated volunteers. .PP Questions can be asked at the test-dev httpd.apache.org list For more information see: http://httpd.apache.org/test/.