source: trunk/server/www/vendors/simpletest/test/eclipse_test.php @ 6

Last change on this file since 6 was 6, checked in by sander, 12 years ago

Added SimpleTest? test framework

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