Is there any integration of PHPUnit with Eclipse PDT?
If not, are there any plans to do so?
See Eclipse Plugin PHP Tool Integration (PTI) which provides integration of following features for Eclipse:
PHP_CodeSniffer
PHPUnit
PHP Depend
PHP Copy/Paste Detector
Update sites (Help - Install Software - Add ...):
Latest stable release: http://www.phpsrc.org/eclipse/pti/
Development version: http://www.phpsrc.org/eclipse/pti-dev/
We've developed an Eclipse plugin called MakeGood that integrates PHPUnit and more testing frameworks with Eclipse PDT.
MakeGood is a continuous test runner to run unit tests on Eclipse PDT.
MakeGood provides fast feedback by automated workflows for running tests, tracking failures and errors and fatal errors. This will help developers to do Test Driven Development (TDD) and Continuous Testing.
For more information, visit our website at: https://github.com/piece/makegood/wiki
It is possible to integrate PHPUnit with PDT in a simple way (these settings aren't fully generic but should be a good starting point).
Select the Run > External Tools >
External tools configurations
Create a new program
Set the Location to point to your
executable (/usr/bin/phpunit on
linux)
Set the Working Directory to use the
variable ${workspace_loc}
Set the Arguments to
${resource_path}
Now select Run > External Tools > PHPUnit to execute the selected test file. This simply executes phpunit and sends STDOUT to the Eclipse terminal. Simple but effective.
Subsequently, you can use the icon with a green arrow and red toolbox to run PHPUnit without having to navigate the menus.
Sebastian Bergmann did approach pdt back in 2006... but with no obvious result.
And his latest entries on his blog only mention PHPEdit 2.12 and Zend Studio.
The only testing framework officially documented on the PDT side is the "PDT Testing Framework", and it does not seem actively maintained...
So, no. There does not seem to be any plan to actively integrate PHPUnit in PDT anytime soon.
(disclaimer: I am absolutely not the developer of the project I'm speaking about here; only a user ^^ (And as I don't know JAVA, it would be quite hard for me to help by contributing code... So this is my way of helping :-) ) )
There is currently work in progress on that side : a few weeks ago (maybe no more than two weeks), the first of a project of integrating phpunit in Eclipse has been released:
http://code.google.com/p/phpunit4eclipse/
What it does:
allows to launch phpunit tests from eclipse
and get some "visual clue" of what is going on
which is, in some way, better / more user-friendly than the approach proposed by Sebastian on phpunit's wiki.
For some kind of screenshot, see http://code.google.com/p/phpunit4eclipse/wiki/j2phpUnitWrapper
Unfortunately, it is not (yet?) developed as an Eclipse plugin:
it is a separate JAVA project, that launches phpunit
or something like that, as far as I can tell...
which means :
not as well integrated in Eclipse as it could
most important thing is when you double-click on a test class/method, it doesn't get you to that class/method (because the tests' result are shown by the JAVA project, and the test class/method is in another, PHP, project)
it is still quite hard to install :
I have not successfully managed to install it in Eclipse PDT
I have had to install "Eclipse IDE for Java Developers", and, then, install the PDT plugin in this one (which works fine, but is not "easy")
Anyway, this is work in progress, the project is still quite young, and it's only a first step...
A google group has been created for that project a few time ago: http://groups.google.com/group/phpunit4eclipse-user/
It is currently empty, but I'm sure it would help if some people joined in, gave their thoughts, and why not, helped!
There is defnitely integration for Eclipse PDT and PHPUnit. both PHPSRC and MakeGood
work well though I am a fan of MakeGood for phpunit phpsrc comes with other goodies like CodeSniffer. I have branched a PHPUnit CodeSniffer Standard on github that validates the quality of phpunit tests which I can run with the Eclipse PHP Tools CodeSniffer plugin. This has updates for new phpunit package like setUp and tearDown.
makes sure there is assertions in tests. Something devs like to leave out when trying to meet code coverage metrics
Makes sure there is no more than 1 assertion per test. A best practice
Setting up PDT in Eclipse is not straightforward.
There's a lot of tiny details involved
Here's the high level steps.
1 Windows update
2 Install JRE a. http://www.java.com/en/download/index.jsp
3 Create a folder C:\eclipse\workspace
4 Install eclipse pdt
a. http://www.zend.com/en/downloads/thankyou?package=573
5 Install xampp –win32-1.81-vc9
a. http://sourceforge.net/projects/xampp/files/XAMPP%20Windows/1.8.1/xampp-win32-1.8.1-VC9-installer.exe/download
6 Install pear phpunit
pear clear-cache
pear upgrade pear
pear update-channels
pear upgrade --alldeps -f
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no
pear install --alldeps phpunit/PHPUnit
7 Install Xdebug plugin
a. http://xdebug.org/files/php_xdebug-2.2.1-5.4-vc9.dll
b. Phpinfo settings for xdebug
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug-2.2.1-5.4-vc9.dll"
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_mode="req"
xdebug.remote_port=9000
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log="C:\xampp\php\logs"
8 Install MakeGood
a. http://eclipse.piece-framework.com/
It took me nearly 3 days to finally get everything right so I put together a video tutorial
Good luck!
There is a plugin on the Eclipse Marketpalce now called PTI PHP Tool Integration.
http://www.phpsrc.org/
I also run PHPUnit as an external tool like DavidWinterbottom proposed.
One thing I also add depending on the type of project is going into Build Options tab and selecting first options after : "run the builder :". This triggers the unit tests to be run every time you save a file. This is great to get a really quick red-green-refactor feedback loop.
I have posted the entire steps with screenshots here : http://nicholaslemay.blogspot.com/2010/02/using-eclipse-phpunit-as-automatic.html
Using phpunit from Ant also is possible, and Ant is natively supported by Eclipse. Simple have a new <exec executable="phpunit"> in a target and voilà, you can use phpunit in eclipse, through ant.
Following #DavidWinterbottom response (Eclipse Indigo):
Select the Run -> External Tools -> External tools configurations
Create a new program
Set the Location to point to your executable (/usr/bin/phpunit on Linux, or path to phpunit.bat on Windows)
Set the Arguments to absolute path to your phpunit folder (C:\phpproject\testunit)
I couldn't make get it to using ${project_loc} or ${project_path}.
For all using composer on unix like machine (eclipse and xdebug installed):
cd <project-root>
ln -s vendor/bin/phpunit phpunit.php
Open eclipse, open run/debug configuration, create a new debug configuration, and select phpunit.php as file to debug. Continue the rest of the setup as usual, set breakpoints, that's it.
You have and integration of PHPUnit on top of PDT in Zend Studio. There is a CE edition too.
I tried PHP Unit in Eclipse and was not happy with the configuration issues. I switched to NetBeans PHP IDE.
I recommend NetBeans PHP IDE for PHP Unit testing.
http://www.netbeans.org/kb/docs/php/phpunit.html
Related
I'm sorry for a pretty vague title, didn't want to turn it into a paragraph.
So, I am using Eclipse Platform 3.7.1 (the one with absolutely no plugin preinstalled), the latest version so far, and I have discovered that by taking advantage of its -configuration option, I can choose which plugins are running and which are not. It was going well enough until I started installing the plugins.
But allow me to explain my setup first, I am using Ubuntu linux by the way. Using only one eclipse installation, my installation is arranged in the following order:
Installation:
~/bin/opt/eclipse
eclipse (executable binary)
~/bin/eclipse -> opt/eclipse/eclipse
Configurations:
~/.eclipse/configuration
web-php
android
java
Installing JDT and ADT while running eclipse and using the android configuration directory posed no problems. So I moved on to the php configuration and tried to install PDT (the JDT and ADT plugins were not activated here, so far so good). The problems came along after the installation, not only was I not able to use PDT, I noticed in the Installation Details that JDT, ADT, PDT were installed but not activated. Instead, they were all activated in the android configuration. To make it worse, when I chose the Java configuration, I could not even use JDT.
My expectations however were when using:
eclipse -configuration ~/.eclipse/configuration/android
was that only the JDT and ADT were activated and when using:
eclipse -configuration ~/.eclipse/configuration/web-php
only the PDT is activated
Regarding the java configuration however, it's probably another problem altogether but if there was help on how to activate a plugin installed from another configuration, I'd deeply appreciate it.
Also, see Single Eclipse install with multiple Configurations and Workspaces
In a p2 world there are extra steps to isolate bundles from each other. You need not just a different configuration directory, but a different p2 profile.
Have a look at the config.ihi in each of your configurations. There are two ways that Eclipse identifies the plugins to use, the ..updateconfigurator, which simply uses all of the plugins in the plugins folder, and the ..simpleconfigurator which uses the bundles.info file in that's in the org.eclipse.equinox.simpleconfigurator folder (which is maintained by the p2 installer). Make sure this file is what you expect.
And also, you might want to start with the -clean option if you are using the updateconfigurator to have it rescan all of the plugins (otherwise it remembers in some hidden cache).
Make sure when you installed everything that you had your -configuration set to the right place for the different things you installed.
I hope some of this points you in the right direction.
Bootstrapping Eclipse on new machines is such a time consuming process, you wind up asking yourself whether you really need each plugin. But there all handy, and help develop consistent habits.
Eclipse bootstrapping problems include:
Explaining / documenting what needs to happen
The actual time pasting in the right URLs and downloading
Version compatibility and dependencies
Eclipse likes to restart after each one
The changeover to the Eclipse Marketplace means that some plugins and instructions you find on the web tend to be inconsistent, depending on when they were written.
The Licenses... over and over and over... yes, yes, yes... I understand that the person installing needs to be aware of it, and have a chance to review them, but there's got to be a better way.
It'd be nice to have "patch file" (either binary or meta) that spells out what I want to add on top of stock Eclipse installation. I'd really like to find (or create) a 1 or 2 step process that sets up Eclipse, plus a favorite batch of plugins:
subclipse
m2eclipse
jetty support like runjettyrun
android sdk and plugin (or at least just the plugin)
aspectj
Web Objects / WOLiops
python, other langs
JVM Monitor, maybe EclEmma
probably a git plugin pretty soon.
Does command line maven help with any of this? It seems like its repository management would fit at least part of the functionality.
On a machine with an Eclipse installation matching your needs use File -> Export -> Install -> Installed software items to file. Import the generated file using the same menu on all other machines.
As Scott says, a good approach is to simply package a fully prepared Eclipse installation once all the plugins you need are installed. The downside is that you have to update most plugins afterwards.
Another option is to use Yoxos. With it, you can create a profile and configure it with all the plugins you need (and apparently Yoxos can do more than that).
Finally, this page might interest you concerning the configuration side of things.
Solution 1 is too search for more advanced Eclipse distributions.
For example, STS (Spring Tool Suite) comes with
AspectJ
EGit
m2e
(and of course) Spring IDE
One small trick can be done with m2e-android - Android Configurator for M2E Maven Integration. If installing it on clean Eclipse, it will also automatically resolve to install :
m2e
Android Developer Tools (ADT)
I decided to take a look at Clojure and thought the best and easiest method for me would be to use Netbeans with the Enclojure plugin as I didn't want to have to learn Emacs at the same time. I installed Netbeans 6.9.1 together with the latest JDK using the bundled install (on Windows 7). All went smoothly. I then followed the instructions at http://www.enclojure.org/gettingstarted for installing the enclojure plugin.
When creating a new Clojure application I get the following and see no project files :
java.io.IOException: Could not connect to URL nbresloc:/org/enclojure/ide/templates/project/ClojureProjectTemplate-1.1-distribution.zip. No such resource was found.
Maven is working using mvn --version
I have installed on both Windows 7 and Ubuntu 10.04 (same result).
I have looked on the Enclojure forum and there is a recent open thread for this issue, but it is not solved by anybody presently.
I have Java SE enabled in Netbeans
I have tried enabling the different platform versions of Clojure, 1.0.0, 1.1.0, etc..
The REPL seems to be working happily in Netbeans : (printf "hello") hellonill
I did try ClojureBox on Windows 7, but again that's Emacs, but emacs failed to start the server and hung there and became totally unresponsive.
I come from a .Net background (not Java) so my knowledge of the Java environment is somewhat lacking. My reason for looking at Clojure and not Java.
I am new to Netbeans
If you're interested in a working Maven pom, here is one I've used with Enclojure successfully:
http://puredanger.com/techfiles/100624/pom.xml
There are some project settings you'll need to change and a few dependencies to remove but it might be a good start. In general, I usually create the pom first and then just import the project into NetBeans rather than using the NetBeans options to create projects.
By the way, the REPL work in Enclojure has been split and is coming soon to the Eclipse plugin Counterclockwise.
I had written a small post on it on my blog.
Anyways here is the procedure:
On searching realized that this is a common problem for installing it on > Netbeans 7.. But with some manual tweeks managed to install it. Here are the instructions to install on Netbeans 7. plus:
Install Netbeans 7. You need only the Java SE version.
First Run of Netbeans after installation. Activate feature Java SE
Activate features is on the Start page or from Tools,->Plugins>Installed, click ‘Activate next to the Java SE support
Install Maven: It is HIGHLY recommended that you install maven: http://maven.apache.org/download.html
Go to the Netbeans->Preferences, click on the Miscellaneous tab and make sure the External Maven Home path is pointed to your maven install
Download the EnClojure 1.5 version from here. If you want to manually build, you can do that by following the instructions from here.
After downloading the file, In Netbeans: Goto:- Tools ->Plugins->Downloaded->Add Plugins->Downloaded
Then browse to the downloaded file. Later install by clicking at the “install : button.
Restart and you are on the go.
Visit here to build and run hello world project.Basically building the EnClojure 1.5 manually is the tough job. I hope above was useful.
I'm trying to install the WTP (web platform tools) to my Eclipse installation so I can get the XSL transformations working. The base Eclipse they installed for me here was the plain Java IDE (the splash screen says "Ganymede" if that means anything). Looking at this site, the URL to get the download should be here: http://download.eclipse.org/webtools/updates/ ...But when I give that URL to the Eclipse update manager, I get an error telling me: "No repository found at http://download.eclipse.org/webtools/updates/"
Anyone else had this problem? Anyone know what might be up? Anyone know how to get the xsl-transform plugin installed?
EDIT:
I should have mentioned before that I want to find a way to do this without installing any new instances of Eclipse. This process will eventually be sent to several other developers who already have Eclipse (same version that I'm testing with) and I'd rather just do an in-place upgrade rather than have everyone go and install a new product.
UPDATE:
I found another plugin, Xcarecrows 4 XML which can also do XSL transforms. The interface is ugly and seems more than a little quirky, but it's also a small download, and at least it runs and transforms. Unless I can find an easy way to get WTP working, I'll probably just stick with this.
You can try and install WTP through the main Ganymede update site:
http://download.eclipse.org/releases/ganymede/
Or you can download the latest Java EE bundle and use that instead of your current Eclipse
(do NOT unpack it on top of your current Eclipse, but unpack it elsewhere, to test that second installation: it will come with WTP inside)
Note: check then "How do I start Eclipse" to point to your existing workspace in order to see all your previous project in your new Eclipse installation.
As mentioned in your link, XSL Tools is now part of WTP (for Eclipse 3.5 Galileo), and that may explain why your Eclipse Ganymede (3.4) might not interpret correctly the P2 update site for WTP (P2 being the new Eclipse provisioning mechanism introduced late in the 3.4 release cycle)
For Eclipse 3.5, you have an XSL Tools installation illustrated here:
But Eclipse3.4 is more likely to be compatible with XSLT0.5 and you will need a separate installation, because "XSL Tools" wasn't yet part of WTP.
I am not sure, however, where to find such an installation package within the Eclipse projects.
Use the following update site :
For Juno :
http://download.eclipse.org/webtools/repository/juno/
For Indigo :
http://download.eclipse.org/webtools/repository/indigo/
I'm assuming you don't have any firewall exceptions for Eclipse right?
The site for the WTP update is indeed the one you've listed. Maybe post a screenshot? You've added it specifically to your remote update site list?
Either way try a manual update which should be more reliable and get you up and running for now.
All-In-One Update (Eclipse IDE included):
Go to the Eclipse Download site.
Grab the all-in-one package: Eclipse IDE for Java EE Developers
Install, have a coffee and enjoy. (WTP is included)
Manual Update your existing installation of Eclipse:
Download the applicable WTP source package to your desktop
Shutdown Eclipse
Extract the package to your Eclipse installation directory
Startup Eclipse. (WTP is now available)
Follow the steps in the FAQ at http://wiki.eclipse.org/WTP_FAQ#How_do_I_install_WTP.3F .
Are you behind a proxy? If so, you need to make sure you configure your proxy settings in Eclipse.
Window > Preferences
General > Network Connections
Ok, I can probably get it working if I do a clean install of Eclipse. I can do that on my machine, but not the other team members' machines (at least not without going through many emails and paper work) so I'm going to say that XCarecrows 4 XML is the solution. It is able to do XSL transformations in Eclipse 3.4 and doesn't require anything else to be installed. Since XSLT is all I need, the plugin will do.
you can use the marketplace:
https://marketplace.eclipse.org/content/eclipse-java-ee-developer-tools-0
like the site says:
Drag to Install!Drag to your running Eclipse Workspace.
I have already installed Eclipse for Java development. I'd also like to install Plugins for PHP, CSS/HTML and Javascript, but all the sites that I've checked only offer a 'All in one' package, so I could either download an all-in-one Java package or an all-in-one PHP package, but not both at the same time.
How do I set up my existing installation to also support PHP files?
I use PHPEclipse which can be installed as a regular Eclipse software update
The PDT can also be installed as an update.
For HTML/CSS etc, the WTP can be installed in a similar fashion.
If you already have Eclipse installed, follow the instructions at PDT Installation to install the PDT (PHP Development Tools). This will include the Web Tools Project (WTP), which brings editors and tools for HTML and CSS.
This issue made me nuts 2. First i downloaded the PDT eclipse, which would not take google plugins or apache ant. Then I downloaded the Eclipse SDK to use java ant GWT and could not load php onto it.
If you ask me, this program sucks. I like the idea, however the updates hardly ever work, and it does not support multiple coding languages like it says it does. Also the web site is shocking as it gives you 100 options to download.
Coulnt the have just made the one platform and then provided links to the plugins ???
Correct me if i am wrong guys, but trying to get PHP and Java working in eclipse is torture. Ive been stuck for 3 days now, installing and uinstalling.
One final rant, the download speeds of the eclipse servers are below 10kb, and take about half a day to install one update.
My prob is, I have to use it as the project i am working was archived with Eclipse.
Did you follow the steps presented on this installation page? There is a From update site section in which they describe how to install it from the Software Updates menu.
I had this problem recently.
I started with the J2EE Ganymede setup and added the PDT tools (via Update) afterwards.
Then I added Subclipse afterwards.
G.
(I wish they wouldn't change the eclipse pages all the time...)
Look for "runtime" on the downloads page for PDT (http://www.eclipse.org/pdt/downloads/)
Why do you want JDT and PDT in one installation? I usually set up different installations for different things. It just so easy, since you don't really need to install anything. I have two setups for PDT and at least 5 for JDT.
Install Aptana Studio plugin. In my experience it is much better then either PHPEclipse or PDT. However, YMMV.