title: PHPUnit for command line integration tests
body: <p>Recently, I've started to working on Email2SMS feature in our product. When I joined the project this component had zero code coverage by unit-tests. Legacy code.</p>
  
  <p>Since I started to working on it, I was using test-first approach. But code quality was very low. It was very hard to split it and tests small chunks by unit-tests, so I decided to write integration test.</p>
  
  <p>There is php script, which accepts some message info, search for user in DB and save some info if everything is OK.</p>
  
  <pre><code>$last_line = system('php emailtosms.php -file=unicode_message.txt ', $retval);
  
  $this-&gt;assertStringExistsInLogFile('Email to SMS message was not sent');
  </code></pre>
  
  <p>Is it bad or not? How would you solve this problem?</p>