mirror of
https://github.com/Combodo/iTop.git
synced 2026-09-18 04:38:29 +02:00
N°9675 - geptile PR fixes + enhance regexp for cli php version
This commit is contained in:
@@ -5774,6 +5774,9 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
if ($bModelOnly) {
|
||||
// Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface
|
||||
EventService::InitService();
|
||||
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class ModelReflectionSerializer
|
||||
public function CheckCliPhpVersionFromOutput(string $sUIPhpVersion, string $sPHPExec, $aOutput): void
|
||||
{
|
||||
$sFoundVersion = trim($aOutput[0] ?? "");
|
||||
if (preg_match('/^.* (\d\.\d)\.\d/', $sFoundVersion, $aMatches)) {
|
||||
if (preg_match('/(\d+\.\d+)(?:\.\d+)?/', $sFoundVersion, $aMatches)) {
|
||||
$sFoundVersion = $aMatches[1];
|
||||
}
|
||||
if ($sFoundVersion != $sUIPhpVersion) {
|
||||
|
||||
@@ -32,12 +32,20 @@ OUTPUT;
|
||||
ModelReflectionSerializer::GetInstance()->CheckCliPhpVersionFromOutput('6.6', 'sPHPExec', [$sOuput]);
|
||||
}
|
||||
|
||||
public function testCheckOK()
|
||||
public function CheckOKProvider()
|
||||
{
|
||||
return [
|
||||
["7.4 7.2 7.3.33"],
|
||||
["PHP 7.4.33 (cli) (built: Aug 2 2024 16:22:28) ( NTS )"],
|
||||
["PHP 7.4.33 PHP 7.33.22"],
|
||||
["version: 7.4.27 stable"],
|
||||
];
|
||||
}
|
||||
/**
|
||||
* @dataProvider CheckOKProvider
|
||||
*/
|
||||
public function testCheckOK($sOuput)
|
||||
{
|
||||
$sOuput = <<<OUTPUT
|
||||
PHP 7.4.33 (cli) (built: Aug 2 2024 16:22:28) ( NTS )
|
||||
OUTPUT;
|
||||
|
||||
ModelReflectionSerializer::GetInstance()->CheckCliPhpVersionFromOutput('7.4', 'sPHPExec', [$sOuput]);
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user