|
From: Steven B. <ste...@gm...> - 2009-09-08 15:40:46
|
On Mon, Sep 7, 2009 at 11:53 PM, Richard Archer<rh...@ju...> wrote:
> Greetings,
>
> I'm trying to install simpletest_1.0.1.eclipse_0.2.5 into Eclipse.
>
> My Eclipse installation details window says in summary:
>
> Eclipse IDE for PHP Developers 1.2.0.20090618-0925
> Eclipse Platform 3.5.0.I20090611-1540
> Eclipse Platform 3.5.0.v20090611a
> PHP Development Tools (PDT) 2.1.0.v20090611-0930
> Simpletest plug-in 0.2.5
>
> Is the plugin just not compatible with this version of Eclipse?
> Or have I missed something?
>
> ...Richard.
Hello,
I just tried installing the Simpletest plugin into Eclipse 3.5 and
something is not right (if you go to the Simpletest preference page it
fails to load -- or at least in my current configuration -- I suspect
there is some missing dependency not being loaded or missing)
All that being said, there is a much simpler (and more productive --
because it allows you to debug) way to run Simpletest in Eclipse.
I wrote the plugin and have maintained compatibility with Eclipse
through many iterations; however I think the plugin has outlived it
usefulness (or rather the toolset can now more easily provide the
functionality).
To easily run Simpletest in Eclipse:
Download the latest tgz from the website (1.0.1) and extract somewhere
In Eclipse create a new project:
File -> New -> Project...
Expand "General" and select "Project"
enter a name for the project ("Test"?) and press "Finish"
Right click on the project created and select "New File"
enter a file name ("simple_test.php"?)
copy the folder ("simpletest") you extracted above into the project you created
The project tree should look like:
Test
+ simpletest
simple_test.php
If you expand the simpletest folder you should have three folders
underneath it (docs, extensions, test - the folders are not important,
I mention them to make sure that you have not unnecessarily included
too many folders above the simpletest folder) and all the simpletest
php files.
now you need to setup php in Eclipse:
Window -> Preferences
Expand "PHP"
Select "PHP Executables"
Add a valid PHP executable [I won't go into details here because it varies]
Press the "OK" button to close the preferences window
Create a basic test:
Open the "simple_test.php" file we created earlier in a text editor
<?php
require_once dirname(__FILE__).'/simpletest/autorun.php';
class simple_test extends UnitTestCase{
function testFirst(){
$this->assertEqual("a","b","This should generate an error");
}
function testSecond(){
$this->assertEqual("a","a","This should pass");
}
}
?>
Save the file and then right click and select "Run As" -> "PHP Script"
If you look at a "Console" view [it should open automatically] the
output should be:
1) This should generate an error at
[C:\eclipse-3.5\workspace\Test\simple_test.php line 6]
in testFirst
in simple_test
FAILURES!!!
Test cases run: 1/1, Passes: 1, Failures: 1, Exceptions: 0
Or something similar
If you get the PHP debugger setup correctly (in Eclipse) in becomes
easy to right click and "Debug As" -> "PHP Script"
I hope this helps.
Regards,
Steven Balthazor
|