Source for file eclipse.php
Documentation is available at eclipse.php
* base include file for eclipse plugin
* @version $Id: eclipse.php 1723 2008-04-08 00:34:10Z lastcraft $
* simpletest include files
include_once 'unit_tester.php';
include_once 'test_case.php';
include_once 'invoker.php';
include_once 'socket.php';
include_once 'mock_objects.php';
* base reported class for eclipse plugin
* Reporter to be run inside of Eclipse interface.
* @param object $listener Eclipse listener (?).
* @param boolean $cc Whether to include test coverage.
$this->_listener =
&$listener;
* Means to display human readable object comparisons.
* @return SimpleDumper Visual comparer.
* Localhost connection from Eclipse.
* @param integer $port Port to connect to Eclipse.
* @param string $host Normally localhost.
* @return SimpleSocket Connection to Eclipse.
* Wraps the test in an output buffer.
* @param SimpleInvoker $invoker Current test runner.
* @return EclipseInvoker Decorator with output buffering.
* @param string $raw String with backslashes, quotes and whitespace.
* @return string Replaced with C backslashed tokens.
$needle =
array("\\","\"","/","\b","\f","\n","\r","\t");
$replace =
array('\\\\','\"','\/','\b','\f','\n','\r','\t');
* Stash the first passing item. Clicking the test
* item goes to first pass.
* @param string $message Test message, but we only wnat the first.
$this->_message =
$this->escapeVal($message);
* Stash the first failing item. Clicking the test
* item goes to first fail.
* @param string $message Test message, but we only wnat the first.
//only get the first failure or error
if (! $this->_fail &&
! $this->_error){
$this->_message =
$this->escapeVal($message);
$this->_listener->write('{status:"fail",message:"'.
$this->_message.
'",group:"'.
$this->_group.
'",case:"'.
$this->_case.
'",method:"'.
$this->_method.
'"}');
* Stash the first error. Clicking the test
* item goes to first error.
* @param string $message Test message, but we only wnat the first.
if (! $this->_fail &&
! $this->_error){
$this->_message =
$this->escapeVal($message);
$this->_listener->write('{status:"error",message:"'.
$this->_message.
'",group:"'.
$this->_group.
'",case:"'.
$this->_case.
'",method:"'.
$this->_method.
'"}');
* Stash the first exception. Clicking the test
* item goes to first message.
* @param string $message Test message, but we only wnat the first.
if (! $this->_fail &&
! $this->_error){
$message =
'Unexpected exception of type[' .
get_class($exception) .
'] with message [' .
$exception->getMessage() .
'] in [' .
$exception->getFile() .
' line '.
$exception->getLine() .
']';
$this->_message =
$this->escapeVal($message);
'{status:"error",message:"' .
$this->_message .
'",group:"' .
$this->_group .
'",case:"' .
$this->_case .
'",method:"' .
$this->_method
* We don't display any special header.
* @param string $test_name First test top level
* We don't display any special footer.
* @param string $test_name The top level test.
* Paints nothing at the start of a test method, but stash
* the method name for later.
* @param string $test_name Name of test that is starting.
* Only send one message if the test passes, after that
* @param string $test_name Name of test that is ending.
if ($this->_fail ||
$this->_error ||
! $this->_pass){
'{status:"pass",message:"' .
$this->_message .
'",group:"' .
$this->_group .
'",case:"' .
$this->_case .
'",method:"' .
* Stashes the test case name for the later failure message.
* @param string $test_name Name of test or other label.
* @param string $test_name Name of test or other label.
* Stashes the name of the test suite. Starts test coverage
* @param string $group Name of test or other label.
* @param integer $size Number of test cases starting.
xdebug_start_code_coverage(XDEBUG_CC_UNUSED |
XDEBUG_CC_DEAD_CODE);
* Paints coverage report if enabled.
* @param string $group Name of test or other label.
$arrfiles =
xdebug_get_code_coverage();
xdebug_stop_code_coverage();
$thisdirlen =
strlen($thisdir);
foreach ($arrfiles as $index=>
$file){
if (substr($index, 0, $thisdirlen)===
$thisdir){
foreach ($file as $line){
$cc .=
round(($ccnt/
$lcnt) *
100, 2) .
'%';
$cc.=
"\t".
$index .
"\n";
$this->_listener->write('{status:"coverage",message:"' .
* Invoker decorator for Eclipse. Captures output until
$this->_listener =
&$listener;
* Starts output buffering.
* @param string $method Test method to call.
* Stops output buffering and send the captured output
* @param string $method Test method to call.
function after($method) {
$result =
$this->_listener->write('{status:"info",message:"' .
Documentation generated on Sun, 04 May 2008 09:21:29 -0500 by phpDocumentor 1.3.0