mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3806 Fix saying memory_limit isn't enough in CLI scripts and setup
This was caused by the strict comparison in \utils::IsMemoryLimitOk for the special "-1" value of memory_limit, which was added in c2f5cafa.
Fix was to change \utils::ConvertToBytes : it was returning original value when input was numeric (so if input is '-1' output was '-1') now it always returns an int (input '-1' output -1)
This commit is contained in:
@@ -436,12 +436,14 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
|
||||
{
|
||||
$iCurrentConvertedValue = utils::ConvertToBytes($sExpressionToConvert);
|
||||
self::assertEquals($iExpectedConvertedValue, $iCurrentConvertedValue, 'Converted value wasn\'t the one expected !');
|
||||
self::assertSame($iExpectedConvertedValue, $iCurrentConvertedValue, 'Value was converted but not of the expected type');
|
||||
}
|
||||
|
||||
public function ConvertToBytesProvider()
|
||||
{
|
||||
return [
|
||||
'123' => ['123', 123],
|
||||
'123 int value' => ['123', 123],
|
||||
'-1 no limit' => ['-1', -1],
|
||||
'56k' => ['56k', 56 * 1024],
|
||||
'512M' => ['512M', 512 * 1024 * 1024],
|
||||
'2G' => ['2G', 2 * 1024 * 1024 * 1024],
|
||||
|
||||
Reference in New Issue
Block a user