⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apache::testrunphp.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...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" '''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 turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Apache::TestRunPHP 3".TH Apache::TestRunPHP 3 "2005-10-21" "perl v5.10.0" "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 andrunning of the test suite for PHP-based tests.  It's a subclassof \f(CW\*(C`Apache::TestRun\*(C'\fR and similar in function to \f(CW\*(C`Apache::TestRunPerl\*(C'\fR..PPRefer to the \f(CW\*(C`Apache::TestRun\*(C'\fR manpage for information on theavailable \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 incase you are new to \f(CW\*(C`Apache\-Test\*(C'\fR here is a quick getting startedguide.  be sure to see the links at the end of this document forplaces to find additional details..PPbecause \f(CW\*(C`Apache\-Test\*(C'\fR is a Perl-based testing framework we startfrom a \f(CW\*(C`Makefile.PL\*(C'\fR, which should have the following lines (inaddition 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 gatewayto 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\-specificarguments 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.PPand \f(CW\*(C`/my/local/apache/bin/httpd\*(C'\fR will be propagated throughout therest of the process.  note that \s-1PHP\s0 needs to be active within Apacheprior 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 orthrough an active \f(CW\*(C`LoadModule\*(C'\fR statement within the configurationlocated in \f(CW\*(C`/my/local/apache/conf/httpd.conf\*(C'\fR.  Other required modulesare the (very common) mod_alias and mod_env..PPnow, like with \f(CW\*(C`Apache::TestRun\*(C'\fR and \f(CW\*(C`Apache::TestRunPerl\*(C'\fR, you canplace 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 magicspecifically 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 matchthe following pattern.PP.Vb 1\&  t/response/TestFoo/bar.php.Ve.PPwhere \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'\fRis case sensitive.  when this format is adhered to, \f(CW\*(C`Apache::TestRunPHP\*(C'\fRwill create an associated Perl test script called \f(CW\*(C`t/foo/bar.t\*(C'\fR, whichwill be executed when you call \f(CW\*(C`make test\*(C'\fR.  all \f(CW\*(C`bar.t\*(C'\fR does is issuea simple \s-1GET\s0 to \f(CW\*(C`bar.php\*(C'\fR, leaving the actual testing to \f(CW\*(C`bar.php\*(C'\fR.  inessence, you can forget that \f(CW\*(C`bar.t\*(C'\fR even exists..PPwhat does \f(CW\*(C`bar.php\*(C'\fR look like?  here is an example:.PP.Vb 4\&  <?php\&    print "1..1\en";\&    print "ok 1\en"\&  ?>.Ve.PPif it looks odd, that's ok because it is.  I could explain to you exactlywhat 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 modulethat comes with every Perl installation, and \f(CW\*(C`Test::Harness\*(C'\fR expectswhat it receives to be formated in a very specific way.  by itself, allof this is pretty useless, so \f(CW\*(C`Apache::Test\*(C'\fR provides \s-1PHP\s0 testers withsomething much better.  here is a much better example:.PP.Vb 7\&  <?php\&    # import the Test::More emulation layer\&    # see\&    #   http://search.cpan.org/dist/Test\-Simple/lib/Test/More.pm\&    # for Perl\*(Aqs documentation \- these functions should behave\&    # in the same way\&    require \*(Aqtest\-more.php\*(Aq;\&\&    # plan() the number of tests\&    plan(6);\&\&    # call ok() for each test you plan\&    ok (\*(Aqfoo\*(Aq == \*(Aqfoo\*(Aq, \*(Aqfoo is equal to foo\*(Aq);\&    ok (\*(Aqfoo\*(Aq != \*(Aqfoo\*(Aq, \*(Aqfoo is not equal to foo\*(Aq);\&\&    # ok() can be other things as well\&    is (\*(Aqbar\*(Aq, \*(Aqbar\*(Aq, \*(Aqbar is bar\*(Aq);\&    is (\*(Aqbaz\*(Aq, \*(Aqbar\*(Aq, \*(Aqbaz is baz\*(Aq);\&    isnt (\*(Aqbar\*(Aq, \*(Aqbeer\*(Aq, \*(Aqbar is not beer\*(Aq);\&    like (\*(Aqbar\*(Aq, \*(Aq/ar$/\*(Aq, \*(Aqbar matches ar$\*(Aq);\&\&    diag("printing some debugging information");\&\&    # whoops! one too many tests.  I wonder what will happen...\&    is (\*(Aqbiff\*(Aq, \*(Aqbiff\*(Aq, \*(Aqbaz is a baz\*(Aq);\&  ?>.Ve.PPthe 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 aa 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 andfunction to those in \f(CW\*(C`Test::More\*(C'\fR, a standard Perl testinglibrary, so you can see that manpage for details on the syntaxand functionality of each..PPat this point, we have enough in place to run some tests fromPHP-land \- a \f(CW\*(C`Makefile.PL\*(C'\fR to configure Apache for us, anda \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'\fRwould start Apache, issue the request to \f(CW\*(C`bar.php\*(C'\fR, generatea 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.PPnote that the actual test file that was run was \f(CW\*(C`t/php/bar.t\*(C'\fR.  thisfile is autogenerated based on the \f(CW\*(C`t/response/TestFoo/bar.php\*(C'\fRpattern of your \s-1PHP\s0 script.  \f(CW\*(C`t/php/bar.t\*(C'\fR happens to be written inPerl, but you really don't need to worry about it too much..PPas an interesting aside, if you are using perl\-5.8.3 or later you canactually create your own \f(CW\*(C`t/foo.php\*(C'\fR client-side scripts and theywill 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(<http://xrl.us/phpperl>), as well as the code from the talk(<http://xrl.us/phpperlcode>).  there is also the online tutorial<http://perl.apache.org/docs/general/testing/testing.html>which has all of the mod_perl\-specific syntax and features have beenported 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 ofdedicated volunteers..PPQuestions can be asked at the test-dev <at> httpd.apache.org listFor more information see: http://httpd.apache.org/test/.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -