Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » PHPUnit + Eclipse Configuration
PHPUnit + Eclipse Configuration [message #555068] Wed, 25 August 2010 11:39 Go to next message
No real name is currently offline No real name
Messages: 2
Registered: August 2010
Junior Member
Hey!

I am using Eclipse to develop / modify files on a webserver in the local intranet (Webserver is Windows, my OS is Windows too). The Webserver is called tcweb (\\tcweb) and the htdocs folder is mapped to a network drive (W:\)

This all works perfectly fine, but now I want to start testing my files, but since I am not developing on my local machine, I came across some problems while testing / configuration.

First of all, I didn't figure out how to configure PHPUnit as External Tool because of all this different machines and pathes... I installed PHP Unit (with Pear and without) on my local machine, on the webserver, in my files directory, ... anyway I never got it to run Sad

So i found out about this PTI plug in and I installed PHP Unit this way: http://www.phphatesme.com/blog/tools/phpunit-mittels-pti-in- eclipse-einbinden/

With this way, simple tests works out, but if I am trying to include something (e.g. some classes,...) it always points the working directory to an eclipse subfolder (eclipse/plugins/...) and so all tests fail because the dependencies between the files do not work (if i use eclipse on the server) or I even can't include the file (because it is on the server and eclipse is on my local machine) altough the test folder with the test files i am executing is in the same file structure.

Is there any way to configure PHP Unit (maybe as an external tool?) so that I can test files on the webserver?

Thanks in Advance
Re: PHPUnit + Eclipse Configuration [message #555076 is a reply to message #555068] Wed, 25 August 2010 11:45 Go to previous messageGo to next message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2010-08-25 13:39, h_lwcf@gmx.net wrote:
> Is there any way to configure PHP Unit (maybe as an external tool?) so that I
> can test files on the webserver?

Setup some remote access like SSH, make keys to connect without need of password
and then execute test. Like You said - this can be done using external tools
configuration.
I'm building project with windows+cygwin and linux+ssh on the webserver side.
Everything works well. You will have output in console window.

dmc
Re: PHPUnit + Eclipse Configuration [message #555079 is a reply to message #555076] Wed, 25 August 2010 11:58 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 2
Registered: August 2010
Junior Member
Hey!

Thanks for the fast reply!

I am not sure how to do this exactly, can you post some configuration options / steps?
Does it only work with SSH connection? Or is there a way without them? (Since they are not available on a windows server by default Wink)


Thanks!

[Updated on: Wed, 25 August 2010 12:00]

Report message to a moderator

Re: PHPUnit + Eclipse Configuration [message #555392 is a reply to message #555079] Thu, 26 August 2010 13:28 Go to previous message
dominik is currently offline dominik
Messages: 122
Registered: July 2009
Senior Member
On 2010-08-25 13:58, h_lwcf@gmx.net wrote:
> Hey!
> Thanks for the fast reply!
> I am not sure how to do this exactly, can you post some configuration options /
> steps?

I don't know if SSH is suitable for Your configuration. I know that there are
some ports for windows but I don't know if there are any issues with this on
such platform. Maybe there is other type of remote access connection. Basically
All You need is just to execute command and take output from it so You can do
that using any protocol (including http etc.).

I'm using for this purpose SSH, basically because I wanted to have everything as
it can be done manually. If You are using console to perform test on webserver I
think it's what You are looking for.

If You will decide to use SSH I assume You have working SSH server and client on
You computer. Client have to be plain text (not graphic like putty) so You can
catch its output. I'm using for this purpose Cygwin.
Then You need to setup connection between client and server that will work
without any interaction, usually SSH require password but You can authorize with
public/private key. Google for this and You will find tons of tutorials. The
trick is that You need to setup this without *any* password. Usually You need to
use key agent and type there password for generated certificate and it will be
hard to merge sessions (password is valid only for session and You will start
new one each time) so it's not what we expect - still there is a need for
password. The trick is that You can generate certificate without password and
that one will not require whole key agent.

When You will have working ssh connection You can execute in command prompt:
> ssh user@server command

-> this should execute the command on server. So You are almost ready. Now You
can create script like You want and just invoke it as external tool. That's all.
The last note is that command is not executed in regular environment so
sometimes You will need to execute "source /etc/profile; command" to have right
encoding and system variables. It's good practice just to create test script and
keep all commands there.

The only issue I have using such path is that eclipse understands only "exit
code" and not any other code for colors. You need to turn off all ansi color
codes (this is easily done) or strip output using following command:
sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
-> this will give just plain text. Maybe I'm missing something and I hope some
day I eclipse will support ansi codes in console.

dmc
Previous Topic:problem with PDT + XDebug
Next Topic:Internal error on startup
Goto Forum:
  


Current Time: Wed Sep 17 21:46:35 GMT 2014

Powered by FUDForum. Page generated in 0.01594 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software