|
From: Wermelinger R. <reg...@vo...> - 2010-02-17 09:28:45
|
Hi
Ok i didn't think about the option to modify the include-path. That makes my test-environment loading easier.
But actually I can't use the Simpletest Eclipse-Plugin anyway, because I have other Problems with the Plugin. The biggest problem is, that the plugin is only running, when I install it and restart Eclipse for the first time. As soon as i try to restart Eclipse again several errors appear when i wan't have a look into the SimpleTest configuration tab or a SimpleTest running config. I only can see an errorbox with the Message:
"Unable to create the selected preference page
An error occurred while automatically activation bundle net.sf.simpletest.clipse (551)"
The only way i found to use it again is to uninstall the Plugin. Delete simpletest files in the Eclipse programfolder (features, plugins) and then reinstall it. After that it works as far as i don't restart Eclipse again.
Very strange problem which I didn't have on my old workstation with Windows XP. I guess that the problem has something to do with Windows 7 (64bit) and it's UAC or the latest Eclipse version.
Actually I'm not motivated to try & try & try again just to work with a simple plugin. I'll test my code with the Eclipse -> Run PHP-Script option (...and the ugly unformatted output). May i try to work with the plugin again if a newer & more stable release is available.
Thanks anyway for your support.
Regards,
Reguel
-----Ursprüngliche Nachricht-----
Von: Steven Balthazor [mailto:ste...@gm...]
Gesendet: Montag, 15. Februar 2010 16:30
An: Wermelinger Reguel
Cc: Help, advice, bugs and workarounds
Betreff: Re: [Simpletest-support] PHP-Includes inside an Eclipse-SimpleTest
On Mon, Feb 15, 2010 at 1:39 AM, Wermelinger Reguel < reg...@vo...> wrote:
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
You can modify the include path to include the directories which have all of your includes. You can add these into the php.ini file. The SimpleTest Eclipse runner has the capability for you to specify which php.ini file you wish to use (see the Eclipse/Simpletest preferences). I typically use a different php.ini file for running tests and this allows me to specify that "special" php.ini file. You may just need to add your "lib" directory to the include path. The reason why SimpleTest fails is that it starts in a different directory so the include path resolves wrong (the include path typically includes ".") when running the test via SimpleTest.
Alternately you could set the include path at the top of your script [ http://php.net/manual/en/function.set-include-path.php] or you could include a standard test library script at the top of each test script which does this for you.
I have had the problem you specified, but I solved it using the method I previously described (dirname(__FILE__)). In my applications I always use this method to load libraries. I had problems (many years ago) when I relied on the files being magically found by the include path (which is why it works running it one way, but not another way) because inevitably I would need to deploy my application somewhere else and having to duplicate the include path environment exactly everywhere can become burdensome. Also by explicitly telling php where to find the file you save the server from having to traverse all of the paths in the include_path to try and find each file you specify. In your case it looks like you are just using this in one place to load an autoloader file so it probably does not cause much of a performance hit. My reasons may or may not be best practices but they work for me -- YMMV.
Regards,
Steven Balthazor
|