Commit: 0889113944c58a53b82aecf4332b2fc79ec58d46 Author: Peter Kokot <peterko...@gmail.com> Sun, 7 Oct 2018 02:36:06 +0200 Committer: Christoph M. Becker <cmbecke...@gmx.de> Fri, 12 Oct 2018 17:06:59 +0200 Parents: da42282632c16e08131ec634fbfb55f6a2d363fd Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=0889113944c58a53b82aecf4332b2fc79ec58d46 Log: Add description of the --CAPTURE_STDIO-- section Changed paths: M phpt_details.php A sample_tests/capture_stdio_1.php A sample_tests/capture_stdio_2.php A sample_tests/capture_stdio_3.php Diff: diff --git a/phpt_details.php b/phpt_details.php index 4d2b352..9a760e4 100644 --- a/phpt_details.php +++ b/phpt_details.php @@ -20,6 +20,7 @@ common_header(); [<a href="#description_section">--DESCRIPTION--</a>]<br/> [<a href="#credits_section">--CREDITS--</a>]<br/> [<a href="#skipif_section">--SKIPIF--</a>]<br/> +[<a href="#capture_stdio_section">--CAPTURE_STDIO--</a>]<br/> [<a href="#post_section">--POST--</a> | <a href="#put_section">--PUT--</a> | <a href="#post_raw_section">--POST_RAW--</a> | <a href="#gzip_post_section">--GZIP_POST--</a> | <a href="#deflate_post_section">--DEFLATE_POST--</a> | <a href="#get_section">--GET--</a>]<br/> [<a href="#cookie_section">--COOKIE--</a>]<br/> [<a href="#stdin_section">--STDIN--</a>]<br/> @@ -122,6 +123,41 @@ PHP code enclosed by PHP tags.</p> <p><b>Example 2 (full):</b> <a href="sample_tests/sample003.php">sample003.phpt</a></p> </dd> +<dt id="capture_stdio_section">--CAPTURE_STDIO--</dt> +<dd> +<p><b>Description:</b><br/> +This section enables which I/O streams the run-tests.php test script will use +when comparing executed file to the expected output. The STDIN is the standard +input stream. When STDOUT is enabled, the test script will also check the +contents of the standard output. When STDERR is enabled, the test script will +also compare the contents of the standard error I/O stream.</p> +<p>If this section is left out of the test, by default, all three streams are +enabled, so the tests without this section capture all and is the same as enabling +all three manually.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Format:</b><br/> +A case insensitive space, newline or otherwise delimited list of one or more +strings of STDIN, STDOUT, and/or STDERR. +</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--CAPTURE_STDIO-- +STDIN STDERR +</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/capture_stdio_1.php">capture_stdio_1.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--CAPTURE_STDIO-- +STDIN STDOUT</pre> +</p> +<p><b>Example 2 (full):</b> <a href="sample_tests/capture_stdio_2.php">capture_stdio_2.phpt</a></p> +<p><b>Example 3 (snippet):</b><br/> +<pre>--CAPTURE_STDIO-- +STDIN STDOUT STDERR</pre> +</p> +<p><b>Example 3(full):</b> <a href="sample_tests/capture_stdio_3.php">capture_stdio_3.phpt</a></p> +</dd> + <dt id="post_section">--POST--</dt> <dd> <p><b>Description:</b><br/> diff --git a/sample_tests/capture_stdio_1.php b/sample_tests/capture_stdio_1.php new file mode 100644 index 0000000..9386556 --- /dev/null +++ b/sample_tests/capture_stdio_1.php @@ -0,0 +1,35 @@ +<?php +include("../include/functions.php"); + +$TITLE = "Sample Test [PHP-QAT: Quality Assurance Team]"; +$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__)); +/* $Id$ */ + +common_header(); +?> + +<div style="padding: 10px"> +<h1>Sample Test: capture_stdio_1.phpt</h1> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +<pre> +--TEST-- +Test covering the I/O stdin and stdout streams. +--DESCRIPTION-- +This tests checks if the output of stdin and stdout I/O streams match the +expected content. +--CAPTURE_STDIO-- +STDIN STDERR +--FILE-- +<?php +echo "Hello, world. This is sent to the stdout I/O stream\n"; +fwrite(STDERR, "This is error sent to the stderr I/O stream\n"); +?> +--EXPECT-- +This is error sent to the stderr I/O stream +</pre> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +</div> + +<?php +common_footer(); +?> diff --git a/sample_tests/capture_stdio_2.php b/sample_tests/capture_stdio_2.php new file mode 100644 index 0000000..8a26275 --- /dev/null +++ b/sample_tests/capture_stdio_2.php @@ -0,0 +1,35 @@ +<?php +include("../include/functions.php"); + +$TITLE = "Sample Test [PHP-QAT: Quality Assurance Team]"; +$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__)); +/* $Id$ */ + +common_header(); +?> + +<div style="padding: 10px"> +<h1>Sample Test: capture_stdio_2.phpt</h1> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +<pre> +--TEST-- +Test covering the I/O stdin and stderr streams. +--DESCRIPTION-- +This tests checks if the output of stdin and stderr I/O streams match the +expected content. +--CAPTURE_STDIO-- +STDIN STDOUT +--FILE-- +<?php +echo "Hello, world. This is sent to the stdout I/O stream\n"; +fwrite(STDERR, "This is error sent to the stderr I/O stream\n"); +?> +--EXPECT-- +Hello, world. This is sent to the stdout I/O stream +</pre> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +</div> + +<?php +common_footer(); +?> diff --git a/sample_tests/capture_stdio_3.php b/sample_tests/capture_stdio_3.php new file mode 100644 index 0000000..7874cf5 --- /dev/null +++ b/sample_tests/capture_stdio_3.php @@ -0,0 +1,36 @@ +<?php +include("../include/functions.php"); + +$TITLE = "Sample Test [PHP-QAT: Quality Assurance Team]"; +$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__)); +/* $Id$ */ + +common_header(); +?> + +<div style="padding: 10px"> +<h1>Sample Test: capture_stdio_1.phpt</h1> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +<pre> +--TEST-- +Test covering the all standard I/O streams. +--DESCRIPTION-- +This tests checks if the output of stdin, stdout and stderr I/O streams match +the expected content. +--CAPTURE_STDIO-- +STDIN STDOUT STDERR +--FILE-- +<?php +echo "Hello, world. This is sent to the stdout I/O stream\n"; +fwrite(STDERR, "This is error sent to the stderr I/O stream\n"); +?> +--EXPECT-- +Hello, world. This is sent to the stdout I/O stream +This is error sent to the stderr I/O stream +</pre> +<p>Back to "<a href="../phpt_details.php">PHPT Test File Layout</a>"</p> +</div> + +<?php +common_footer(); +?>