mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 02:12:33 +01:00
Qual: Improve lang test + message in case of test exception
# Qual: Improve lang test + message in case of test exception This fixes the language test enabling the error message itself. I also improved the Exception handling so that a backtrace is shown to help find where it happened (here the error message was empty which was strange and made it harder to find - the (empty(val)?a:b) was lacking parentheses for proper concatenation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -168,6 +168,16 @@ abstract class CommonClassTest extends TestCase
|
||||
print "##[group]$className::$failedTestMethod failed - $argsText.".PHP_EOL;
|
||||
print "## ".get_class($t).": {$t->getMessage()}".PHP_EOL;
|
||||
|
||||
// Show some information about where it happened
|
||||
foreach ($t->getTrace() as $idx => $trace) {
|
||||
if (isset($trace['file'], $trace['line']) // Only if we have a file name
|
||||
&& !preg_match('/(?:\bphar\b|Framework)/', $trace['file']) // Only if it's not in phpunit
|
||||
) {
|
||||
print "## backtrace($idx): From {$trace['file']}:{$trace['line']}.".PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($nbLinesToShow) {
|
||||
$newLines = count($last_lines);
|
||||
if ($newLines > 0) {
|
||||
|
||||
Reference in New Issue
Block a user