cvs: qaweb / phpt_details.php /include functions.php /sample_tests clean.php file012.php sample001.php sample002.php sample003.php sample004.php
sample005.php sample006.php sample007.php sample008.php sample009.php sample010.php sample011.php sample012.php sample013.php sample014.php
sample015.php sample016.php sample017.php sample018.php sample019.php sample020.php sample021.php sample022.php sample023.php sample024.php
sample025.php sample026.php skipif.php skipif2.php

From: Date: Sat, 09 May 2009 02:21:44 +0000
Subject: cvs: qaweb / phpt_details.php /include functions.php /sample_tests clean.php file012.php sample001.php sample002.php sample003.php sample004.php
sample005.php sample006.php sample007.php sample008.php sample009.php sample010.php sample011.php sample012.php sample013.php sample014.php
sample015.php sample016.php sample017.php sample018.php sample019.php sample020.php sample021.php sample022.php sample023.php sample024.php
sample025.php sample026.php skipif.php skipif2.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-64905@lists.php.net to get a copy of this message
ericstewart Sat May 9 02:21:44 2009 UTC Added files: /qaweb/sample_tests clean.php file012.php sample001.php sample002.php sample003.php sample004.php sample005.php sample006.php sample007.php sample008.php sample009.php sample010.php sample011.php sample012.php sample013.php sample014.php sample015.php sample016.php sample017.php sample018.php sample019.php sample020.php sample021.php sample022.php sample023.php sample024.php sample025.php sample026.php skipif.php skipif2.php Modified files: /qaweb phpt_details.php /qaweb/include functions.php Log: Reformatted and improved the PHPT documentation.

