Merge remote-tracking branch 'origin/support/3.0' into develop

# Conflicts:
#	core/email.class.inc.php
This commit is contained in:
Pierre Goiffon
2022-05-03 10:52:50 +02:00
4 changed files with 106 additions and 25 deletions

View File

@@ -455,7 +455,11 @@ class ExpressionEvaluateTest extends iTopDataTestCase
}
/**
* Systematically check all supported format specs, for a given date
* For a given date,
* for all different formats (1st array element returned by {@see static::TimeFormatsProvider}),
* compare value returned by :
* * DATE_FORMAT() SQL function,
* * FunctionExpression('DATE_FORMAT', ...) result
*
* @covers FunctionExpression::Evaluate()
* @dataProvider EveryTimeFormatProvider
@@ -481,7 +485,8 @@ class ExpressionEvaluateTest extends iTopDataTestCase
}
$sSelects = "SELECT ".implode(', ', $aSelects);
$aRes = CMDBSource::QueryToArray($sSelects);
$aRow = $aRes[0];
/** @var array $aMysqlDateFormatRsultsForAllFormats format as key, MySQL evaluated result as value */
$aMysqlDateFormatRsultsForAllFormats = $aRes[0];
foreach ($aFormats as $sFormatDesc => $aFormatSpec)
{
$sFormat = $aFormatSpec[0];
@@ -489,13 +494,8 @@ class ExpressionEvaluateTest extends iTopDataTestCase
if ($bProcessed)
{
$oExpression = new FunctionExpression('DATE_FORMAT', array(new ScalarExpression($sDate), new ScalarExpression("%$sFormat")));
$res = $oExpression->Evaluate(array());
if (is_numeric($res)) {
// N°3091 after PHPUnit upgrade from 6 to 8.5 some errors were thrown here
// example : assertEquals was returning false for expected=8 and actual=08
$res = (float) $res;
}
static::assertEquals($aRow[$sFormat], $res, "Format %$sFormat not matching MySQL for '$sDate'");
$itopExpressionResult = $oExpression->Evaluate(array());
static::assertSame($aMysqlDateFormatRsultsForAllFormats[$sFormat], $itopExpressionResult, "Format %$sFormat not matching MySQL for '$sDate'");
}
}
}

View File

@@ -5,6 +5,7 @@
bootstrap="unittestautoload.php"
backupGlobals="true"
colors="true"
columns="120"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
@@ -18,8 +19,10 @@
>
<php>
<ini name="display_errors" value="true"/>
<ini name="error_reporting" value="true"/>
<ini name="error_reporting" value="E_ALL"/>
<ini name="display_errors" value="On"/>
<ini name="log_errors" value="On"/>
<ini name="html_errors" value="Off"/>
</php>
<testsuites>

View File

@@ -17,6 +17,13 @@
verbose="true"
>
<php>
<ini name="error_reporting" value="E_ALL"/>
<ini name="display_errors" value="On"/>
<ini name="log_errors" value="On"/>
<ini name="html_errors" value="On"/>
</php>
<testsuites>
<testsuite name="PostBuildIntegration">
<directory>postbuild_integration</directory>