2010-04-25 16:19:58 +02:00
|
|
|
README (English)
|
|
|
|
|
--------------------------------
|
2012-08-05 13:30:12 +02:00
|
|
|
This directory contains unit tests and docs for Dolibarr quality analysis.
|
2010-05-06 00:41:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PHPUNIT
|
|
|
|
|
-------
|
2011-02-13 19:08:53 +01:00
|
|
|
To use make phpunit analysis, you must:
|
2010-04-25 16:25:44 +02:00
|
|
|
|
2010-04-25 16:19:58 +02:00
|
|
|
* Install PHPUnit
|
2010-04-25 16:25:44 +02:00
|
|
|
If using Eclipse, you must also add an entry as external tool for phpunit programm with:
|
2010-04-25 16:19:58 +02:00
|
|
|
-Name: PHPUnit
|
2010-04-27 01:20:14 +02:00
|
|
|
-Location: Linux: /usr/bin/php
|
|
|
|
|
Windows: C:\Program Files (x86)\wamp\bin\php\php5.2.8\php.exe
|
2010-04-25 16:19:58 +02:00
|
|
|
-Workspace: ${workspace_loc}
|
2010-04-27 01:20:14 +02:00
|
|
|
-Arguments: Linux: /usr/bin/phpunit ${resource_path}
|
|
|
|
|
Windows: "C:\Program Files (x86)\PHPUnit-3.4.9\phpunit.php" ${resource_path}
|
2012-08-05 13:30:12 +02:00
|
|
|
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
|
2010-04-25 16:25:44 +02:00
|
|
|
|
2010-04-27 01:20:14 +02:00
|
|
|
* Run Unit tests:
|
2011-02-13 11:25:13 +01:00
|
|
|
> cd test
|
|
|
|
|
> phpunit MyFileTest.php
|
2010-04-25 16:25:44 +02:00
|
|
|
If using Eclipse, select the test and click on menu "Run external tools and choose PHPUnit".
|
2010-04-25 16:48:12 +02:00
|
|
|
|
2010-04-27 11:05:42 +02:00
|
|
|
* Generate a report of Unit tests code coverage among tested classes only:
|
2011-02-13 11:25:13 +01:00
|
|
|
> cd test
|
2013-06-10 09:54:23 +02:00
|
|
|
> 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
|
2010-04-25 16:48:12 +02:00
|
|
|
Note that xdebug must be installed for this feature to work.
|
2010-04-27 01:20:14 +02:00
|
|
|
|
2010-04-27 11:05:42 +02:00
|
|
|
* Generate a report of Unit tests code coverage among all Dolibarr classes:
|
2013-09-09 03:43:59 +02:00
|
|
|
Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. Note: Version 3.5 need 1.5G
|
2011-02-13 11:25:13 +01:00
|
|
|
> cd test
|
2013-09-09 03:23:56 +02:00
|
|
|
> 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
|
2011-07-09 01:35:05 +02:00
|
|
|
|
2011-07-09 02:11:55 +02:00
|
|
|
If there is a timeout before end, try this:
|
2011-07-09 01:35:05 +02:00
|
|
|
> cd test
|
2013-09-09 03:23:56 +02:00
|
|
|
> 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
|
2011-07-09 02:11:55 +02:00
|
|
|
puis renice -10 du process php
|
2011-07-09 01:35:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PHP-CODESNIFFER
|
|
|
|
|
---------------
|
|
|
|
|
* Install phpcs
|
|
|
|
|
|
|
|
|
|
* Launch PHP-Codesniffer:
|
2011-08-28 16:33:55 +02:00
|
|
|
> cd dev
|
2011-07-09 02:11:55 +02:00
|
|
|
> /usr/bin/php5 -c ./codesniffer/php.ini /usr/bin/phpcs --report=xml --standard=./codesniffer ../htdocs/test.php
|
2010-04-27 11:05:42 +02:00
|
|
|
|
2010-05-06 00:41:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
PHPDEPEND
|
|
|
|
|
---------
|
2011-07-09 01:35:05 +02:00
|
|
|
* Install pdepend
|
2010-05-06 00:41:54 +02:00
|
|
|
|
2011-02-13 11:25:13 +01:00
|
|
|
* Launch PDepend analysis:
|
|
|
|
|
> cd test
|
2011-03-23 19:39:22 +01:00
|
|
|
> 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
|
2011-02-13 19:42:36 +01:00
|
|
|
|
|
|
|
|
* To clean pdepend cache files
|
|
|
|
|
> rm -fr ~/.pdepend/*
|
|
|
|
|
|