eclipse_test.php 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // $Id: eclipse_test.php 1739 2008-04-09 20:48:37Z edwardzyang $
  3. //To run this from the eclipse plugin...you need to make sure that the
  4. //SimpleTest path in the preferences is the same as the location of the
  5. //eclipse.php file below otherwise you end up with two "different" eclipse.php
  6. //files included and that does not work...
  7. include_once(dirname(__FILE__) . '/../eclipse.php');
  8. Mock::generate('SimpleSocket');
  9. class TestOfEclipse extends UnitTestCase {
  10. function testPass() {
  11. $listener = &new MockSimpleSocket();
  12. $fullpath = realpath(dirname(__FILE__).'/support/test1.php');
  13. $testpath = EclipseReporter::escapeVal($fullpath);
  14. $expected = "{status:\"pass\",message:\"pass1 at [$testpath line 4]\",group:\"$testpath\",case:\"test1\",method:\"test_pass\"}";
  15. //this should work...but it doesn't so the next line and the last line are the hacks
  16. //$listener->expectOnce('write',array($expected));
  17. $listener->setReturnValue('write',-1);
  18. $pathparts = pathinfo($fullpath);
  19. $filename = $pathparts['basename'];
  20. $test= &new TestSuite($filename);
  21. $test->addTestFile($fullpath);
  22. $test->run(new EclipseReporter($listener));
  23. $this->assertEqual($expected,$listener->output);
  24. }
  25. }
  26. ?>