altocompta/unit-test
sparkyx 9898434767 Merge branch '250826-e-einvoice' into unstable
* 250826-e-einvoice: (29 commits)
  Update VENDOR : remove useless
  Factur-X norme 3 (May 15th, 2025)
  E-INVOICE : if upload an XML file than the embedded document will be saved separately, if there is no embedded document a standard document with info from XML will be generated
  E-INVOICE , when loading a XML , the file is splitted into a PDF and XML
  XMLInvoiceReader : extract information from XML
  E-INVOICE : corrige PriceAmount
  E-INVOICE : show the XML to download
  Database: upload file function
  E-INVOICE : export XML if exists from ledger_detail_bottom
  E-INVOICE : create standard invoice if not convert
  E-INVOICE: small bugs UBL21
  E-INVOICE: negative amount
  e-invoice : add communication , bank and buyer reference
  e-invoice : display errors if cannot be created
  Typo : space quantity
  PHPUNIT : adapt 12.3
  E-INVOICE: check data before generating E-INVOICE: add missing for Belgium : BuyerReference and Due_Date
  E-INVOICE: add code quantity
  E-INVOICE : add AdditionalDocument
  XMLInvoice adapt currency
  ...
2025-10-06 09:01:38 +02:00
..
document/fr_be Unit test : update 2021-05-17 12:54:21 +02:00
include Merge branch '250826-e-einvoice' into unstable 2025-10-06 09:01:38 +02:00
test-sql TEST : for testing patch files 2023-08-09 13:12:27 +02:00
bootstrap.php.example Fix bug : new document w/o description 2023-01-08 20:22:50 +01:00
create-dossier-test.sh Compatibility php8.3, scenario test 2024-11-04 22:56:20 +01:00
dossier25.sql.gz Update DB Test for PHPUNIT 2024-12-21 14:21:47 +01:00
facility.class.php Adapt PHPUNIT 2021-08-14 16:15:02 +02:00
global.example.php Code improve noalyss_user: isolate repository from db 2025-08-10 18:30:53 +02:00
global.php Fix PHPUNIT for PHP8.2 and compatibility PHP8.2 2025-09-04 08:42:46 +02:00
jrn.csv TEST : add new files 2019-11-02 00:56:45 +01:00
README GESTION : operation add receipt number 2024-08-07 17:59:40 +02:00
test-complet-9.ods Fix Bug : tva_code not retrieve from search 2024-06-30 15:00:58 +02:00
test-file.sh-example 0002360: TVA : permet utilisation code TVA plutôt que nombre 2024-06-16 09:43:20 +02:00

Ce répertoire sert aux tests unitaires avec PHPUNIT, il faut d'abord changer dans le bootstrap.php pour que le path soit correct.
Il faut configurer pour pouvoir l'utiliser :
1 . Activer PHPUNIT, 
2 . dans GLOBAL PATH (propriété du projet) ajouter le fichier phpunit.phar
3. Donner unit-test comme répertoire de test

Base de données 
===============
Une base de données (dossier25.sql.gz) est donnée pour fonctionner avec les tests. Il faut la restaurer vide 
puis exécuter le script avec psql 

voir https://wiki.noalyss.eu/doku.php?id=tutoriaux:restaurer_un_dossier_manuellement

Paramètrage
===========

Pour tester , 

  * installer phpunit et adapter le chemin dans le fichier test-file.php
  * copier  le fichier bootstrap.example.php vers bootstrap.php
  * copier  le fichier global.example.php vers global.php
  * adapter ces 2 fichiers global.php et bootstrap.php


Fichiers 
===========

  * boostrap.example.php , exemple de fichier bootstrap pour phpunit
  * global.example.php , exemple de fichier pour votre environnement : utilisateur et dossier
  * facility.class.php , classe pour des outils utilisables dans vos tests
  * test-file.sh script appelant phpunit 
  * debug-php.sh pour debugguer les tests 

  
Global.php
==========

Donner le dossier
$_REQUEST['dossier']

Utilisateur pour Noalyss
$_SESSION['g_user']='phpcompta';

Mot de passe  pour g_user
$_SESSION['g_pass']='dany';

Bootstrap
=========
Ensuite copier bootstrap.php.example vers bootstrap.php et modifier les variables (le dossier à utiliser, include_path ...)


Testing commande en ligne
=========================
Si vous utilisez Xdebug, il faut le désactiver avec ceci

	export XDEBUG_MODE=off

Dans une autre fenêtre, si vous testez la transformation avec libreOffice
	
	unoconv -l

Et aussi, supprimer le fichier 
	
	/tmp/web.xml

Dans le fichier noalyss/include/config.inc.php , donner 1 à  DEBUGNOALYSS 

	define ('DEBUGNOALYSS',1);
	
test (depuis repertoire include)
 php <chemin>/phpunit.phar  --tap --colors --bootstrap ../bootstrap.php class_acc_accountTest.php