dolibarr/test/phpunit
TowyTowy 9d10392d66
FIX isValidTinForES() rejects almost every Spanish NIE starting with T (#39384)
The "Check NIE T" branch compared the control character of the TIN to the
return value of preg_match() instead of using preg_match() as the condition:

    if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $str)) {

Since execution only reaches that branch when the string already matched the
format, preg_match() always returns 1, so the test collapsed to
$num[8] == 1. A NIE of type T therefore validated only when its last
character was literally "1", and every other one was reported as -3
(invalid control key). Out of the 36 possible control characters, 35 were
wrongly rejected.

A NIE starting with T has no control key algorithm, so matching the
documented syntax is the only check to perform.

Also fill in and enable the testIsValidTinForES() unit test that was left
commented out with empty input strings.

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-04 22:48:15 +02:00
..
functional Qual: Improve test messages to help locate errors + php-cs-fixer on tests (#28272) 2024-02-19 15:28:21 +01:00
.gitignore 18.0 fix CVE 2024 40137 (#34762) 2025-09-04 14:59:44 +02:00
AbstractRestAPITest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
AccountancySystemTest.php test: phpunit: add AccountancySystemTest 2024-12-04 08:10:37 +01:00
AccountingAccountTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ActionCommTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
AdherentTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
AdminLibTest.php Fix comparison on version to show the warning to upgrade database 2025-08-20 16:02:46 +02:00
AllTests.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-01-15 13:01:03 +01:00
AssetModelTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
BankAccountTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
BarcodeTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
BOMTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
BonPrelevementTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
BuildDocTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CategorieTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ChargeSocialesTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CMailFileTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CodingPhpTest.php FIX Security when using feature Advanced Target of emailing (hidden in 2025-09-01 16:38:01 +02:00
CodingSqlTest.php Fix message 2024-11-14 01:44:13 +01:00
CommandeFournisseurTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CommandeTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CommonClassTest.class.php Qual: Improve lang test + message in case of test exception 2025-01-30 18:11:41 +01:00
CommonInvoiceTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CommonObjectTest.php FIX isInt() does not detect sized integer types (tinyint, bigint) (#39236) 2026-07-20 15:30:28 +02:00
CompanyBankAccountTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CompanyLibTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ContactTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ContratTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
CoreTest.php Qual: Improve test messages to help locate errors + php-cs-fixer on tests (#28272) 2024-02-19 15:28:21 +01:00
DateLibTest.php FIX getFirstDayOfEachWeek()/getLastDayOfEachWeek() use the wrong year for weeks overlapping 2 years (#39198) 2026-07-18 19:40:57 +02:00
DateLibTzFranceTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
DiscountTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
DolDeprecationHandlerTest.php NEW: DolDeprecationHandler for deprecations 2024-03-24 17:39:02 +01:00
DoliDBTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
EmailCollectorTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
EntrepotTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
EvalMathTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ExampleTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ExpeditionTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ExpenseReportTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ExportTest.php QUAL Move function csvClean into functions2.lib.php 2024-10-03 21:36:39 +02:00
FactureFournisseurTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
FactureRecTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
FactureTest.php fix phpstan (#31801) 2024-11-13 21:21:15 +01:00
FactureTestRounding.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
FichinterTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
file_import_company_1.csv Add phpunit to test the rename/move into a corrupted pdf file. 2024-02-17 18:59:57 +01:00
file_pdf_with_js.pdf.jpg Add phpunit to test the rename/move into a corrupted pdf file. 2024-02-17 18:59:57 +01:00
FilesLibMoveDirTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
FilesLibTest.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-02-05 18:30:13 +01:00
FormAdminTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
FormTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
Functions2LibTest.php NEW Add function to manipulate emojis 2024-05-14 18:19:48 +02:00
FunctionsBELibTest.php FIX #34857 Structured communication number checksum is now always correct (#35081) 2025-08-26 05:16:32 +02:00
FunctionsLibTest.php FIX Buyer state/province VAT default (VATRULE 2) ignores active and entity filters (#39279) 2026-07-27 13:04:30 +02:00
GetUrlLibTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
HolidayTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ImagesLibTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
imap_header.txt
imap_htmlmsg.txt
imap_plaintext.txt
img250x20.png
img250x50.jpg
imgsvgwithjs.svg
ImportTest.php Qual: Improve test messages to help locate errors + php-cs-fixer on tests (#28272) 2024-02-19 15:28:21 +01:00
InventoryTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
JsonLibTest.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop 2024-07-13 17:47:55 +02:00
KnowledgeRecordTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
LangTest.php Qual: Improve lang test + message in case of test exception 2025-01-30 18:11:41 +01:00
LesscTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
LoanTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
MarginsLibTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ModulesTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
MouvementStockTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
NumberingModulesTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ODFTest.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-01-20 15:02:37 +01:00
PaypalTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
PdfDocTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
PgsqlTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
phpunit.dtd
phpunittest.xml Fix restore stop on failure. No need to continue, we must fix first. 2024-03-05 01:05:50 +01:00
PricesTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ProductTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ProfidLibTest.php FIX isValidTinForES() rejects almost every Spanish NIE starting with T (#39384) 2026-08-04 22:48:15 +02:00
ProjectTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
PropalTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
ReceptionTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
RepositoryTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
RestAPIContactTest.php fix on restpitest clas to use the generic abstract rest api (#31330) 2024-10-13 20:30:11 +02:00
RestAPIDocumentTest.php fix on restpitest clas to use the generic abstract rest api (#31330) 2024-10-13 20:30:11 +02:00
RestAPIMosTest.php Fix phpunit 2024-05-29 14:43:23 +02:00
RestAPIUserTest.php Qual: Add AbstractRestApiTest class, refactor RestApiUserTest, add RestApiMosTest (#28484) 2024-02-28 17:03:53 +01:00
ScriptsTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
SecurityGETPOSTTest.php Fix phpunit 2025-05-22 17:01:13 +02:00
SecurityLoginTest.php Complete phpunit and tests to avoid use of non expected function 2024-12-18 19:00:33 +01:00
SecurityTest.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-09-05 15:34:13 +02:00
SocieteTest.php Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-01-20 00:49:21 +01:00
StripeTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
SupplierProposalTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
TargetTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
test.php Fix regression after a fix 2025-01-09 19:35:01 +01:00
testemailing.txt
testvirus.txt
textiso.txt
textutf8.txt
TicketTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
UserGroupTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
UserTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
UtilsTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesInvoicesTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesOrdersTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesOtherTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesProductsTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesThirdpartyTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebservicesUserTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00
WebsiteTest.php Fix security test blocking $_SESSION... 2024-12-26 15:43:29 +01:00
XCalLibTest.php replace deprecated (#31803) 2024-11-14 00:16:43 +01:00