title: Run a PHPUnit Selenium test case programatically ("within PHP")
body: <p>How can I run a test "within PHP" instead of using the 'phpunit' command? Example:</p>
  
  <pre><code>&lt;?php
  require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
  class MySeleniumTest extends PHPUnit_Extensions_SeleniumTestCase {
  
      protected function setUp() {
          $this-&gt;setBrowser("*firefox");
          $this-&gt;setBrowserUrl("http://example.com/");
      }
  
      public function testMyTestCase() {
          $this-&gt;open("/");
          $this-&gt;click("//a[@href='/contact/']");
      }
  
  }
  
  $test = new MySeleniumTest();
  //I want to run the test and get information about the results so I can store them in the database, send an email etc.
  ?&gt;
  </code></pre>
  
  <p>Or do I have to write the test to a file, invoke phpunit via system()/exec() and parse the output? :(</p>