Commit: 401c36481bf77f14c9b63899ce6929a89654e93f Author: Peter Kokot <peterko...@gmail.com> Wed, 17 Oct 2018 08:33:15 +0200 Parents: b5ca40eae532d0bafd1a62808e8b887bc9f687cc Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=401c36481bf77f14c9b63899ce6929a89654e93f Log: Remove Autogeneration tests docs The `generate-phpt` used to provide generating tests however it is not maintanined nor working anymore and has been removed from the php-src repository since PHP-7.3. If the new repository dedicated for the generate-phpt script will be created one day in the future this can be added back. Changed paths: D autogenerate.php M write-test.php Diff: diff --git a/autogenerate.php b/autogenerate.php deleted file mode 100644 index 0cba4e8..0000000 --- a/autogenerate.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php -include("include/functions.php"); - -$TITLE = "Generating tests [PHP-QAT: Quality Assurance Team]"; -$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__)); - -common_header(); -?> -<h2>Auto-generating test cases</h2> -<p> -Although it's not possible to generate a complete PHPT test, it's quite easy to generate the - standard sections and some simple functions automatically, creating a test case "frame". - To do this, you need: <ul> -<li> A build pf PHP53 -</li> <li> The file generate-phpt.phar, located in the PHP53 source under scripts/dev - -</li></ul> -<p /> -<p /> -<p /> -<h3>Example output - a generated test case frame for the cos() function: </h3> -<p /> -<div class="fragment"><pre> ---TEST-- -Test function cos() by calling it with its expected arguments ---FILE-- -<?php - - -echo "*** Test by calling method or function with its expected arguments ***\n" - -$number = - - - -var_dump(cos( $number ) ); - - -?> ---EXPECTF-- - -</pre></pre></div> -<p /> -<p /> -<p /> -<h3>Completing the .phpt test file: </h3> -<p /> -To turn this into a complete test case, all the developer has to do is to initialise $number to something reasonable -and to add a section for the expected output. -<p /> - - -<p /> -<h3> Command syntax </h3> -<div class="fragment"><pre> -php generate-phpt.php -f <function_name> |-c <class_name> -m <method_name> -b|e|v [-s skipif:ini:clean:done] [-k win|notwin|64b|not64b] [-x ext] -</pre></div> -<h3> Options </h3> -Use -h to list them, this is the output: -<p /> -<div class="fragment"><pre> --f function_name ................. Name of PHP function, eg cos --c class name .....................Name of class, eg DOMDocument --m method name ....................Name of method, eg createAttribute --b ............................... Generate basic tests --e ............................... Generate error tests --v ............................... Generate variation tests --s sections....................... Create optional sections, colon separated list --k skipif key..................... Skipif option, only used if -s skipif is used. --x extension.......................Skipif option, specify extension to check for --h ............................... Print this message -</pre></div> -<h3>Implementation notes</h3> -<p>The source code is under scripts/dev/generate-phpt/src. The phar file is generated using the script gtPackage.php. -The script works by using Reflection to work out what arguments a function or method expects and then setting up a function/method -invocation. -The catch with generating tests this way is that the script has to be run *using the level of PHP that you want to test*, -so if your were trying to write tests before doing development this script will not help. However, for filling in test gaps -in existing extensions it works fine. -<p>Return to <a href="write-test.php">write tests.</a></p> - - -<?php -common_footer(); - diff --git a/write-test.php b/write-test.php index 10dcfa7..1f16a70 100644 --- a/write-test.php +++ b/write-test.php @@ -171,13 +171,6 @@ alternatives that may be used if the situation warrants it. The phpt sections ar <p>There is also a very useful set of slides, written by Marcus Boerger <a href="http://somabo.de/talks/">here</a>. Look at the talk entitled "The need for speed, ERM testing".</p> -<h3><a name="autogen-tests" href="#autogen-tests" class="anchor">#</a>Autogenerating test cases</h3> -<p> It isn't possible (or even sensible) to try and generate complete test cases for PHP. However -there is a script in PHP5.3 which will help to generate the framework. It can save you -some typing and ensure that you get a good basic format. -See <a href="autogenerate.php">test case generation</a> for instructions on how to use it.</p> - - <h3><a name="analyzing-failing-tests" href="#analyzing-failing-tests" class="anchor">#</a>Analyzing failing tests</h3> <p>While writing tests you will probably run into tests not passing while you think they should. The 'make test' command provides you with debug information. Several files will be added per test in the same directory as the .phpt file itself.