<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 24 May 2013 19:11:07 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Kurt Payne's Blog: How to Unit Test pcntl_fork()]]></title>
      <guid>http://www.phpdeveloper.org/news/17421</guid>
      <link>http://www.phpdeveloper.org/news/17421</link>
      <description><![CDATA[<p>
<i>Kurt Payne</i> has a new post to his blog showing how you can <a href="http://kpayne.me/2012/01/17/how-to-unit-test-fork/">unit test your process forking</a> in your PHP application (<a href="http://php.net/pcntl">pcntl</a>).
</p>
<blockquote>
At some point, many php developers turn to the pcntl functions in php to write a daemon, or server, or simulate threading. But how do you unit test this with complete code coverage? [...] We need to engage some black arts php extensions to make this happen.  An installation guide follows, and the post ends with a complete listing of the unit test.
</blockquote>
<p>
He uses the <a href="https://github.com/sebastianbergmann/php-test-helpers">test_helpers</a> extension (as provided by <i>Sebastian Bergmann</i>) and <a href="https://github.com/zenovich/runkit/">Runkit</a> to allow the test to define new methods copying the current pcntl methods and mocks up the responses. Tests are included to check the parent of a process, checking the children of a process and testing that a fork could be made. Hes's even included <a href="http://kurtpayne.files.wordpress.com/2012/01/forktest_code_coverage.png?w=614&h=464">visual proof</a> of this working.
</p>]]></description>
      <pubDate>Thu, 19 Jan 2012 13:40:20 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Forking PHP!]]></title>
      <guid>http://www.phpdeveloper.org/news/12936</guid>
      <link>http://www.phpdeveloper.org/news/12936</link>
      <description><![CDATA[<p>
In <a href="http://brian.moonspot.net/php-fork">a new post</a> from <i>Brian Moon</i> looking at how they're (DealNews) using <a href="http://us.php.net/pcntl">forking</a> in PHP applications to handle some of their <a href="http://gearman.org/">Gearman</a> processing</a>.
</p>
<blockquote>
While at the OReilly Open Source Convention in 2009, we were asked about how we pulled this off. So, we are releasing the two scripts that handle the forking and some instructions on how we use them. [...] These are the scripts we use to manage long running processes.  They work great for us on Linux.  They will not run on Windows at all.  We also never had any trouble running them on Mac OS X. 
</blockquote>
<p>
The two scripts (that you can grab <a href="http://dealnews.com/developers/">on their developer site</a>) show two methods for running child processes and how to pass off requests to each one to be handled in turn.
</p>]]></description>
      <pubDate>Fri, 24 Jul 2009 09:25:18 -0500</pubDate>
    </item>
  </channel>
</rss>
