N°8772 - test driven compiler wip

This commit is contained in:
Eric Espie
2025-12-10 16:21:31 +01:00
parent 090925e28b
commit c40e7ab10e
13 changed files with 402 additions and 54 deletions

View File

@@ -11,6 +11,7 @@ use CMDBSource;
use DateTime;
use DeprecatedCallsLog;
use MySQLTransactionNotClosedException;
use ParseError;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use ReflectionMethod;
use SetupUtils;
@@ -574,6 +575,23 @@ abstract class ItopTestCase extends KernelTestCase
self::assertLessThan(2, $iTimeInterval, $sMessage);
}
/**
* @since 3.3.0
*/
protected static function AssertPHPCodeIsValid(string $sPHPCode, $sMessage = ''): void
{
try {
eval($sPHPCode);
} catch (ParseError $e) {
$aLines = explode("\n", $sPHPCode);
foreach ($aLines as $iLine => $sLine) {
echo sprintf("%02d: %s\n", $iLine + 1, $sLine);
}
echo 'Parse Error: '.$e->getMessage().' at line: '.$e->getLine()."\n";
self::fail($sMessage);
}
}
/**
* Control which Kernel will be loaded when invoking the bootKernel method
*