This commit is contained in:
Laurent Destailleur
2021-08-17 14:12:57 +02:00
parent f18f970b08
commit 758b7c404f
2 changed files with 18 additions and 7 deletions

View File

@@ -30,11 +30,19 @@ If not using Eclipse, to install PHPUnit manually:
> 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".
* Example to run phpunit 7.0 from composer using php version 8.0:
> cd ~/tmp
> composer -i phpunit
> cd test/phpunit
> /usr/bin/php8.0 ~/tmp/htdocs/includes/phpunit/phpunit/phpunit MyFileTest.php
* Generate a report of Unit tests code coverage done by one tested class:
> cd test
> phpunit -d memory_limit=-1 -d max_input_time=1800 -d max_execution_time=1800 --configuration ./phpunit/phpunittest.xml --coverage-html ./report ./report/logs/phpunit.xml phpunit/MyClassTest.php

View File

@@ -136,13 +136,16 @@ class ModulesTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$modulelist=array('Accounting','Adherent','Agenda','Api','Asset','Banque','Barcode','BlockedLog','Bookmark',
'CashDesk','Categorie','ClickToDial','Collab','Commande','Comptabilite','Contrat','Cron','DataPolicy','Dav','Deplacement','DocumentGeneration','Don','DynamicPrices',
'ECM','EmailCollector','Expedition','ExpenseReport','Export','ExternalRss','ExternalSite',
'Facture','Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','HRM','Import','Incoterm','Label','Ldap','Loan',
'Mailing','MailmanSpip','Margin','ModuleBuilder','MultiCurrency',
'Notification','Oauth','OpenSurvey','Paybox','Paypal','Prelevement','Printing','Product','ProductBatch','Projet','Propale','ReceiptPrinter','Resource',
'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog','TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow');
$modulelist=array('Accounting','Adherent','Agenda','Api','Asset','Banque','Barcode','BlockedLog','Bom','Bookmark',
'Categorie','ClickToDial','Collab','Commande','Comptabilite','Contrat','Cron','DataPolicy','Dav','DebugBar','Deplacement','DocumentGeneration','Don','DynamicPrices',
'ECM','EmailCollector','EventOrganization','Expedition','ExpenseReport','Export','ExternalRss','ExternalSite',
'Facture','Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','HRM','Import','Incoterm','Intracommreport',
'KnowledgeManagement','Label','Ldap','Loan',
'Mailing','MailmanSpip','Margin','ModuleBuilder','Mrp','MultiCurrency',
'Notification','Oauth','OpenSurvey','Paybox','PaymentByBankTransfer','Paypal','Prelevement','Printing','Product','ProductBatch','Projet','Propale',
'ReceiptPrinter','Reception','Recruitment','Resource',
'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog',
'TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow','Workstation','Zapier');
foreach ($modulelist as $modlabel) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php';
$class='mod'.$modlabel;