|
From: Wermelinger R. <reg...@vo...> - 2010-02-12 14:13:21
|
Hi
Im trying to run a UnitTestCase inside Eclipse with the SimpleTest-Plugin.
I can execute my test when I open the context-menu of a php-file with testcode, there i select "run as" -> "php script".
The test execution works and i see the result in an unformatted view "debug output".
But i like to execute the Test with the Simpletest-Runconfig, to see the better formatted test-output in the "Result View".
This works also as long as i don't use any include or require statements inside the Testcase. But most of my testcases are depending on some libraries that i use. Now i can't include them or I run into errors. The PHP Output displays, that the files are not found in the given path, even if the files exist.
The strange thing is, that the includes work if i point to files which are in the same folder as the testfile. It also works if use full path to include the file. But no chance with realtive paths....
---------------------------------------------------------------------------
An excample: this could be my Testcase:
// Library Autoloader:
require_once('../lib/AutoLoader.php'); // doesn't work -> relative path!
AutoLoader::Register();
// Create ModX Instance:
include_once('modxEnvironment.php'); // works -> same folder!
// Snippet AutoLoader:
$snippetPath = $modx->getConfig('base_path').'assets/snippets/';
require_once($snippetPath . 'SnippetAutoLoader.php'); // works -> full qualified name!
SnippetAutoLoader::Register();
// Load Testframework:
$relativeSimpletestPath = '../simpletest/';
$loadFrameworkFiles = array('autorun.php', 'reporter.php', 'web_tester.php');
foreach($loadFrameworkFiles as $file){
require_once($relativeSimpletestPath.$file); // doesn't work -> relative path!
}
class TranslationMgmtSnippetTest extends UnitTestCase{
.........
}
---------------------------------------------------------------------------
The Error Output looks like this:
Running:
echo "<?php $path='D:\Projekte\webprojekte\vowa\scripts\simpletest';ini_set('include_path', get_include_path().PATH_SEPARATOR . realpath($path));ini_set('html_errors','0');$fullpath = realpath('D:/Projekte/webprojekte/modx.vowa.ch/externals/tests/LangfinderMgmtTest.php');$pathparts = pathinfo($fullpath);$filename = $pathparts['basename'];include_once('xml.php');include_once('unit_tester.php');include_once('mock_objects.php');include_once('test_case.php');include_once('invoker.php');$test=new GroupTest($filename);$test->addTestFile($fullpath);$test->run(new XmlReporter()); ?>" | "C:\Program Files (x86)\eclipsePdt\plugins\org.zend.php.debug.debugger.win32.x86_5.2.26.v20090817\resources\php53\php.exe" -q -c "C:\Program Files (x86)\eclipsePdt\plugins\org.zend.php.debug.debugger.win32.x86_5.2.26.v20090817\resources\php53\php.ini"
*************
Warning: require_once(../lib/AutoLoader.php): failed to open stream: No such file or directory in D:\Projekte\webprojekte\modx.vogelwarte.ch\externals\tests\testEnvironmentLoader.php on line 3
Fatal error: require_once(): Failed opening required '../lib/AutoLoader.php' (include_path='.;C:\php5\pear;D:\Projekte\webprojekte\www.vogelwarte.ch\scripts\simpletest') in D:\Projekte\webprojekte\modx.vogelwarte.ch\externals\tests\testEnvironmentLoader.php on line 3
Process returned: 255
---------------------------------------------------------------------------
My Config:
OS = Windows 7 pro (64 bit)
Eclipse = 3.5.1
SimpletestPlugin = 1.0.1 eclipse 0.2.5
How can i bring the SimpleTest-RunConfig to work?
|