mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
N°8772 - test driven compiler wip
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user