<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=Testing_DocTest&amp;PHPSESSID=jfurjajqpt756h6fllnlhpl8t0</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/16393" />
      <rdf:li rdf:resource="http://pear.php.net/bug/15948" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/16393">
      <title>Testing_DocTest: Feature/Change Request 16393 [Assigned] Better support for file-level code</title>
      <link>http://pear.php.net/bugs/16393</link>
      <content:encoded><![CDATA[<pre>Testing_DocTest Feature/Change Request
Reported by digger
2009-07-01T02:36:01+00:00
PHP: 5.2.9 OS: n/a Package Version: 0.4.1

Description:
------------
Some of the files I would like to add doctests to contain bare code (outside of functions and classes), and have behavior that depends on external values (web server environment variables, command-line arguments, etc).  Since DocTest require()s the tested source before running the test, the tested code has already executed by the time test code gets a chance to set up the necessary data.

What would be nice to see is a keyword (&quot;setup:&quot; in my examples below) that could be used to specify test setup code to run BEFORE the tested file is require()d.  This way the test code could prepare some necessary data, then the tested file would be require()d, and finally the test code would be run.

Similarly, scripts with bare code like this will often produce output without any actual test code needed.  But if the code section of the test is omitted, DocTest complains &quot;Error: unexpected expects line&quot;.  So the second part of this request is that the test code be optional.  That is, a test could contain the setup code (described above), or the usual test code, or both, or neither.

The &quot;both&quot; case is a bit tricky, due to the need to somehow separate the setup code and the test code.  Perhaps there could be an optional keyword (&quot;test:&quot; in my examples) which if present just indicates the start of the test code, acting as a separator if necessary.

Test script:
---------------
/**
 * &lt;code&gt;
 * // doctest: Web page test
 * // setup:
 * // $_SERVER['REQUEST_URI'] = '/test/script';
 * // expects:
 * // You requested '/test/script'.
 * &lt;/code&gt;
 */
echo &quot;You requested '{$_SERVER['REQUEST_URI']}'.&quot;;

//===================

/**
 * &lt;code&gt;
 * // doctest: Command line test
 * // setup:
 * // $argc = 1;
 * // $argv = array('test');
 * // expects:
 * // Your command was 'test'.
 * &lt;/code&gt;
 */
if ($argc &gt; 0) {
    echo &quot;Your command was: '{$argv[0]}'.&quot;;
}

//===================

/**
 * &lt;code&gt;
 * // doctest: Both setup and test code
 * // setup:
 * // $_ENV['OSTYPE'] = 'linux';
 * // test:
 * // echo OS_TYPE;
 * // expects:
 * // linux
 * &lt;/code&gt;
 */
define('OS_TYPE', $_ENV['OSTYPE']);</pre>]]></content:encoded>
      <description><![CDATA[<pre>Testing_DocTest Feature/Change Request
Reported by digger
2009-07-01T02:36:01+00:00
PHP: 5.2.9 OS: n/a Package Version: 0.4.1

Description:
------------
Some of the files I would like to add doctests to contain bare code (outside of functions and classes), and have behavior that depends on external values (web server environment variables, command-line arguments, etc).  Since DocTest require()s the tested source before running the test, the tested code has already executed by the time test code gets a chance to set up the necessary data.

What would be nice to see is a keyword (&quot;setup:&quot; in my examples below) that could be used to specify test setup code to run BEFORE the tested file is require()d.  This way the test code could prepare some necessary data, then the tested file would be require()d, and finally the test code would be run.

Similarly, scripts with bare code like this will often produce output without any actual test code needed.  But if the code section of the test is omitted, DocTest complains &quot;Error: unexpected expects line&quot;.  So the second part of this request is that the test code be optional.  That is, a test could contain the setup code (described above), or the usual test code, or both, or neither.

The &quot;both&quot; case is a bit tricky, due to the need to somehow separate the setup code and the test code.  Perhaps there could be an optional keyword (&quot;test:&quot; in my examples) which if present just indicates the start of the test code, acting as a separator if necessary.

Test script:
---------------
/**
 * &lt;code&gt;
 * // doctest: Web page test
 * // setup:
 * // $_SERVER['REQUEST_URI'] = '/test/script';
 * // expects:
 * // You requested '/test/script'.
 * &lt;/code&gt;
 */
echo &quot;You requested '{$_SERVER['REQUEST_URI']}'.&quot;;

//===================

/**
 * &lt;code&gt;
 * // doctest: Command line test
 * // setup:
 * // $argc = 1;
 * // $argv = array('test');
 * // expects:
 * // Your command was 'test'.
 * &lt;/code&gt;
 */
if ($argc &gt; 0) {
    echo &quot;Your command was: '{$argv[0]}'.&quot;;
}

//===================

/**
 * &lt;code&gt;
 * // doctest: Both setup and test code
 * // setup:
 * // $_ENV['OSTYPE'] = 'linux';
 * // test:
 * // echo OS_TYPE;
 * // expects:
 * // linux
 * &lt;/code&gt;
 */
define('OS_TYPE', $_ENV['OSTYPE']);</pre>]]></description>
      <dc:date>2009-09-17T10:52:54+00:00</dc:date>
      <dc:creator>dw-pear &amp;#x61;&amp;#116; digger &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>Testing_DocTest Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/15948">
      <title>Testing_DocTest: Feature/Change Request 15948 [Analyzed] Add ability to enter into interactive mode inside a doctest</title>
      <link>http://pear.php.net/bugs/15948</link>
      <content:encoded><![CDATA[<pre>Testing_DocTest Feature/Change Request
Reported by sofia
2009-02-26T12:57:29+00:00
PHP: 5.2.1 OS: irrelevant Package Version: 

Description:
------------
      I'm not sure this is feasible but it would be really useful. I was thinking 
something along what's described here 
http://bluedynamics.com/articles/jens/interlude-write-python-doctests-
interactive . We would have have some kind of stopword, eg //interact
, that would signal the include of a file which would import the code that had 
been run up until that point into an interactive session. As soon as the user 
exited the session the doctest would continue its normal business. Do you 
think this is feasible in php?

Test script:
---------------
      

Expected result:
----------------
      

Actual result:
--------------</pre>]]></content:encoded>
      <description><![CDATA[<pre>Testing_DocTest Feature/Change Request
Reported by sofia
2009-02-26T12:57:29+00:00
PHP: 5.2.1 OS: irrelevant Package Version: 

Description:
------------
      I'm not sure this is feasible but it would be really useful. I was thinking 
something along what's described here 
http://bluedynamics.com/articles/jens/interlude-write-python-doctests-
interactive . We would have have some kind of stopword, eg //interact
, that would signal the include of a file which would import the code that had 
been run up until that point into an interactive session. As soon as the user 
exited the session the doctest would continue its normal business. Do you 
think this is feasible in php?

Test script:
---------------
      

Expected result:
----------------
      

Actual result:
--------------</pre>]]></description>
      <dc:date>2009-02-27T08:14:27+00:00</dc:date>
      <dc:creator>sofiacardita &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Testing_DocTest Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
