File: eclipse_test.php

package info (click to toggle)
postfixadmin 2.3.5-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,200 kB
  • sloc: php: 25,767; xml: 14,485; perl: 964; sh: 664; python: 169; makefile: 84
file content (32 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
    // $Id: eclipse_test.php,v 1.2 2006/11/20 23:44:37 lastcraft Exp $

	//To run this from the eclipse plugin...you need to make sure that the 
	//SimpleTest path in the preferences is the same as the location of the 
	//eclipse.php file below otherwise you end up with two "different" eclipse.php 
	//files included and that does not work...

	include_once(dirname(__FILE__) . '/../eclipse.php');
	Mock::generate('SimpleSocket');
	
    class TestOfEclipse extends UnitTestCase {
		
        function testPass() {
			$listener = &new MockSimpleSocket();
			
			$fullpath = realpath(dirname(__FILE__).'/support/test1.php');
			$testpath = EclipseReporter::escapeVal($fullpath);
			$expected = "{status:\"pass\",message:\"pass1 at [$testpath line 4]\",group:\"$testpath\",case:\"test1\",method:\"test_pass\"}";
			//this should work...but it doesn't so the next line and the last line are the hacks
			//$listener->expectOnce('write',array($expected));
			$listener->setReturnValue('write',-1);
			
			$pathparts = pathinfo($fullpath);
			$filename = $pathparts['basename'];
			$test= &new TestSuite($filename);
			$test->addTestFile($fullpath);
			$test->run(new EclipseReporter(&$listener));
			$this->assertEqual($expected,$listener->output);
        }
    }
?>