dolibarr/test
Raphaël Doursenaud 2cf9d9f583 Fix #3322 Use title for alt if no alt is provided
alt has priority over title, so it should be filled if title is filled.
Use the title value to fill alt.
Unit test updated accordingly.
2015-08-03 10:30:10 +02:00
..
awbot Add tool to make stress tests 2013-11-27 20:00:18 +01:00
phpunit Fix #3322 Use title for alt if no alt is provided 2015-08-03 10:30:10 +02:00
selenium Qual: Renamed all files & links "fiche.php" into "card.php" 2014-09-18 21:18:25 +02:00
soapui Fixed: Prices visible into stock tab. 2015-01-12 18:26:11 +01:00
.gitignore Ignore file 2014-04-06 21:25:53 +02:00
README Update doc 2014-03-15 12:23:46 +01:00

README (English)
--------------------------------
This directory contains unit tests and docs for Dolibarr quality analysis.



PHPUNIT
-------
To use make phpunit analysis, you must:

* Install PHPUnit
If using Eclipse, you must also add an entry as external tool for phpunit programm with:
-Name:      PHPUnit
-Location:  Linux:   /usr/bin/php
            Windows: C:\Program Files (x86)\wamp\bin\php\php5.2.8\php.exe
-Workspace: ${workspace_loc}
-Arguments: Linux:   /usr/bin/phpunit ${resource_path}
            Windows: "C:\Program Files (x86)\PHPUnit-3.4.9\phpunit.php" ${resource_path}
If not using Eclipse, to install PHPUnit manually:
> sudo apt-get remove phpunit
> sudo apt-get upgrade pear
> sudo pear channel-discover pear.phpunit.de
> sudo pear channel-discover pear.symfony-project.com
> sudo pear channel-discover components.ez.no
> sudo pear update-channels
> sudo pear upgrade-all
> sudo pear install --alldeps phpunit/PHPUnit

* Run Unit tests: 
> cd test/phpunit
> phpunit MyFileTest.php
If using Eclipse, select the test and click on menu "Run external tools and choose PHPUnit".

* Generate a report of Unit tests code coverage among tested classes only:
> cd test
> phpunit -d memory_limit=-1 -d max_input_time=600 -d max_execution_time=600 --configuration ./phpunit/phpunittest.xml --coverage-html ./report --coverage-clover ./report/logs/phpunit.coverage.xml --log-junit ./report/logs/phpunit.xml phpunit/MyClassTest.php
Note that xdebug must be installed for this feature to work.

* Generate a report of Unit tests code coverage among all Dolibarr classes:
Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. Note: Version 3.5 need 1.5G
> cd test
> phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report --coverage-clover ./report/logs/phpunit.coverage.xml --log-junit ./report/logs/phpunit.xml phpunit/AllTests.php

If there is a timeout before end, try this: 
> cd test
> php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report phpunit/AllTests.php
puis renice -10 du process php



PHP-CODESNIFFER
---------------
* Install phpcs

* Launch PHP-Codesniffer:
> cd dev
> /usr/bin/php5 -c ./codesniffer/php.ini /usr/bin/phpcs --report=xml --standard=./codesniffer ../htdocs/test.php



PHPDEPEND
---------
* Install pdepend

* Launch PDepend analysis:
> cd test
> pdepend --debug -d memory_limit=-1 --configuration=./phpunit/phpunittest.xml --phpunit-xml=./report/logs/pdepend.xml --summary-xml=./report/logs/summary.xml --jdepend-chart=./report/logs/jdepend.svg --overview-pyramid=./report/logs/pyramid.svg --ignore=custom,custom2,adodbtime,artichow,ckeditor,efc_xfss,fckeditor,fpdf,geoip,magpierss,nusoap,odtphp,phpexcel,php_writeexcel,smarty,smtps,tcpdf,vcard ../htdocs

* To clean pdepend cache files
> rm -fr ~/.pdepend/*