NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PHPUnit integration...


Joined: 16 Oct 2003
Posts: 21
Reply with quote
Hi,

I just wanted to share the string to use in order to integrate PHPEd with PHPUnit. For assumptions please read the section on assumptions.

1. Start Nusphere PHPEd
2. In the menu select: Select Tools > Settings
3. In the Settings dialog select: Tools > Integration
4. Select "Add menu"
5. Write PHPUnit
6. Select Edit
7. In "Execute with" select "Shell"
8. In "Command line" paste the following (or if you have installed PEAR to a different path - please update).
Code:

 "C:\Program\nusphere\TechPlat\apache\php\php.exe" -f "C:\Program\nusphere\TechPlat\apache\php\PEAR\PHPUnit\TextUI\Command.php" @BaseName@ "@FName@"

9. In Shortcut: E.g. __press__: Ctrl+Shift+T
10. Check "Show this command in Workspace popup" and check "for files".
11. Check "Show this command in Explorer popup" and check "for files".
12. Check "Show this command in Tools menu"
13. Check "Show this command in File Bar popup"
14. Check "Show this commanf for local files only"
15. Select "Redirect Output stream to log window"
16. Press Close and OK.
17. In the Workspace or Explorer window in NuSphere you may now right-click a file and select PHPUnit. If you open the file you might even press Shift+Ctrl+T to execute PHPUnit.
18. Verify the output in the log-window.

Assumptions
The instructions above assumes the following:
* NuSphere TechPlatform, PHP, PEAR and PHPUnit is installed on the system
* All PHPUnit-testfiles have the same class-name as filename.
* That Ctrl+Shift+T is availale as short-cut (default key mapping is for <td></td>). You can remove the key mapping by:
* Go to Tools > Settings > Editor > Editor shortcuts
* Scroll all the way down to <td> and select it
* Press delete to remove the key-mapping.

Code:

"C:\Program Files\nusphere\TechPlat\apache\php\.\php.exe" -d include_path=".;D:\path\to\PEAR;" -f "D:\path\to\PEAR\PHPUnit\TextUI\Command.php" @BaseName@ @FName@


Edit:
If you install PHPUnit with the PEAR Installer (and registered the path to PEAR in Windows environment variables) and you have added the PEAR-libraries to the include_path in php.ini you may shorten the above string to:

Code:

@php@ -f "D:\path\to\PEAR\PHPUnit\TextUI\Command.php" @BaseName@ @FName@


For more information see:
- http://www.phpunit.de/wiki

Best Regards,
Jan Bolmeson
View user's profileFind all posts by madwaxSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 6723
Reply with quote
applauds!

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 6723
Reply with quote
slightly updated instructions:

install phpunit
In order to install phpunit for php shipped with PhpED open cmd console and type the following commands:
Code:
cd %PROGRAMFILES%\NuSphere\PhpED\php5
go-pear.bat
<press enter when it asks to install for system>
<press enter when it asks to install all>
<press enter when it asks to quit>
pear.bat channel-update pear.php.net
pear.bat upgrade-all
pear channel-discover pear.phpunit.de
pear.bat install phpunit/PHPUnit


add PHPUnit command
1. Start Nusphere PHPEd
2. In the menu select: Select Tools > Settings
3. In the Settings dialog select: Tools > Integration
4. Select "Add menu"
5. Write PHPUnit
6. Select Edit
7. In "Execute with" select "Shell"
8. In "Command line" paste the following (or if you have installed PEAR to a different path - please update).
Code:
"@php5cli@" "C:\Program Files\NuSphere\PhpED\php5\phpunit"  "@FName@"

9. In Shortcut: E.g. __press__: Ctrl+Shift+T
10. Check "Show this command in Workspace popup" and check "for files".
11. Check "Show this command in Explorer popup" and check "for files".
12. Check "Show this command in Tools menu"
13. Check "Show this command in File Bar popup"
14. Check "Show this commanf for local files only"
15. Select "Redirect Output stream to log window" and "Redirect Error stream to log window"
16. Press Close and OK.

verifying the results
1. create the following file in phped:
Code:
<?php
    require_once 'PHPUnit/Framework.php';
    class ExpectedErrorTest extends PHPUnit_Framework_TestCase {
        /**
         * @expectedException PHPUnit_Framework_Error
         */
        public function testFailingInclude() {
            include 'not_existing_file.php';
        }
    }
?>

2. save it under test1.php name
3. right click on the test1.php file tab and select "PHPUnit"
4. open log winodow (View->Tabs->Log) and make sure that it contains testcase output, like below:
Code:
"C:\Program Files\NuSphere\PhpED\php5\php.exe" "C:\Program Files\NuSphere\PhpED\php5\phpunit" "C:\tests\Test1.php"
#!C:\Program Files\nusphere\PhpED\php5\.\php.exe
PHPUnit 3.3.17 by Sebastian Bergmann.

.

Time: 0 seconds

OK (1 test, 1 assertion)

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
PHPUnit integration...
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic