title: Remote code coverage collecting in PHP
body: <p>In our project, we are running <a href="http://en.wikipedia.org/wiki/PHPUnit" rel="nofollow">PHPUnit</a> tests that uses <a href="http://en.wikipedia.org/wiki/Selenium_%28software%29" rel="nofollow">Selenium</a> and <a href="http://en.wikipedia.org/wiki/CURL" rel="nofollow">Curl</a> to open pages on a different development server. Server B has an Apache server running the serves the web site. Server A starts the test job by syncronizing (<a href="http://en.wikipedia.org/wiki/Rsync" rel="nofollow">Rsync</a>) the project files to development server B, so the project files is identical on both servers.</p>
  
  <p><strong>What possibilities are there for remotely collecting code coverage statistics in PHP?</strong></p>
  
  <p>We are already using <a href="http://en.wikipedia.org/wiki/Xdebug" rel="nofollow">Xdebug</a> to collect code coverage on unit tests that run locally on server A (PHPunit uses the project files directly and can therefore <a href="http://www.xdebug.org/docs/code_coverage" rel="nofollow">start/stop collecting code coverage report</a>)</p>
  
  <p><strong>Update:</strong></p>
  
  <p>On server B, the web site is rendered by a PHP instance run by Apache. When lunching the tests using Selenium/Curl the PHP instance on server A, the command line version is used. That instance can't profile the PHP instance that Apache runs on server B.</p>
  
  <p>When running unit tests (not using an other server and not using Selenium/Curl), we use a command like this:</p>
  
  <pre><code>phpunit --coverage-html ./results/codecoverage/ ATestFile.php
  </code></pre>
  
  <p>This generates a code coverage report for the test in "ATestFile.php" by using Xdebug in PHP Cli.</p>