Environment and development tools: Difference between revisions
m (→Instal PHPUnit) |
|||
| Line 127: | Line 127: | ||
* CygWin (to have the "patch" command and the command line CVS if you prefer command lines interface) | * CygWin (to have the "patch" command and the command line CVS if you prefer command lines interface) | ||
== If you want to make | == If you want to make step by step debugging or tunning (XDebug) == | ||
* To add global tuning information for pages on your browser status bar, add environment variable DOL_TUNING to 1 into Apache. For this, just add the following line into your apache.conf: | |||
<source lang="ini"> | |||
SetEnv DOL_TUNING 1 | |||
</source> | |||
Then, check that your browser does not have options to block changing of status bar by javascript. | |||
* Install | * Install XDebug. | ||
With Ubuntu: install package php-xdebug | With Ubuntu: install package php-xdebug | ||
| Line 135: | Line 140: | ||
* Modify php.ini file (or xdebug.ini) to add parameters: | * Modify php.ini file (or xdebug.ini) to add parameters: | ||
<source lang="ini"> | |||
[xdebug] | [xdebug] | ||
xdebug.remote_enable=on | xdebug.remote_enable=on | ||
| Line 145: | Line 150: | ||
xdebug.profiler_output_dir=c:/temp | xdebug.profiler_output_dir=c:/temp | ||
xdebug.profiler_append=0 | xdebug.profiler_append=0 | ||
</source> | |||
* Then to analyze files generated by XDebug profiling, you can install KCacheGrind (Linux) or WinCacheGrind (Windows). | * Then to analyze files generated by XDebug profiling, you can install KCacheGrind (Linux) or WinCacheGrind (Windows). | ||
Revision as of 10:28, 8 May 2010
Every integrated development environment can be used. However, this is a list of tools highly recommanded to use. They are all famous and a good help as they are featurful and of high quality. They are used by most main Dolibarr developers. Above all, they are all free and Opensource.
For every developer
This is the recommended main tools but every tool compliant to Web, PHP, Mysql and Web standards can be used.
An AMP server
- Apache, Mysql and PHP
For Linux: Those 3 products are available in all Linux distribution by default.
For Windows: Install WampServer 2 (Mysql database, Apache and PHP in an all in one package). This WAMP server offers MySql+Apache+PHP, with possibility to change version of any of this component with a simple click.
Firefox and plugins
- Firefox 3.0 with plugins:
- HTML Validator,
- Phplangeditor and Dictionnaries of any languages you plan to translate,
- Firebug + Firecookie,
- Cert Viewer Plus if you plan to make tests with HTTPS,
- FoxyProxy if you want to switch quickly on proxy tools (WebScarab),
- User Agent Switcher to simulate usage of smartphones.
You can download this on web site http://www.firefox.com
SquirrelSQL
- SquirrelSQL for database administration
You can download it at http://squirrel-sql.sf.net
Eclipse and plugins
Install Eclipse
We recommend using version 3.4 of Eclipse available on web site http://www.acceleo.org/pages/download-acceleo-2-6-0/en that embed most interesting plugins. Once launched, you can go in the update center, Help -> Software updates to upgrade to Eclipse version 3.4.2 M20090211-1700.
Also any version available on web site is possible Eclipse.
Install plugin Eclipse for PHP: PDT.
If you installed Eclipse version defined previously, all you have to do is using process Find And Install and add the update URL: http://download.eclipse.org/tools/pdt/updates/
Install version 1.0.5 of PDT. Version 0.2.0 is bugged with Eclipse 3.4.x.
Setup Eclipse to get CVS version
Une fois qu'Eclipse est installé, vous pouvez vous connecter au repository CVS pour y récupérer la dernière version de développement.
- Créer un nouveau projet : File >> New >> Projects puis sélectionner "Project from CVS" et "Next"
- Sélectionner "Create a new repository location" puis "Next"
- Remplir la fenêtre suivante comme ceci :
- Host : cvs.savannah.nongnu.org
- Repository path : /cvsroot/dolibarr
- User : anonymous
- Password : (laisser vide)
- Connection type : pserver
- Use default port
- Ensuite remplir le champ Use specified module name : dolibarr
- Choisir ensuite le nom que le projet aura sur votre machine :
- Cocher Check out as a projet in the workspace
- Project Name : dolibarr
- Cocher Checkout subfolders
- Ensuite, laisser le chemin par défaut du workspace et "Next"
- Enfin, sélectionner la branche à charger
- HEAD est la version de développement
- Les version 2.6, 2.6, etc., se trouvent dans Branches
- Cliquer sur "Finish"
Les fichiers devraient être téléchargés sur votre disque dur.
Pour ensuite mettre à jour la version de votre machine, il faut passer en perspective "Team Synchronizing" pour utiliser la fonction "Synchronize CVS", ce qui aura pour effet de télécharger les dernières versions sur votre disque dur. Seuls les fichiers qui ont été modifiés sont téléchargés.
Eclipse and plugins
- Install Eclipse
I recommand to use version 3.4 of Eclipse available on site http://www.acceleo.org/pages/download-acceleo-2-6-0/en and that contains all majors interesting plugins. Once launched, you can go tino the upgrade center, Help -> Software updates to upgrade Eclipse to version 3.4.2 M20090211-1700.
Otherwise, any version found on Eclipse web site should works.
- Install the Eclipse plugin for PHP: PDT
If you install the Eclipse version define previously, all you have to do is using the process Find And Install and add the update URL: http://download.eclipse.org/tools/pdt/updates/
Install PDT 1.0.5 (version 2.0 is bugged on Eclipse 3.4.x).
Optional
If you manage other projects with SVN
- Install Eclipse plugin for SVN: SubClipse
For this, use the Find And Install process and add the SVN update URL:
http://subclipse.tigris.org/install.html
or
- Install Eclispe plugin for SVN: Subversive
http://community.polarion.com/projects/subversive/download/eclipse/2.0/ganymede-site/ - [required] Subversive SVN Connectors http://community.polarion.com/projects/subversive/download/integrations/ganymede-site/ - [optional] Subversive Integrations
If you want to make Perl scripts
- Install the Eclipse plugin for Perl: EPIC
For this, use the Find And Install process and add the update URL: http://e-p-i-c.sourceforge.net/updates
If you want to develop modules with the UML2Dolibarr generator
A method to generate code of a module from UML is currently on work. More information on page Building a module using MDA. To use it, you must install the following components (If you install the previously recommanded version of Eclipse, all of this is already done):
- Install TopCased 1.4+: http://www.topcased.org
- Install Acceleo 2.2.1+
For this, user menu Find And Install and add update URL: http://www.acceleo.org/update/
- Install UML2Dolibarr
For this, get the procject with command:
svn checkout svn://svn.forge.objectweb.org/svnroot/acceleo/trunk/modules/community/uml21/dolibarr/trunk/
and import it into Eclipse.
If you are using Windows
- Notepad++ (for those which can't stand java or using a computer too old for Eclipse).
- WinMerge (to compare files and directories)
- CygWin (to have the "patch" command and the command line CVS if you prefer command lines interface)
If you want to make step by step debugging or tunning (XDebug)
- To add global tuning information for pages on your browser status bar, add environment variable DOL_TUNING to 1 into Apache. For this, just add the following line into your apache.conf:
SetEnv DOL_TUNING 1
Then, check that your browser does not have options to block changing of status bar by javascript.
- Install XDebug.
With Ubuntu: install package php-xdebug
With WampServer/Windows: Download dll file on http://www.xdebug.org and to store in directory ext of php. Then enable plugin.
- Modify php.ini file (or xdebug.ini) to add parameters:
[xdebug]
xdebug.remote_enable=on
xdebug.remote_handle=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.show_local_vars=off
xdebug.profiler_output_dir=c:/temp
xdebug.profiler_append=0
- Then to analyze files generated by XDebug profiling, you can install KCacheGrind (Linux) or WinCacheGrind (Windows).
To develop or use PHPUnit test
Instal PHPUnit
- Download a release archive from http://pear.phpunit.de/get/ and extract it to a directory that is listed in the include_path of your php.ini configuration file.
- Prepare the phpunit script:
- For Linux: Rename the phpunit.php script to phpunit and replace the @php_bin@ string in it with the path to your PHP command-line interpreter (usually /usr/bin/php).
- For Windows: Replace the @php_bin@ string in file phpunit.bat with the path of your PHP command-line interpreter and @bin_dir@ string with the path of the PHPunit directory.
- Edit your Path to inclulde PHPunit directory
- Make script runnable (chmod +x phpunit on Linux).
- Prepare the PHPUnit/Util/PHP.php script:
- Replace the @php_bin@ string if it exists in file it with the path to your PHP command-line interpreter (usually /usr/bin/php).
- Module xdebug can also be required if you plan to make reporting of test code covering.
Execute PHPUnit tests
- Go into directory /test of CVS version. Read file README to know the process to execute a unit test campaign.
CVS Setup
If you are an official developer with a write CVS access, add into your Eclipse setup a CVS entry.
- :ext:yourlogin@cvs.savannah.nongnu.org:/cvsroot/dolibarr for main Dolibarr project.
- :ext:yourlogin@cvs.savannah.nongnu.org:/cvsroot/dolibarrmod for secondary external modules.
Otherwise, you must get sources from tarball available on Dolibarr web site ( http://www.dolibarr.org ) in download area.