http://cvs.php.net/viewvc.cgi/qaweb/phpt_details.php?r1=1.6&r2=1.7&diff_format=u Index: qaweb/phpt_details.php diff -u qaweb/phpt_details.php:1.6 qaweb/phpt_details.php:1.7 --- qaweb/phpt_details.php:1.6 Fri Jan 16 15:56:23 2009 +++ qaweb/phpt_details.php Sat May 9 02:21:43 2009 @@ -1,125 +1,879 @@ <?php include("include/functions.php"); -$TITLE = "Writing Tests [PHP-QAT: Quality Assurance Team]"; +$TITLE = "PHPT Test File Layout [PHP-QAT: Quality Assurance Team]"; $SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__)); -/* $Id: phpt_details.php,v 1.6 2009/01/16 15:56:23 zoe Exp $ */ +/* $Id: phpt_details.php,v 1.7 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> - <table width="70%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="10"><img src="gfx/spacer.gif" width="10" height="1"></td> - <td width="100%"> - <h1>Details of PHPT format</h1> - </td> - <td width="10"><img src="gfx/spacer.gif" width="10" height="1"></td> - </tr> - <tr> - <td width="10">&nbsp;</td> - <td width="100%"> + +<div style="padding: 10px"> +<h1>PHPT - Test File Layout.</h1> +<p>Below is a reference manual for PHPT test file layouts.</p> <dl> -<dt>--TEST--</dt> -<dd>title of the test. (required)</dd> -<dt>--CREDITS--</dt> -<dd>if you don't have CVS commit rights, put your name and email on the first line. If -the test is part of a TesFest event, then # followed by the name of the event and the date (YYYY-MM-DD) -on the second line. (optional)</dd> - -<dt>--SKIPIF--</dt> -<dd>a condition when to skip this test. (optional)</dd> - -<dt>--POST--</dt> -<dd>POST variables to be passed to the test script. This section forces the -use of the CGI binary instead of the usual CLI one. (optional)</dd> - -<dt>--GZIP_POST--</dt> -<dd>When this section exists, the POST data will be gzencode()'d. (optional)</dd> - -<dt>--DEFLATE_POST--</dt> -<dd>When this section exists, the POST data will be gzcompress()'ed. (optional)</dd> - -<dt>--POST_RAW--</dt> -<dd>RAW POST data to be passed to the test script. This differs from the section -above because it doesn't set the Content-Type, which can be set manually in -this section. This section forces the use of the CGI binary instead of the -usual CLI one. (optional)</dd> - -<dt>--GET--</dt> -<dd>GET variables to be passed to the test script. This section forces the -use of the CGI binary instead of the usual CLI one. (optional)</dd> - -<dt>--COOKIE--</dt> -<dd>Cookies to be passed to the test script. This section forces the -use of the CGI binary instead of the usual CLI one. (optional)</dd> - -<dt>--STDIN--</dt> -<dd>data to be fed to the test script's standard input. (optional)</dd> - -<dt>--INI--</dt> -<dd>to be used if you need a specific php.ini setting for the test. - Each line contains an ini setting e.g. foo=bar. (optional)</dd> - -<dt>--ARGS--</dt> -<dd>a single line defining the arguments passed to php. (optional)</dd> - -<dt>--ENV--</dt> -<dd>configures the environment to be used for php. (optional)</dd> - -<dt>--FILE--</dt> -<dd>the test source-code. (required)</dd> - -<dt>--FILEEOF--</dt> -<dd>an alternative to --FILE-- where any trailing line break is omitted.</dd> - -<dt>--FILE_EXTERNAL--</dt> -<dd>an alternative to --FILE--. This is used to specify that an external -file should be used as the contents of the test file, and is designed -for running the same test file with different ini, environment, post/get -or other external inputs. The file must be in the same directory as the -test file, or a subdirectory.</dd> - -<dt>--EXPECT--</dt> -<dd>the expected output from the test script. (required)</dd> - -<dt>--EXPECTF--</dt> -<dd>an alternative of --EXPECT--. The difference is that this form uses -sscanf for output validation. See <a href="expectf_details.php">here</a> -for an explanation of the substition tags,</dd> - -<dt>--EXPECTREGEX--</dt> -<dd>an alternative of --EXPECT--. This form allows the tester to specify the -result in a regular expression. (alternative to --EXPECT--)</dd> - -<dt>--REDIRECTTEST--</dt> -<dd>this block allows to redirect from one test to a bunch of other tests. -(alernative to --FILE--)</dd> - -<dt>--HEADERS--</dt> -<dd>header to be used when sending the request. Currently only available with -server-tests.php (optional)</dd> - -<dt>--EXPECTHEADERS--</dt> -<dd>the expected headers. Any header specified here must exist in the -response and have the same value. Additional headers do not matter. (optional) -</dd> - -<dt>--CLEAN--</dt> -<dd>code that is executed after the test has run. Using run-tests.php switch ---no-clean you can prevent its execution to inspect generated data/files that -were normally removed after the test. (optional)</dd> - -<dt>--XFAIL--</dt> -<dd>a test that is expected to fail. Any text added in this section should simply explain why the -test is expected to fail. This section is intented as a convenience to developers who -may wish to distinguish between tests that they know will fail, because the function they -test is not implemented yet, and tests which should pass. As soon as the function -is implemented the XFAIL section should be removed from the test. XFAIL sections should -not appear in tests associated with released levels of PHP. - -<dt>===DONE===</dt> -<dd>This is only available in the --FILE-- section. Any part after this line -is not going into the actual test script (optional).</dd> +<dt>Section Summary List.</dt> +<dd> +<p>[] indicates optional sections.</p> +<p><a href="#test_section">--TEST--</a><br/> +[<a href="#description_section">--DESCRIPTION--</a>]<br/> +[<a href="#credits_section">--CREDITS--</a>]<br/> +[<a href="#skipif_section">--SKIPIF--</a>]<br/> +[<a href="#request_section">--REQUEST--</a>]<br/> +[<a href="#post_section">--POST--</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/> +[<a href="#ini_section">--INI--</a>]<br/> +[<a href="#args_section">--ARGS--</a>]<br/> +[<a href="#env_section">--ENV--</a>]<br/> +<a href="#file_section">--FILE--</a> | <a href="#fileeof_section">--FILEEOF--</a> | <a href="#file_external_section">--FILE_EXTERNAL--</a> | <a href="#redirecttest_section">--REDIRECTTEST--</a><br/> +[<a href="#headers_section">--HEADERS--</a>]<br/> +[<a href="#cgi_section">--CGI--</a>]<br/> +[<a href="#xfail_section">--XFAIL--</a>]<br/> +[<a href="#expectheaders_section">--EXPECTHEADERS</a>--]<br/> +<a href="#expect_section">--EXPECT--</a> | <a href="#expectf_section">--EXPECTF--</a> | <a href="#expectregex_section">--EXPECTREGEX--</a><br/> +[<a href="#clean_section">--CLEAN--</a>] +</dd> + +<dt id="test_section">--TEST--</dt> +<dd> +<p><b>Description:</b><br/> +Title of test as a single line short description.</p> +<p><b>Required:</b><br/> +Yes</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Plain text. We recommend a single line only.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--TEST-- +Test filter_input() with GET and POST data.</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +</dd> + +<dt id="description_section">--DESCRIPTION--</dt> +<dd> +<p><b>Description:</b><br/> +If your test requires more than a single line title to adequately describe it, +you can use this section for further explanation. Multiple lines are allowed and +besides being used for information, this section is completely ignored by the +test binary.</p> +<p><b>Required:</b><br/> +No</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Plain text, multiple lines.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--DESCRIPTION-- +This test covers both valid and invalid usages of +filter_input() with INPUT_GET and INPUT_POST data +and several differnet filter sanitizers.</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +</dd> + +<dt id="credits_section">--CREDITS--</dt> +<dd> +<p><b>Description:</b><br/> +If you don't have CVS commit rights, put your name and email on the first line. +If the test is part of a TesFest event, then # followed by the name of the event +and the date (YYYY-MM-DD) on the second line.</p> +<p><b>Required:</b><br/> +It's required for credit during TestFests.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Name Email<br/> +[Event]</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--CREDIT-- +Felipe Pena <felipe@php.net></pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--CREDITS-- +Zoe Slattery zoe@php.net +# TestFest Munich 2009-05-19</pre> +</p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample002.php">sample002.phpt</a></p> +</dd> + +<dt id="skipif_section">--SKIPIF--</dt> +<dd> +<p><b>Description:</b><br/> +A condition or set of conditions used to determine if a test should be skipped. +Tests that are only applicable to a certain platform, extension or PHP version +are good reasons for using a --SKIPIF-- section.</p> +<p>A common practice for extension tests is to write your --SKIPIF-- extension +criteria into a file call skipif.inc and then including that file in the +--SKIPIF-- section of all your extension tests. This promotes the DRY principle +and reduces future code maintenance.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +PHP code enclosed by PHP tags.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--SKIPIF-- +&lt;?php if (!extension_loaded("filter")) die("Skipped: filter extension required."); ?&gt;</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--SKIPIF-- +&lt;?php include('<a href="sample_tests/skipif.php">skipif.inc</a>'); ?&gt;</pre> +</p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample003.php">sample003.phpt</a></p> +</dd> + +<dt id="request_section">--REQUEST--</dt> +<dd> +<p><b>Description:</b><br/> +Settings used for building the URL in an HTTP request. Currently only available +with server-tests.php.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +server-tests.php</p> +<p><b>Format:</b><br/> +PHP source which is run through eval() and then split into key value pairs, one +pair per line. Do not use &lt;?php and ?&gt; wrapper tags.</p> +<p>Valid settings for this section include: +<ul> +<li>SCRIPT_NAME - The inital part of the request url</li> +<li>PATH_INFO - The pathinfo part of a request url</li> +<li>FRAGMENT - The fragment section of a url (after #)</li> +<li>QUERY_STRING - The query part of a url (after ?)</li> +</ul> +</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--REQUEST-- +return <<<END +SCRIPT_NAME=/nothing.php +QUERY_STRING=$filename +END;</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample004.php">sample004.phpt</a></p> +<p><b></b><br/> +</p> +</dd> + +<dt id="post_section">--POST--</dt> +<dd> +<p><b>Description:</b><br/> +POST variables or data to be passed to the test script. This section forces the +use of the CGI binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Follows the HTTP post data format.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--POST-- +c=&lt;p&gt;string&lt;/p&gt;&d=12345.7</pre> +</p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--POST-- +&lt;SOAP-ENV:Envelope + SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; + xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; + xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; + xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; + xmlns:si=&quot;http://soapinterop.org/xsd&quot;&gt; + &lt;SOAP-ENV:Body&gt; + &lt;ns1:test xmlns:ns1=&quot;http://testuri.org&quot; /&gt; + &lt;/SOAP-ENV:Body&gt; +&lt;/SOAP-ENV:Envelope&gt;</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample005.php">sample005.phpt</a></p> +</dd> + +<dt id="post_raw_section">--POST_RAW--</dt> +<dd> +<p><b>Description:</b><br/> +Raw POST data to be passed to the test script. This differs from the section +above because it doesn't automatically set the Content-Type, this leaves you +free to define your own within the section. This section forces the use of the +CGI binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +Follows the HTTP post data format.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--POST_RAW-- +Content-type: multipart/form-data, boundary=AaB03x + +--AaB03x +content-disposition: form-data; name=&quot;field1&quot; + +Joe Blow +--AaB03x +content-disposition: form-data; name=&quot;pics&quot;; filename=&quot;file1.txt&quot; +Content-Type: text/plain + +abcdef123456789 +--AaB03x--</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample006.php">sample006.phpt</a></p> +</dd> + +<dt id="gzip_post_section">--GZIP_POST--</dt> +<dd> +<p><b>Description:</b><br/> +When this section exists, the POST data will be gzencode()'d. This section +forces the use of the CGI binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary. Must be coupled with a --POST--.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +Simply use 1 as the section's content.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--POST-- +&lt;SOAP-ENV:Envelope + SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; + xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; + xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; + xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; + xmlns:si=&quot;http://soapinterop.org/xsd&quot;&gt; + &lt;SOAP-ENV:Body&gt; + &lt;ns1:test xmlns:ns1=&quot;http://testuri.org&quot; /&gt; + &lt;/SOAP-ENV:Body&gt; +&lt;/SOAP-ENV:Envelope&gt; +--GZIP_POST-- +1</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample005.php">sample005.phpt</a></p> +</dd> + +<dt id="deflate_post_section">--DEFLATE_POST--</dt> +<dd> +<p><b>Description:</b><br/> +When this section exists, the POST data will be gzcompress()'ed. This section +forces the use of the CGI binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary. Must be coupled with a --POST--.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +Simply use 1 as the section's content.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--POST-- +&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt; +&lt;SOAP-ENV:Envelope + SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; + xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; + xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; + xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; + xmlns:si=&quot;http://soapinterop.org/xsd&quot;&gt; + &lt;SOAP-ENV:Body&gt; + &lt;ns1:test xmlns:ns1=&quot;http://testuri.org&quot; /&gt; + &lt;/SOAP-ENV:Body&gt; +&lt;/SOAP-ENV:Envelope&gt; +--DEFLATE_POST-- +1</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample007.php">sample007.phpt</a></p> +</dd> + +<dt id="get_section">--GET--</dt> +<dd> +<p><b>Description:</b><br/> +GET variables to be passed to the test script. This section forces the use of +the CGI binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +A single line of text passed as the GET data to the script.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--GET-- +a=&lt;b&gt;test&lt;/b&gt;&b=http://example.com</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--GET-- +ar[elm1]=1234&ar[elm2]=0660&a=0234</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample008.php">sample008.phpt</a></p> +</dd> + +<dt id="cookie_section">--COOKIE--</dt> +<dd> +<p><b>Description:</b><br/> +Cookies to be passed to the test script. This section forces the use of the CGI +binary instead of the usual CLI one.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Requirements:</b><br/> +PHP CGI binary.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +A single line of text in a valid HTTP cookie format.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--COOKIE-- +hello=World;goodbye=MrChips</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample002.php">sample002.phpt</a></p> +</dd> + +<dt id="stdin_section">--STDIN--</dt> +<dd> +<p><b>Description:</b><br/> +Data to be fed to the test script's standard input.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +Any text within this section is passed as STDIN to PHP.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--STDIN-- +fooBar +use this to input some thing to the php script</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample009.php">sample009.phpt</a></p> +</dd> + +<dt id="ini_section">--INI--</dt> +<dd> +<p><b>Description:</b><br/> +To be used if you need a specific php.ini setting for the test.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Key value pairs. One setting per line.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--INI-- +precision=14</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--INI-- +session.use_cookies=0 +session.cache_limiter= +register_globals=1 +session.serialize_handler=php +session.save_handler=files</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample003.php">sample003.phpt</a></p> +</dd> + +<dt id="args_section">--ARGS--</dt> +<dd> +<p><b>Description:</b><br/> +A single line defining the arguments passed to php.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +A single line of text that is passed as the argument(s) to the PHP CLI.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--ARGS-- +--arg value --arg=value -avalue -a=value -a value</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample010.php">sample010.phpt</a></p> +</dd> + +<dt id="env_section">--ENV--</dt> +<dd> +<p><b>Description:</b><br/> +Configures environment variables such as those found in the $_SERVER global +array.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +PHP source which is run through eval() and then split into key value pairs, one +pair per line. Do not use &lt;?php and ?&gt; tags.</p> +<p>Some variables are made easily available for use in this section, they include:</p> +<ul> +<li>$filename - full native path to file, will become PATH_TRANSLATED</li> +<li>$filepath - =dirname($filename)</li> +<li>$scriptname - this is what will become SCRIPT_NAME unless you override it</li> +<li>$docroot - the equivelant of DOCUMENT_ROOT under Apache</li> +<li>$cwd - the directory that the test is being initiated from</li> +<li>$this->conf - all server-tests configuration vars</li> +<li>$this->env - all environment variables that will get passed to the test</li> +</ul> +<p><b>Example 1 (snippet):</b><br/> +<pre>--ENV-- +return <<<END +REDIRECT_URL=$scriptname +PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php +QUERY_STRING=$filename +PATH_INFO=/nothing.php +SCRIPT_NAME=/phpexe/php.exe/nothing.php +SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php +END;</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample004.php">sample004.phpt</a></p> +</dd> + +<dt id="file_section">--FILE--</dt> +<dd> +<p><b>Description:</b><br/> +The test source code.</p> +<p><b>Required:</b><br/> +One of the FILE type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +PHP source code enclosed by PHP tags.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--FILE-- +&lt;?php +ini_set('html_errors', false); +var_dump(filter_input(INPUT_GET, &quot;a&quot;, FILTER_SANITIZE_STRIPPED)); +var_dump(filter_input(INPUT_GET, &quot;b&quot;, FILTER_SANITIZE_URL)); +var_dump(filter_input(INPUT_GET, &quot;a&quot;, FILTER_SANITIZE_SPECIAL_CHARS, array(1,2,3,4,5))); +var_dump(filter_input(INPUT_GET, &quot;b&quot;, FILTER_VALIDATE_FLOAT, new stdClass)); +var_dump(filter_input(INPUT_POST, &quot;c&quot;, FILTER_SANITIZE_STRIPPED, array(5,6,7,8))); +var_dump(filter_input(INPUT_POST, &quot;d&quot;, FILTER_VALIDATE_FLOAT)); +var_dump(filter_input(INPUT_POST, &quot;c&quot;, FILTER_SANITIZE_SPECIAL_CHARS)); +var_dump(filter_input(INPUT_POST, &quot;d&quot;, FILTER_VALIDATE_INT)); +var_dump(filter_var(new stdClass, &quot;d&quot;)); +var_dump(filter_input(INPUT_POST, &quot;c&quot;, &quot;&quot;, &quot;&quot;)); +var_dump(filter_var(&quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;)); +var_dump(filter_var(0, 0, 0, 0, 0)); +echo &quot;Done\n&quot;; +?&gt;</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +</dd> + +<dt id="fileeof_section">--FILEEOF--</dt> +<dd> +<p><b>Description:</b><br/> +An alternative to --FILE-- where any trailing line breaks (\n || \r || \r\n +found at the end of the section) are omitted. This is an extreme edge-case +feature, so 99.99% of the time you won't need this section.</p> +<p><b>Required:</b><br/> +One of the FILE type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +PHP source code enclosed by PHP tags.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--FILEEOF-- +&lt;?php +eval(&quot;echo 'Hello'; // comment&quot;); +echo &quot; World&quot;; +//last line comment</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample011.php">sample011.phpt</a></p> +</dd> + +<dt id="file_external_section">--FILE_EXTERNAL--</dt> +<dd> +<p><b>Description:</b><br/> +An alternative to --FILE--. This is used to specify that an external file should +be used as the --FILE-- contents of the test file, and is designed for running +the same test file with different ini, environment, post/get or other external +inputs. Basically it allows you to DRY up some of your tests. The file must be +in the same directory as the test file, or in a subdirectory.</p> +<p><b>Required:</b><br/> +One of the FILE type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +path/to/file. Single line.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--FILE_EXTERNAL-- +files/<a href="sample_test/files/file012.php">file012.php</a></pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample012.php">sample012.phpt</a></p> +</dd> + +<dt id="redirecttest_section">--REDIRECTTEST--</dt> +<dd> +<p><b>Description:</b><br/> +This block allows you to redirect from one test to a bunch of other tests. It +also allows you to set configurations which are used on all tests in your +destination.</p> +<p><b>Required:</b><br/> +One of the FILE type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +PHP source which is run through eval(). The tests destination is the value of an +array index 'TESTS'. Also, keep in mind, you can not use a REDIRECTTEST which is +being pointed to by another test which contains a REDIRECTTEST. In other words, +no nesting.</p> +<p>The relative path declared in 'TESTS' is relative to the base directory for the +PHP source code, not relative to the current directory.</p> +<p>Last note, the array in this section must be returned to work.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--REDIRECTTEST-- +return array( + 'ENV' => array( + 'PDOTEST_DSN' => 'sqlite2::memory:' + ), + 'TESTS' => 'ext/pdo/tests' + );</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample013.php">sample013.phpt</a><br/> +Note: The destination tests for this example are not included. See the PDO +extension tests for reference to live tests using this section.</p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--REDIRECTTEST-- +# magic auto-configuration + +$config = array( + 'TESTS' => 'ext/pdo/tests' +); + +if (false !== getenv('PDO_MYSQL_TEST_DSN')) { + # user set them from their shell + $config['ENV']['PDOTEST_DSN'] = getenv('PDO_MYSQL_TEST_DSN'); + $config['ENV']['PDOTEST_USER'] = getenv('PDO_MYSQL_TEST_USER'); + $config['ENV']['PDOTEST_PASS'] = getenv('PDO_MYSQL_TEST_PASS'); + if (false !== getenv('PDO_MYSQL_TEST_ATTR')) { + $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_MYSQL_TEST_ATTR'); + } +} else { + $config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test'; + $config['ENV']['PDOTEST_USER'] = 'root'; + $config['ENV']['PDOTEST_PASS'] = ''; +} + +return $config;</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample014.php">sample014.phpt</a><br/> +Note: The destination tests for this example are not included. See the PDO +extension tests for reference to live tests using this section.</p> +</dd> + +<dt id="headers_section">--HEADERS--</dt> +<dd> +<p><b>Description:</b><br/> +Header to be used when sending the request. Currently only available with +server-tests.php.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +server-tests.php</p> +<p><b>Format:</b><br/> +PHP source which is run through eval() and then split into key value pairs. Do +not use &lt;?php and ?&gt; wrapper tags.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--HEADERS-- +return <<<END +Content-Type=multipart/form-data; boundary=---------------------------240723202011929 +Content-Length=862 +END;</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample015.php">sample015.phpt</a></p> +</dd> + +<dt id="cgi_section">--CGI--</dt> +<dd> +<p><b>Description:</b><br/> +This section takes no value. It merely provides a simple marker for tests that +MUST be run as CGI, even if there is no --POST-- or --GET-- sections in the test +file. Currently only available with server-tests.php.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +server-tests.php</p> +<p><b>Format:</b><br/> +No value, just the --CGI-- statement.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--CGI--</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample016.php">sample016.phpt</a></p> +</dd> + +<dt id="xfail_section">--XFAIL--</dt> +<dd> +<p><b>Description:</b><br/> +This section identifies this test as one that is currently expected to fail. It +should include a brief description of why it's expected to fail. Reasons for +such expectations include tests that are written before the functionality +they are testing is implemented or notice of a bug which is due to upstream code +such as an extension which provides PHP support for some other software.</p> +<p>Please do NOT include an --XFAIL-- without providing a text description for +the reason it's being used.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +A short plain text description of why this test is currently expected to fail.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--XFAIL-- +This bug might be still open on aix5.2-ppc64 and hpux11.23-ia64</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample017.php">sample017.phpt</a></p> +</dd> + +<dt id="expectheaders_section">--EXPECTHEADERS--</dt> +<dd> +<p><b>Description:</b><br/> +The expected headers. Any header specified here must exist in the response and +have the same value or the test fails. Additional headers found in the actual +tests while running are ignored.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +HTTP style headers. May include multiple lines.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--EXPECTHEADERS-- +Status: 404</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample004.php">sample004.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--EXPECTHEADERS-- +Content-type: text/html; charset=UTF-8 +Status: 403 Access Denied</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample018.php">sample018.phpt</a><br/> +Note: The destination tests for this example are not included. See the phar +extension tests for reference to live tests using this section.</p> +</dd> + +<dt id="expect_section">--EXPECT--</dt> +<dd> +<p><b>Description:</b><br/> +The expected output from the test script. This must match the actual output from +the test script exactly for the test to pass.</p> +<p><b>Required:</b><br/> +One of the EXPECT type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Plain text. Multiple lines of text are allowed.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--EXPECT-- +array(2) { + [&quot;hello&quot;]=> + string(5) &quot;World&quot; + [&quot;goodbye&quot;]=> + string(7) &quot;MrChips&quot; +}</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample002.php">sample002.phpt</a></p> +</dd> + +<dt id="expectf_section">--EXPECTF--</dt> +<dd> +<p><b>Description:</b><br/> +An alternative of --EXPECT--. Where it differs from --EXPECT-- is that it uses a +number of substitution tags for strings, spaces, digits, etc. that appear in +test case output but which may vary between test runs. The most common example +of this is to use %s and %d to match the file path and line number which are +output by PHP Warnings.</p> +<p><b>Required:</b><br/> +One of the EXPECT type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Plain text including tags which are inserted to represent different types of +output which are not guaranteed to have the same value on subsequent runs or +when run on different platforms.</p> +<p>The following is a list of all tags and what they are used to represent:<br/> +<ul> +<li>%e: Represents a directory separator, for example / on Linux.</li> +<li>%s: One or more of anything (character or white space) except the end of line + character.</li> +<li>%S: Zero or more of anything (character or white space) except the end of line + character.</li> +<li>%a: One or more of anything (character or white space) including the end of line + character.</li> +<li>%A: Zero or more of anything (character or white space) including the end of line + character.</li> +<li>%w: Zero or more white space characters.</li> +<li>%i: A signed integer value, for example +3142, -3142.</li> +<li>%d: An unsigned integer value, for example 123456.</li> +<li>%x: One or more hexadecimal character. That is, characters in the range 0-9, a-f, + A-F.</li> +<li>%f: A floating point number, for example: 3.142, -3.142, 3.142E-10, 3.142e+10.</li> +<li>%c: A single character of any sort (.).</li> +<li>%r...%r: Any string (...) enclosed between two %r will be treated as a regular + expression.</li> +<li>%unicode|string%: Matches the string 'unicode' in PHP6 test output and 'string' + in PHP5 test output.</li> +<li>%binary_string_optional%: Matches 'Binary string' in PHP6 output, 'string' in + PHP5 output. Used in PHP Warning messages.</li> +<li>%unicode_string_optional%: Matches 'Unicode string' in PHP6 output, 'string' in + PHP5 output. Used in PHP Warning messages.</li> +<li>%u|b%: Matches a single 'u' in PHP6 test output where the PHP5 output from the + same test hs no character in that position.</li> +</ul> +</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--EXPECTF-- +string(4) &quot;test&quot; +string(18) &quot;http://example.com&quot; +string(27) &quot;&amp;#60;b&amp;#62;test&amp;#60;/b&amp;#62;&quot; + +Notice: Object of class stdClass could not be converted to int in %ssample001.php on line %d +bool(false) +string(6) &quot;string&quot; +float(12345.7) +string(29) &quot;&amp;#60;p&amp;#62;string&amp;#60;/p&amp;#62;&quot; +bool(false) + +Warning: filter_var() expects parameter 2 to be long, string given in %s011.php on line %d +NULL + +Warning: filter_input() expects parameter 3 to be long, string given in %s011.php on line %d +NULL + +Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d +NULL + +Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d +NULL +Done</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample001.php">sample001.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--EXPECTF-- +Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: bzopen(): 'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(): 'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(no_such_file): failed to open stream: No such file or directory in %s on line %d +bool(false) +resource(%d) of type (stream) +Done</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample019.php">sample019.phpt</a></p> +<p><b>Example 3 (snippet):</b><br/> +<pre>--EXPECTF-- +object(DOMNodeList)#%d (0) { +} +int(0) +bool(true) +bool(true) +string(0) &quot;&quot; +bool(true) +bool(true) +bool(false) +bool(false)</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample020.php">sample020.phpt</a></p> +</dd> + +<dt id="expectregex_section">--EXPECTREGEX--</dt> +<dd> +<p><b>Description:</b><br/> +An alternative of --EXPECT--. This form allows the tester to specify the result +in a regular expression.</p> +<p><b>Required:</b><br/> +One of the EXPECT type sections is required.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php, server-tests.php</p> +<p><b>Format:</b><br/> +Plain text including regular expression patterns which represent data that can +vary between subsequent runs of a test or when run on different platforms.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--EXPECTREGEX-- +M_E : 2.718281[0-9]* +M_LOG2E : 1.442695[0-9]* +M_LOG10E : 0.434294[0-9]* +M_LN2 : 0.693147[0-9]* +M_LN10 : 2.302585[0-9]* +M_PI : 3.141592[0-9]* +M_PI_2 : 1.570796[0-9]* +M_PI_4 : 0.785398[0-9]* +M_1_PI : 0.318309[0-9]* +M_2_PI : 0.636619[0-9]* +M_SQRTPI : 1.772453[0-9]* +M_2_SQRTPI: 1.128379[0-9]* +M_LNPI : 1.144729[0-9]* +M_EULER : 0.577215[0-9]* +M_SQRT2 : 1.414213[0-9]* +M_SQRT1_2 : 0.707106[0-9]* +M_SQRT3 : 1.732050[0-9]*</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample021.php">sample021.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--EXPECTF-- +*** Testing imap_append() : basic functionality *** +Create a new mailbox for test +Create a temporary mailbox and add 0 msgs +.. mailbox '%s' created +Add a couple of msgs to new mailbox {%s}INBOX.%s +bool(true) +bool(true) +Msg Count after append : 2 +List the msg headers +array(2) { + [0]=> + string(%d) &quot;%w%s 1)%s webmaster@something. Test message (%d chars)&quot; + [1]=> + string(%d) &quot;%w%s 2)%s webmaster@something. Another test (%d chars)&quot; +}</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample025.php">sample025.phpt</a></p> +<p><b>Example 3 (snippet):</b><br/> +<pre>--EXPECTREGEX-- +string\(4\) \&quot;-012\&quot; +string\(8\) \&quot;2d303132\&quot; +(string\(13\) \&quot; 4294967284\&quot;|string\(20\) \&quot;18446744073709551604\&quot;) +(string\(26\) \&quot;20202034323934393637323834\&quot;|string\(40\) \&quot;3138343436373434303733373039353531363034\&quot;)</pre></p> +<p><b>Example 3 (full):</b> <a href="sample023.php">sample_tests/sample023.phpt</a></p> +</dd> + +<dt id="clean_section">--CLEAN--</dt> +<dd> +<p><b>Description:</b><br/> +Code that is executed after a test completes. It's main purpose is to allow you +to clean up after yourself. You might need to remove files created during the +test or close sockets or database connections following a test. Infact, even +if a test fails or encounters a fatal error during the test, the code found in +the --CLEAN-- section will still run.</p> +<p>Code in the clean section is run in a completely different process than the +one the test was run in. So do not try accessing variables you created in the +--FILE-- section from inside the --CLEAN-- section, they won't exist.</p> +<p>Using the switch --no-clean on run-tests.php, you can prevent the code found +in the --CLEAN-- section of a test from running. This allows you to inspect +generated data or files without them being removed by the --CLEAN-- section.</p> +<p><b>Required:</b><br/> +No.</p> +<p><b>Test Script Support:</b><br/> +run-tests.php</p> +<p><b>Format:</b><br/> +PHP source code enclosed by PHP tags.</p> +<p><b>Example 1 (snippet):</b><br/> +<pre>--CLEAN-- +&lt;?php + $temp_filename = dirname(__FILE__).&quot;/DomDocument_save_basic.tmp&quot;; + unlink($temp_filename); +?&gt;</pre></p> +<p><b>Example 1 (full):</b> <a href="sample_tests/sample024.php">sample024.phpt</a></p> +<p><b>Example 2 (snippet):</b><br/> +<pre>--CLEAN-- +&lt;?php +require_once('<a href="sample_test/clean.php">clean.inc</a>'); +?&gt;</pre></p> +<p><b>Example 2 (full):</b> <a href="sample_tests/sample025.php">sample025.phpt</a></p> +<p><b>Example 3 (snippet):</b><br/> +<pre>--CLEAN-- +&lt;?php +$key = ftok(dirname(__FILE__).&quot;/003.phpt&quot;, 'q'); +$s = shm_attach($key); +shm_remove($s); +?&gt;</pre></p> +<p><b>Example 3 (full):</b> <a href="sample_tests/sample022.php">sample022.phpt</a></p> +</dd> + </dl> +</div> +<?php +common_footer(); +?> \ No newline at end of file http://cvs.php.net/viewvc.cgi/qaweb/include/functions.php?r1=1.13&r2=1.14&diff_format=u Index: qaweb/include/functions.php diff -u qaweb/include/functions.php:1.13 qaweb/include/functions.php:1.14 --- qaweb/include/functions.php:1.13 Sat Mar 1 01:12:54 2008 +++ qaweb/include/functions.php Sat May 9 02:21:43 2009 @@ -3,7 +3,7 @@ (c)'2001 by Marco Kaiser (bate@php.net) and the PHP Group Read an Learn. Any Questions so ask. -Version: $Id: functions.php,v 1.13 2008/03/01 01:12:54 bate Exp $ +Version: $Id: functions.php,v 1.14 2009/05/09 02:21:43 ericstewart Exp $ */ function common_header() { @@ -14,27 +14,27 @@ <title><?php echo $GLOBALS["TITLE"]; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="MSSmartTagsPreventParsing" content="TRUE"> - <link rel="stylesheet" href="styles.css" type="text/css"> + <link rel="stylesheet" href="/styles.css" type="text/css"> </head> <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> - <td bgcolor="#ffcc66"><img src="gfx/spacer.gif" width="5" height="1"> - <a href="http://qa.php.net/"><img src="gfx/logo_qa.jpg" width="111" height="58" border="0"></a></td> + <td bgcolor="#ffcc66"><img src="/gfx/spacer.gif" width="5" height="1"> + <a href="http://qa.php.net/"><img src="/gfx/logo_qa.jpg" width="111" height="58" border="0"></a></td> <td bgcolor="#ffcc66" align="right" valign="bottom"> <table border="0" cellspacing="0" cellpadding="0" height="70"> <tr> <td align="right" valign="top" class="headline_white"><?php echo date("l, F d, Y"); ?></td> - <td align="right" valign="top" class="headline_white"><img src="gfx/spacer.gif" width="5" height="1"></td> + <td align="right" valign="top" class="headline_white"><img src="/gfx/spacer.gif" width="5" height="1"></td> </tr> <tr> <td valign="bottom" align="right"><a href="/" class="head_links">Home</a> - | <a href="projects.php" class="head_links">Projects and Goals</a> - | <a href="rc.php" class="head_links">Release Candidates</a> - | <a href="howtohelp.php" class="head_links">How to Help</a> - | <a href="handling-bugs.php" class="head_links">Handling Bug Reports</a> - | <a href="running-tests.php" class="head_links">Submit a build test</a> + | <a href="/projects.php" class="head_links">Projects and Goals</a> + | <a href="/rc.php" class="head_links">Release Candidates</a> + | <a href="/howtohelp.php" class="head_links">How to Help</a> + | <a href="/handling-bugs.php" class="head_links">Handling Bug Reports</a> + | <a href="/running-tests.php" class="head_links">Submit a build test</a> </td> <td valign="bottom" align="right" class="head_links">&nbsp;</td> </tr> @@ -42,13 +42,13 @@ </td> </tr> <tr> - <td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1" border="0"></td> + <td colspan="2" bgcolor="#000000" height="1"><img src="/gfx/spacer.gif" width="1" height="1" border="0"></td> </tr> <tr> <td colspan="2" bgcolor="#ff9900" align="right" class="head_links">&nbsp;</td> </tr> <tr> - <td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1"></td> + <td colspan="2" bgcolor="#000000" height="1"><img src="/gfx/spacer.gif" width="1" height="1"></td> </tr> </table> @@ -75,7 +75,7 @@ </tr> <tr> <td class="sidebox"> - Find more information about PHP/QA Team's <a href="projects.php">current + Find more information about PHP/QA Team's <a href="/projects.php">current projects and future goals</a>. </td> </tr> @@ -86,7 +86,7 @@ </tr> <tr> <td class="sidebox"> - What are <a href="rc.php">release candidates</a> and how you can help us testing them. + What are <a href="/rc.php">release candidates</a> and how you can help us testing them. </td> </tr> <tr> @@ -111,8 +111,8 @@ </td> </tr> </table> - <img src="gfx/spacer.gif" width="1" height="20"></td> - <td background="gfx/line_1.jpg" width="1"><img src="gfx/spacer.gif" width="1" height="1"><br> + <img src="/gfx/spacer.gif" width="1" height="20"></td> + <td background="/gfx/line_1.jpg" width="1"><img src="/gfx/spacer.gif" width="1" height="1"><br> </td> <td align="left" valign="top" bgcolor="#FFFFFF"> <br> <?php @@ -124,13 +124,13 @@ </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> - <td bgcolor="#000000"><img src="gfx/spacer.gif" width="1" height="1"></td> + <td bgcolor="#000000"><img src="/gfx/spacer.gif" width="1" height="1"></td> </tr> <tr> <td bgcolor="#ff9900">&nbsp;</td> </tr> <tr> - <td bgcolor="#000000"><img src="gfx/spacer.gif" width="1" height="1"></td> + <td bgcolor="#000000"><img src="/gfx/spacer.gif" width="1" height="1"></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" height="60"> @@ -138,7 +138,7 @@ <td bgcolor="#cccccc" align="left" width="100%"> <table border="0" cellspacing="0" cellpadding="0"> <tr> - <td width="80" align="center"><a href="http://www.php.net/"><img src="gfx/php-logo.gif" width="69" height="36" border="0" alt="Go to the main PHP site"></a></td> + <td width="80" align="center"><a href="http://www.php.net/"><img src="/gfx/php-logo.gif" width="69" height="36" border="0" alt="Go to the main PHP site"></a></td> <td class="footer"><a href="http://www.php.net/copyright.php" target="_blank">Copyright &copy; 1997 - <?php echo date('Y', time()); ?> PHP Group</a><br> All rights reserved.</td> @@ -147,7 +147,7 @@ </td> <td bgcolor="#cccccc" nowrap align="right" class="footer">Last update: <?php echo $GLOBALS["SITE_UPDATE"]; ?></td> - <td bgcolor="#cccccc" nowrap align="right" class="footer"><img src="gfx/spacer.gif" width="10" height="1"></td> + <td bgcolor="#cccccc" nowrap align="right" class="footer"><img src="/gfx/spacer.gif" width="10" height="1"></td> </tr> </table> </body> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/clean.php?view=markup&rev=1.1 Index: qaweb/sample_tests/clean.php +++ qaweb/sample_tests/clean.php <?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: clean.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: clean.inc</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>&lt;?php include_once(dirname(__FILE__) . &#039;/imap_include.inc&#039;); $imap_stream = imap_open($default_mailbox, $username, $password); // delete all msgs in default mailbox, i.e INBOX $check = imap_check($imap_stream); for ($i = 1; $i &lt;= $check-&gt;Nmsgs; $i++) { imap_delete($imap_stream, $i); } $mailboxes = imap_getmailboxes($imap_stream, $server, &#039;*&#039;); foreach($mailboxes as $value) { // Only delete mailboxes with our prefix if (preg_match(&#039;/\{.*?\}INBOX\.(.+)/&#039;, $value-&gt;name, $match) == 1) { if (strlen($match[1]) &gt;= strlen($mailbox_prefix) &amp;&amp; substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) { imap_deletemailbox($imap_stream, $value-&gt;name); } } } imap_close($imap_stream, CL_EXPUNGE); ?&gt;</pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/file012.php?view=markup&rev=1.1 Index: qaweb/sample_tests/file012.php +++ qaweb/sample_tests/file012.php <?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: file012.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: file012.php</h1> <p>Back to &quot;<a href="../../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>&lt;?php echo &quot;hello world\n&quot;; ?&gt; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample001.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample001.php +++ qaweb/sample_tests/sample001.php <?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: sample001.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample001.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Test filter_input() with GET and POST data. --DESCRIPTION-- This test covers both valid and invalid usages of filter_input() with INPUT_GET and INPUT_POST data and several differnt filter sanitizers. --CREDIT-- Felipe Pena &lt;felipe@php.net&gt; --INI-- precision=14 --SKIPIF-- &lt;?php if (!extension_loaded(&quot;filter&quot;)) die(&quot;Skipped: filter extension required.&quot;); ?&gt; --GET-- a=&lt;b&gt;test&lt;/b&gt;&amp;b=http://example.com --POST-- c=&lt;p&gt;string&lt;/p&gt;&amp;d=12345.7 --FILE-- &lt;?php ini_set(&#039;html_errors&#039;, false); var_dump(filter_input(INPUT_GET, &quot;a&quot;, FILTER_SANITIZE_STRIPPED)); var_dump(filter_input(INPUT_GET, &quot;b&quot;, FILTER_SANITIZE_URL)); var_dump(filter_input(INPUT_GET, &quot;a&quot;, FILTER_SANITIZE_SPECIAL_CHARS, array(1,2,3,4,5))); var_dump(filter_input(INPUT_GET, &quot;b&quot;, FILTER_VALIDATE_FLOAT, new stdClass)); var_dump(filter_input(INPUT_POST, &quot;c&quot;, FILTER_SANITIZE_STRIPPED, array(5,6,7,8))); var_dump(filter_input(INPUT_POST, &quot;d&quot;, FILTER_VALIDATE_FLOAT)); var_dump(filter_input(INPUT_POST, &quot;c&quot;, FILTER_SANITIZE_SPECIAL_CHARS)); var_dump(filter_input(INPUT_POST, &quot;d&quot;, FILTER_VALIDATE_INT)); var_dump(filter_var(new stdClass, &quot;d&quot;)); var_dump(filter_input(INPUT_POST, &quot;c&quot;, &quot;&quot;, &quot;&quot;)); var_dump(filter_var(&quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;)); var_dump(filter_var(0, 0, 0, 0, 0)); echo &quot;Done\n&quot;; ?&gt; --EXPECTF-- string(4) &quot;test&quot; string(18) &quot;http://example.com&quot; string(27) &quot;&amp;#60;b&amp;#62;test&amp;#60;/b&amp;#62;&quot; Notice: Object of class stdClass could not be converted to int in %ssample001.php on line %d bool(false) string(6) &quot;string&quot; float(12345.7) string(29) &quot;&amp;#60;p&amp;#62;string&amp;#60;/p&amp;#62;&quot; bool(false) Warning: filter_var() expects parameter 2 to be long, string given in %ssample001.php on line %d NULL Warning: filter_input() expects parameter 3 to be long, string given in %ssample001.php on line %d NULL Warning: filter_var() expects at most 3 parameters, 5 given in %ssample001.php on line %d NULL Warning: filter_var() expects at most 3 parameters, 5 given in %ssample001.php on line %d NULL Done </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample002.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample002.php +++ qaweb/sample_tests/sample002.php <?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: sample002.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample002.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Test receipt of cookie data. --CREDITS-- Zoe Slattery zoe@php.net # TestFest Munich 2009-05-19 --COOKIE-- hello=World;goodbye=MrChips --FILE-- &lt;?php var_dump($_COOKIE); ?&gt; --EXPECT-- array(2) { [&quot;hello&quot;]=&gt; string(5) &quot;World&quot; [&quot;goodbye&quot;]=&gt; string(7) &quot;MrChips&quot; } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample003.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample003.php +++ qaweb/sample_tests/sample003.php <?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: sample003.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample003.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- session object deserialization --SKIPIF-- &lt;?php include(&#039;<a href="skipif.php">skipif.inc</a>&#039;); ?&gt; --INI-- session.use_cookies=0 session.cache_limiter= register_globals=1 session.serialize_handler=php session.save_handler=files --FILE-- &lt;?php error_reporting(E_ALL); class foo { public $bar = &quot;ok&quot;; function method() { $this-&gt;yes++; } } session_id(&quot;abtest&quot;); session_start(); session_decode(&#039;baz|O:3:&quot;foo&quot;:2:{s:3:&quot;bar&quot;;s:2:&quot;ok&quot;;s:3:&quot;yes&quot;;i:1;}arr|a:1:{i:3;O:3:&quot;foo&quot;:2:{s:3:&quot;bar&quot;;s:2:&quot;ok&quot;;s:3:&quot;yes&quot;;i:1;}}&#039;); $baz-&gt;method(); $arr[3]-&gt;method(); var_dump($baz); var_dump($arr); session_destroy(); --EXPECT-- object(foo)#1 (2) { [&quot;bar&quot;]=&gt; string(2) &quot;ok&quot; [&quot;yes&quot;]=&gt; int(2) } array(1) { [3]=&gt; object(foo)#2 (2) { [&quot;bar&quot;]=&gt; string(2) &quot;ok&quot; [&quot;yes&quot;]=&gt; int(2) } } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample004.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample004.php +++ qaweb/sample_tests/sample004.php <?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: sample004.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample004.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- QUERY_STRING Security Bug --DESCRIPTION-- This bug was present in PHP 4.3.0 only. A failure should print HELLO. --REQUEST-- return &lt;&lt;&lt;END SCRIPT_NAME=/nothing.php QUERY_STRING=$filename END; --ENV-- return &lt;&lt;&lt;END REDIRECT_URL=$scriptname PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php QUERY_STRING=$filename PATH_INFO=/nothing.php SCRIPT_NAME=/phpexe/php.exe/nothing.php SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php END; --FILE-- &lt;?php echo &quot;HELLO&quot;; ?&gt; --EXPECTHEADERS-- Status: 404 --EXPECT-- No input file specified.</pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample005.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample005.php +++ qaweb/sample_tests/sample005.php <?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: sample005.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample005.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- SOAP Server 19: compressed request (gzip) --SKIPIF-- &lt;?php if (php_sapi_name()==&#039;cli&#039;) echo &#039;skip&#039;; require_once(&#039;<a href="skipif2.php">skipif2.inc</a>&#039;); if (!extension_loaded(&#039;zlib&#039;)) die(&#039;skip zlib extension not available&#039;); ?&gt; --INI-- precision=14 --POST-- &lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:si=&quot;http://soapinterop.org/xsd&quot;&gt; &lt;SOAP-ENV:Body&gt; &lt;ns1:test xmlns:ns1=&quot;http://testuri.org&quot; /&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; --GZIP_POST-- 1 --FILE-- &lt;?php function test() { return &quot;Hello World&quot;; } $server = new soapserver(null,array(&#039;uri&#039;=&gt;&quot;http://testuri.org&quot;)); $server-&gt;addfunction(&quot;test&quot;); $server-&gt;handle(); echo &quot;ok\n&quot;; ?&gt; --EXPECT-- &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1=&quot;http://testuri.org&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:testResponse&gt;&lt;return xsi:type=&quot;xsd:string&quot;&gt;Hello World&lt;/return&gt;&lt;/ns1:testResponse&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt; ok </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample006.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample006.php +++ qaweb/sample_tests/sample006.php <?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: sample006.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample006.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- is_uploaded_file() function --CREDITS-- Dave Kelsey &lt;d_kelsey@uk.ibm.com&gt; --SKIPIF-- &lt;?php if (php_sapi_name()==&#039;cli&#039;) die(&#039;skip&#039;); ?&gt; --POST_RAW-- Content-type: multipart/form-data, boundary=AaB03x --AaB03x content-disposition: form-data; name=&quot;field1&quot; Joe Blow --AaB03x content-disposition: form-data; name=&quot;pics&quot;; filename=&quot;file1.txt&quot; Content-Type: text/plain abcdef123456789 --AaB03x-- --FILE-- &lt;?php // uploaded file var_dump(is_uploaded_file($_FILES[&#039;pics&#039;][&#039;tmp_name&#039;])); // not an uploaded file var_dump(is_uploaded_file($_FILES[&#039;pics&#039;][&#039;name&#039;])); // not an uploaded file var_dump(is_uploaded_file(&#039;random_filename.txt&#039;)); // not an uploaded file var_dump(is_uploaded_file(&#039;__FILE__&#039;)); // Error cases var_dump(is_uploaded_file()); var_dump(is_uploaded_file(&#039;a&#039;, &#039;b&#039;)); ?&gt; --EXPECTF-- bool(true) bool(false) bool(false) bool(false) Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d NULL Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d NULL </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample007.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample007.php +++ qaweb/sample_tests/sample007.php <?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: sample007.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample007.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- SOAP Server 20: compressed request (deflate) --SKIPIF-- &lt;?php if (php_sapi_name()==&#039;cli&#039;) echo &#039;skip&#039;; require_once(&#039;<a href="skipif2.php">skipif2.inc</a>&#039;); if (!extension_loaded(&#039;zlib&#039;)) die(&#039;skip zlib extension not available&#039;); ?&gt; --INI-- precision=14 --POST-- &lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt; &lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:si=&quot;http://soapinterop.org/xsd&quot;&gt; &lt;SOAP-ENV:Body&gt; &lt;ns1:test xmlns:ns1=&quot;http://testuri.org&quot; /&gt; &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; --DEFLATE_POST-- 1 --FILE-- &lt;?php function test() { return &quot;Hello World&quot;; } $server = new soapserver(null,array(&#039;uri&#039;=&gt;&quot;http://testuri.org&quot;)); $server-&gt;addfunction(&quot;test&quot;); $server-&gt;handle(); echo &quot;ok\n&quot;; ?&gt; --EXPECT-- &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1=&quot;http://testuri.org&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:testResponse&gt;&lt;return xsi:type=&quot;xsd:string&quot;&gt;Hello World&lt;/return&gt;&lt;/ns1:testResponse&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt; ok </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample008.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample008.php +++ qaweb/sample_tests/sample008.php <?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: sample008.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample008.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- GET/POST/REQUEST Test with input_filter --SKIPIF-- &lt;?php if (!extension_loaded(&quot;filter&quot;)) die(&quot;skip&quot;); ?&gt; --POST-- d=379 --GET-- ar[elm1]=1234&amp;ar[elm2]=0660&amp;a=0234 --FILE-- &lt;?php $ret = filter_input(INPUT_GET, &#039;a&#039;, FILTER_VALIDATE_INT); var_dump($ret); $ret = filter_input(INPUT_GET, &#039;a&#039;, FILTER_VALIDATE_INT, array(&#039;flags&#039;=&gt;FILTER_FLAG_ALLOW_OCTAL)); var_dump($ret); $ret = filter_input(INPUT_GET, &#039;ar&#039;, FILTER_VALIDATE_INT, array(&#039;flags&#039;=&gt;FILTER_REQUIRE_ARRAY)); var_dump($ret); $ret = filter_input(INPUT_GET, &#039;ar&#039;, FILTER_VALIDATE_INT, array(&#039;flags&#039;=&gt;FILTER_FLAG_ALLOW_OCTAL|FILTER_REQUIRE_ARRAY)); var_dump($ret); ?&gt; --EXPECT-- bool(false) int(156) array(2) { [&quot;elm1&quot;]=&gt; int(1234) [&quot;elm2&quot;]=&gt; bool(false) } array(2) { [&quot;elm1&quot;]=&gt; int(1234) [&quot;elm2&quot;]=&gt; int(432) } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample009.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample009.php +++ qaweb/sample_tests/sample009.php <?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: sample009.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample009.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- STDIN input --FILE-- &lt;?php var_dump(stream_get_contents(STDIN)); ?&gt; --STDIN-- fooBar use this to input some thing to the php script --EXPECT-- string(54) &quot;fooBar use this to input some thing to the php script &quot; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample010.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample010.php +++ qaweb/sample_tests/sample010.php <?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: sample010.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample010.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- getopt#005 (Required values) --ARGS-- --arg value --arg=value -avalue -a=value -a value --INI-- register_argc_argv=On variables_order=GPS --FILE-- &lt;?php var_dump(getopt(&quot;a:&quot;, array(&quot;arg:&quot;))); ?&gt; --EXPECT-- array(2) { [&quot;arg&quot;]=&gt; array(2) { [0]=&gt; string(5) &quot;value&quot; [1]=&gt; string(5) &quot;value&quot; } [&quot;a&quot;]=&gt; array(3) { [0]=&gt; string(5) &quot;value&quot; [1]=&gt; string(5) &quot;value&quot; [2]=&gt; string(5) &quot;value&quot; } } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample011.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample011.php +++ qaweb/sample_tests/sample011.php <?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: sample011.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample011.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Bug #35382 (Comment in end of file produces fatal error) --FILEEOF-- &lt;?php eval(&quot;echo &#039;Hello&#039;; // comment&quot;); echo &quot; World&quot;; //last line comment --EXPECTF-- Hello World </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample012.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample012.php +++ qaweb/sample_tests/sample012.php <?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: sample012.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample012.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- sample test for file_external --FILE_EXTERNAL-- files/<a href="files/file012.php">file012.php</a> --EXPECT-- hello world </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample013.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample013.php +++ qaweb/sample_tests/sample013.php <?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: sample013.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample013.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- SQLite2 --SKIPIF-- &lt;?php # vim:ft=php if (!extension_loaded(&#039;pdo&#039;) || !extension_loaded(&#039;sqlite&#039;)) print &#039;skip&#039;; ?&gt; --REDIRECTTEST-- return array( &#039;ENV&#039; =&gt; array( &#039;PDOTEST_DSN&#039; =&gt; &#039;sqlite2::memory:&#039; ), &#039;TESTS&#039; =&gt; &#039;ext/pdo/tests&#039; ); </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample014.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample014.php +++ qaweb/sample_tests/sample014.php <?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: sample014.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample014.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- MySQL --SKIPIF-- &lt;?php # vim:ft=php if (!extension_loaded(&#039;pdo&#039;) || !extension_loaded(&#039;pdo_mysql&#039;)) print &#039;skip not loaded&#039;; ?&gt; --REDIRECTTEST-- # magic auto-configuration $config = array( &#039;TESTS&#039; =&gt; &#039;ext/pdo/tests&#039; ); if (false !== getenv(&#039;PDO_MYSQL_TEST_DSN&#039;)) { # user set them from their shell $config[&#039;ENV&#039;][&#039;PDOTEST_DSN&#039;] = getenv(&#039;PDO_MYSQL_TEST_DSN&#039;); $config[&#039;ENV&#039;][&#039;PDOTEST_USER&#039;] = getenv(&#039;PDO_MYSQL_TEST_USER&#039;); $config[&#039;ENV&#039;][&#039;PDOTEST_PASS&#039;] = getenv(&#039;PDO_MYSQL_TEST_PASS&#039;); if (false !== getenv(&#039;PDO_MYSQL_TEST_ATTR&#039;)) { $config[&#039;ENV&#039;][&#039;PDOTEST_ATTR&#039;] = getenv(&#039;PDO_MYSQL_TEST_ATTR&#039;); } } else { $config[&#039;ENV&#039;][&#039;PDOTEST_DSN&#039;] = &#039;mysql:host=localhost;dbname=test&#039;; $config[&#039;ENV&#039;][&#039;PDOTEST_USER&#039;] = &#039;root&#039;; $config[&#039;ENV&#039;][&#039;PDOTEST_PASS&#039;] = &#039;&#039;; } return $config; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample015.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample015.php +++ qaweb/sample_tests/sample015.php <?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: sample015.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample015.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Multipart Form POST Data --HEADERS-- return &lt;&lt;&lt;END Content-Type=multipart/form-data; boundary=---------------------------240723202011929 Content-Length=862 END; --ENV-- return &lt;&lt;&lt;END CONTENT_TYPE=multipart/form-data; boundary=---------------------------240723202011929 CONTENT_LENGTH=862 END; --POST-- -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;entry&quot; entry box -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;password&quot; password box -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;radio1&quot; test 1 -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;checkbox1&quot; test 1 -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;choices&quot; Choice 1 -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;choices&quot; Choice 2 -----------------------------240723202011929 Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;info.php&quot; Content-Type: application/octet-stream &lt;?php phpinfo(); ?&gt; -----------------------------240723202011929-- --FILE-- &lt;?php error_reporting(0); print_r($_POST); print_r($_FILES); ?&gt; --EXPECTF-- Array ( [entry] =&gt; entry box [password] =&gt; password box [radio1] =&gt; test 1 [checkbox1] =&gt; test 1 [choices] =&gt; Choice 2 ) Array ( [file] =&gt; Array ( [name] =&gt; info.php [type] =&gt; application/octet-stream [tmp_name] =&gt; %s [error] =&gt; 0 [size] =&gt; 21 ) ) </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample016.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample016.php +++ qaweb/sample_tests/sample016.php <?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: sample016.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample016.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Test get variables with CGI binary --GET-- hello=World&amp;goodbye=MrChips --CGI-- --FILE-- &lt;?php var_dump($_GET); ?&gt; --EXPECT-- array(2) { [&quot;hello&quot;]=&gt; string(5) &quot;World&quot; [&quot;goodbye&quot;]=&gt; string(7) &quot;MrChips&quot; } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample017.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample017.php +++ qaweb/sample_tests/sample017.php <?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: sample017.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample017.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- PDO Common: Bug #34630 (inserting streams as LOBs) --SKIPIF-- &lt;?php # vim:ft=php if (!extension_loaded(&#039;pdo&#039;)) die(&#039;skip&#039;); $dir = getenv(&#039;REDIR_TEST_DIR&#039;); if (false == $dir) die(&#039;skip no driver&#039;); require_once $dir . &#039;pdo_test.inc&#039;; PDOTest::skip(); ?&gt; --FILE-- &lt;?php if (getenv(&#039;REDIR_TEST_DIR&#039;) === false) putenv(&#039;REDIR_TEST_DIR=&#039;.dirname(__FILE__) . &#039;/../../pdo/tests/&#039;); require_once getenv(&#039;REDIR_TEST_DIR&#039;) . &#039;pdo_test.inc&#039;; $db = PDOTest::factory(); $driver = $db-&gt;getAttribute(PDO::ATTR_DRIVER_NAME); $is_oci = $driver == &#039;oci&#039;; if ($is_oci) { $db-&gt;exec(&#039;CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)&#039;); } else { $db-&gt;exec(&#039;CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))&#039;); } $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $fp = tmpfile(); fwrite($fp, &quot;I am the LOB data&quot;); rewind($fp); if ($is_oci) { /* oracle is a bit different; you need to initiate a transaction otherwise * the empty blob will be committed implicitly when the statement is * executed */ $db-&gt;beginTransaction(); $insert = $db-&gt;prepare(&quot;insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob&quot;); } else { $insert = $db-&gt;prepare(&quot;insert into test (id, val) values (1, :blob)&quot;); } $insert-&gt;bindValue(&#039;:blob&#039;, $fp, PDO::PARAM_LOB); $insert-&gt;execute(); $insert = null; $db-&gt;setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); var_dump($db-&gt;query(&quot;SELECT * from test&quot;)-&gt;fetchAll(PDO::FETCH_ASSOC)); ?&gt; --XFAIL-- This bug might be still open on aix5.2-ppc64 and hpux11.23-ia64 --EXPECT-- array(1) { [0]=&gt; array(2) { [&quot;id&quot;]=&gt; string(1) &quot;1&quot; [&quot;val&quot;]=&gt; string(17) &quot;I am the LOB data&quot; } } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample018.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample018.php +++ qaweb/sample_tests/sample018.php <?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: sample018.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample018.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Phar front controller rewrite access denied [cache_list] --INI-- default_charset=UTF-8 phar.cache_list={PWD}/frontcontroller10.php --SKIPIF-- &lt;?php if (!extension_loaded(&quot;phar&quot;)) die(&quot;skip&quot;); ?&gt; --ENV-- SCRIPT_NAME=/frontcontroller10.php REQUEST_URI=/frontcontroller10.php/hi PATH_INFO=/hi --FILE_EXTERNAL-- files/frontcontroller4.phar --EXPECTHEADERS-- Content-type: text/html; charset=UTF-8 Status: 403 Access Denied --EXPECT-- &lt;html&gt; &lt;head&gt; &lt;title&gt;Access Denied&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;403 - File /hi Access Denied&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample019.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample019.php +++ qaweb/sample_tests/sample019.php <?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: sample019.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample019.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- bzopen() and invalid parameters --SKIPIF-- &lt;?php if (!extension_loaded(&quot;bz2&quot;)) print &quot;skip&quot;; ?&gt; --FILE-- &lt;?php var_dump(bzopen()); var_dump(bzopen(&quot;&quot;, &quot;&quot;)); var_dump(bzopen(&quot;&quot;, &quot;r&quot;)); var_dump(bzopen(&quot;&quot;, &quot;w&quot;)); var_dump(bzopen(&quot;&quot;, &quot;x&quot;)); var_dump(bzopen(&quot;&quot;, &quot;rw&quot;)); var_dump(bzopen(&quot;no_such_file&quot;, &quot;r&quot;)); $fp = fopen(__FILE__,&quot;r&quot;); var_dump(bzopen($fp, &quot;r&quot;)); echo &quot;Done\n&quot;; ?&gt; --EXPECTF-- Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d NULL Warning: bzopen(): &#039;&#039; is not a valid mode for bzopen(). Only &#039;w&#039; and &#039;r&#039; are supported. in %s on line %d bool(false) Warning: bzopen(): filename cannot be empty in %s on line %d bool(false) Warning: bzopen(): filename cannot be empty in %s on line %d bool(false) Warning: bzopen(): &#039;x&#039; is not a valid mode for bzopen(). Only &#039;w&#039; and &#039;r&#039; are supported. in %s on line %d bool(false) Warning: bzopen(): &#039;rw&#039; is not a valid mode for bzopen(). Only &#039;w&#039; and &#039;r&#039; are supported. in %s on line %d bool(false) Warning: bzopen(no_such_file): failed to open stream: No such file or directory in %s on line %d bool(false) resource(%d) of type (stream) Done </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample020.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample020.php +++ qaweb/sample_tests/sample020.php <?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: sample020.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample020.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Bug #42082 (NodeList length zero should be empty) --FILE-- &lt;?php $doc = new DOMDocument(); $xpath = new DOMXPath($doc); $nodes = $xpath-&gt;query(&#039;*&#039;); var_dump($nodes); var_dump($nodes-&gt;length); $length = $nodes-&gt;length; var_dump(empty($nodes-&gt;length), empty($length)); $doc-&gt;loadXML(&quot;&lt;element&gt;&lt;/element&gt;&quot;); var_dump($doc-&gt;firstChild-&gt;nodeValue, empty($doc-&gt;firstChild-&gt;nodeValue), isset($doc-&gt;firstChild-&gt;nodeValue)); var_dump(empty($doc-&gt;nodeType), empty($doc-&gt;firstChild-&gt;nodeType)) ?&gt; --EXPECTF-- object(DOMNodeList)#%d (0) { } int(0) bool(true) bool(true) string(0) &quot;&quot; bool(true) bool(true) bool(false) bool(false)</pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample021.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample021.php +++ qaweb/sample_tests/sample021.php <?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: sample021.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample021.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Math constants --INI-- precision=14 --FILE-- &lt;?php $constants = array( &quot;M_E&quot;, &quot;M_LOG2E&quot;, &quot;M_LOG10E&quot;, &quot;M_LN2&quot;, &quot;M_LN10&quot;, &quot;M_PI&quot;, &quot;M_PI_2&quot;, &quot;M_PI_4&quot;, &quot;M_1_PI&quot;, &quot;M_2_PI&quot;, &quot;M_SQRTPI&quot;, &quot;M_2_SQRTPI&quot;, &quot;M_LNPI&quot;, &quot;M_EULER&quot;, &quot;M_SQRT2&quot;, &quot;M_SQRT1_2&quot;, &quot;M_SQRT3&quot; ); foreach($constants as $constant) { printf(&quot;%-10s: %s\n&quot;, $constant, constant($constant)); } ?&gt; --EXPECTREGEX-- M_E : 2.718281[0-9]* M_LOG2E : 1.442695[0-9]* M_LOG10E : 0.434294[0-9]* M_LN2 : 0.693147[0-9]* M_LN10 : 2.302585[0-9]* M_PI : 3.141592[0-9]* M_PI_2 : 1.570796[0-9]* M_PI_4 : 0.785398[0-9]* M_1_PI : 0.318309[0-9]* M_2_PI : 0.636619[0-9]* M_SQRTPI : 1.772453[0-9]* M_2_SQRTPI: 1.128379[0-9]* M_LNPI : 1.144729[0-9]* M_EULER : 0.577215[0-9]* M_SQRT2 : 1.414213[0-9]* M_SQRT1_2 : 0.707106[0-9]* M_SQRT3 : 1.732050[0-9]* </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample022.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample022.php +++ qaweb/sample_tests/sample022.php <?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: sample022.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample022.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- shm_detach() tests --SKIPIF-- &lt;?php if (!extension_loaded(&quot;sysvshm&quot;)) print &quot;skip&quot;; ?&gt; --FILE-- &lt;?php $key = ftok(dirname(__FILE__).&quot;/003.phpt&quot;, &#039;q&#039;); var_dump(shm_detach()); var_dump(shm_detach(1,1)); $s = shm_attach($key); var_dump(shm_detach($s)); var_dump(shm_detach($s)); shm_remove($s); var_dump(shm_detach(0)); var_dump(shm_detach(1)); var_dump(shm_detach(-1)); echo &quot;Done\n&quot;; ?&gt; --CLEAN-- &lt;?php $key = ftok(dirname(__FILE__).&quot;/003.phpt&quot;, &#039;q&#039;); $s = shm_attach($key); shm_remove($s); ?&gt; --EXPECTF-- Warning: shm_detach() expects exactly 1 parameter, 0 given in %ssample022.php on line %d NULL Warning: shm_detach() expects exactly 1 parameter, 2 given in %ssample022.php on line %d NULL bool(true) Warning: shm_detach(): %d is not a valid sysvshm resource in %ssample022.php on line %d bool(false) Warning: shm_remove(): %d is not a valid sysvshm resource in %ssample022.php on line %d Warning: shm_detach() expects parameter 1 to be resource, integer given in %ssample022.php on line %d NULL Warning: shm_detach() expects parameter 1 to be resource, integer given in %ssample022.php on line %d NULL Warning: shm_detach() expects parameter 1 to be resource, integer given in %ssample022.php on line %d NULL Done </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample023.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample023.php +++ qaweb/sample_tests/sample023.php <?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: sample023.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample023.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Bug #23894 (sprintf() decimal specifiers problem) --FILE-- &lt;?php $a = -12.3456; $test = sprintf(&quot;%04d&quot;, $a); var_dump($test, bin2hex($test)); $test = sprintf(&quot;% 13u&quot;, $a); var_dump($test, bin2hex($test)); ?&gt; --EXPECTREGEX-- string\(4\) \&quot;-012\&quot; string\(8\) \&quot;2d303132\&quot; (string\(13\) \&quot; 4294967284\&quot;|string\(20\) \&quot;18446744073709551604\&quot;) (string\(26\) \&quot;20202034323934393637323834\&quot;|string\(40\) \&quot;3138343436373434303733373039353531363034\&quot;) </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample024.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample024.php +++ qaweb/sample_tests/sample024.php <?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: sample024.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample024.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- DOMDocument::save Test basic function of save method --SKIPIF-- &lt;?php require_once(&#039;skipif.inc&#039;); ?&gt; --FILE-- &lt;?php $doc = new DOMDocument(&#039;1.0&#039;); $doc-&gt;formatOutput = true; $root = $doc-&gt;createElement(&#039;book&#039;); $root = $doc-&gt;appendChild($root); $title = $doc-&gt;createElement(&#039;title&#039;); $title = $root-&gt;appendChild($title); $text = $doc-&gt;createTextNode(&#039;This is the title&#039;); $text = $title-&gt;appendChild($text); $temp_filename = dirname(__FILE__).&quot;/DomDocument_save_basic.tmp&quot;; echo &#039;Wrote: &#039; . $doc-&gt;save($temp_filename) . &#039; bytes&#039;; // Wrote: 72 bytes ?&gt; --CLEAN-- &lt;?php $temp_filename = dirname(__FILE__).&quot;/DomDocument_save_basic.tmp&quot;; unlink($temp_filename); ?&gt; --EXPECTF-- Wrote: 72 bytes </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample025.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample025.php +++ qaweb/sample_tests/sample025.php <?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: sample025.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample025.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- Test imap_append() function : basic functionality --SKIPIF-- &lt;?php require_once(dirname(__FILE__).&#039;/skipif.inc&#039;); ?&gt; --FILE-- &lt;?php /* Prototype : bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options ] ) * Description: Append a string message to a specified mailbox. * Source code: ext/imap/php_imap.c */ echo &quot;*** Testing imap_append() : basic functionality ***\n&quot;; require_once(dirname(__FILE__).&#039;/imap_include.inc&#039;); echo &quot;Create a new mailbox for test\n&quot;; $imap_stream = setup_test_mailbox(&quot;&quot;, 0); if (!is_resource($imap_stream)) { exit(&quot;TEST FAILED: Unable to create test mailbox\n&quot;); } $mb_details = imap_mailboxmsginfo($imap_stream); echo &quot;Add a couple of msgs to new mailbox &quot; . $mb_details-&gt;Mailbox . &quot;\n&quot;; var_dump(imap_append($imap_stream, $mb_details-&gt;Mailbox , &quot;From: webmaster@something.com\r\n&quot; . &quot;To: info@something.com\r\n&quot; . &quot;Subject: Test message\r\n&quot; . &quot;\r\n&quot; . &quot;this is a test message, please ignore\r\n&quot; )); var_dump(imap_append($imap_stream, $mb_details-&gt;Mailbox , &quot;From: webmaster@something.com\r\n&quot; . &quot;To: info@something.com\r\n&quot; . &quot;Subject: Another test\r\n&quot; . &quot;\r\n&quot; . &quot;this is another test message, please ignore it too!!\r\n&quot; )); $check = imap_check($imap_stream); echo &quot;Msg Count after append : &quot;. $check-&gt;Nmsgs . &quot;\n&quot;; echo &quot;List the msg headers\n&quot;; var_dump(imap_headers($imap_stream)); imap_close($imap_stream); ?&gt; --CLEAN-- &lt;?php require_once(&#039;clean.inc&#039;); ?&gt; --EXPECTF-- *** Testing imap_append() : basic functionality *** Create a new mailbox for test Create a temporary mailbox and add 0 msgs... mailbox &#039;%s&#039; created Add a couple of msgs to new mailbox {%s}INBOX.%s bool(true) bool(true) Msg Count after append : 2 List the msg headers array(2) { [0]=&gt; string(%d) &quot;%w%s 1)%s webmaster@something. Test message (%d chars)&quot; [1]=&gt; string(%d) &quot;%w%s 2)%s webmaster@something. Another test (%d chars)&quot; } </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/sample026.php?view=markup&rev=1.1 Index: qaweb/sample_tests/sample026.php +++ qaweb/sample_tests/sample026.php <?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: sample026.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: sample027.phpt</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>--TEST-- SPL: ArrayIterator implementing RecursiveIterator --FILE-- &lt;?php $array = array(1, 2 =&gt; array(21, 22 =&gt; array(221, 222), 23 =&gt; array(231)), 3); $dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($dir as $file) { print &quot;$file\n&quot;; } ?&gt; ===DONE=== &lt;?php exit(0); ?&gt; --EXPECT-- 1 21 221 222 231 3 </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/skipif.php?view=markup&rev=1.1 Index: qaweb/sample_tests/skipif.php +++ qaweb/sample_tests/skipif.php <?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: skipif.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: skipif.inc</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>&lt;?php // This script prints &quot;skip&quot; if condition does not meet. if (!extension_loaded(&quot;session&quot;) &amp;&amp; ini_get(&quot;enable_dl&quot;)) { $dlext = (substr(PHP_OS, 0, 3) == &quot;WIN&quot;) ? &quot;.dll&quot; : &quot;.so&quot;; @dl(&quot;session$dlext&quot;); } if (!extension_loaded(&quot;session&quot;)) { die(&quot;skip Session module not loaded&quot;); } $save_path = ini_get(&quot;session.save_path&quot;); if ($save_path) { if (!file_exists($save_path)) { die(&quot;skip Session save_path doesn&#039;t exist&quot;); } if ($save_path &amp;&amp; !@is_writable($save_path)) { if (($p = strpos($save_path, &#039;;&#039;)) !== false) { $save_path = substr($save_path, ++$p); } if (!@is_writable($save_path)) { die(&quot;skip\n&quot;); } } } ?&gt; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?> http://cvs.php.net/viewvc.cgi/qaweb/sample_tests/skipif2.php?view=markup&rev=1.1 Index: qaweb/sample_tests/skipif2.php +++ qaweb/sample_tests/skipif2.php <?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: skipif2.php,v 1.1 2009/05/09 02:21:43 ericstewart Exp $ */ common_header(); ?> <div style="padding: 10px"> <h1>Sample Test: skipif2.inc</h1> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> <pre>&lt;?php if (!extension_loaded(&#039;soap&#039;)) die(&#039;skip soap extension not available&#039;); ?&gt; </pre> <p>Back to &quot;<a href="../phpt_details.php">PHPT Test File Layout</a>&quot;</p> </div> <?php common_footer(); ?>
« previous php.qa (#64905) next »