|
From: Wermelinger R. <reg...@vo...> - 2010-02-15 08:40:40
|
Hello
Thanks four your response.
The explicit using of the full directory name didn't get the Test to work. I tried the following codes:
----------------------------------------------------------------------
require_once(dirname(__FILE__).'..\lib\AutoLoader.php'); // --> fails
require_once(dirname(__FILE__).'\..\lib\AutoLoader.php'); // --> works
require_once('..\lib\AutoLoader.php'); // --> fails
require_once('\..\lib\AutoLoader.php'); // --> works
----------------------------------------------------------------------
I assume that the includes/require call inside a SimpleTest only works if the path starts with a leading directory seperator. However this doesn't really help. This way I can include the files which I'am including explicit. But the included files have other dependencies and make further includes. And that framework which im loading makes it's includes also without the leading directory-seperator.
Though i can go now and search/replace all the includes inside this framework, that's the worst case for me. As the execution as a PHP-script works it must be an issue of SimpleTest. And for me it's not good practice to adjust working code, just to let it pass it's test.
Isn't there an easier way to bring this SimpleTest to work? Has nobody else the same problems with the simpleTest run-configuration?
Best regards,
Reguel
-----Ursprüngliche Nachricht-----
Von: Steven Balthazor [mailto:ste...@gm...]
Gesendet: Freitag, 12. Februar 2010 15:20
An: Help, advice,bugs and workarounds
Betreff: Re: [Simpletest-support] PHP-Includes inside an
Eclipse-SimpleTest
On Fri, Feb 12, 2010 at 6:01 AM, Wermelinger Reguel <
reg...@vo...> wrote:
> 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();
>
> Hello,
This fix is simple, you need to give the require/include paths to the
library relative to file which has the require_once inside of it.
The method I use is (something like):
require_once(dirname(__FILE__).'/../../somedir/someotherdir/lib/AutoLoader.php');
The dirname(__FILE__) gives the directory of the file the php processor is
currently processing.
Hope this helps.
Regards,
Steven Balthzor
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Simpletest-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simpletest-support
|