17 $this->_shell = $this->createPartialMock(\
Magento\Framework\Shell::class, [
'execute']);
22 $object = new \Magento\TestFramework\Helper\Memory($this->_shell);
23 $this->_shell->expects(
28 $this->stringStartsWith(
'tasklist.exe ')
32 $this->_shell->expects(
37 $this->stringStartsWith(
'ps ')
39 $this->returnValue(
'26321')
41 $this->assertEquals(26952704, $object->getRealMemoryUsage());
46 $this->_shell->expects(
51 $this->stringStartsWith(
'tasklist.exe ')
53 $this->returnValue(
'"php.exe","12345","N/A","0","26,321 K"')
55 $object = new \Magento\TestFramework\Helper\Memory($this->_shell);
56 $this->assertEquals(26952704, $object->getRealMemoryUsage());
66 $this->assertEquals($expected, \
Magento\TestFramework\Helper\Memory::convertToBytes(
$number));
76 'KB' => [
'3K',
'3072'],
77 'MB' => [
'2M',
'2097152'],
78 'GB' => [
'1G',
'1073741824'],
79 'regular spaces' => [
'1 234 K',
'1263616'],
80 'no-break spaces' => [
"1\xA0234\xA0K",
'1263616'],
81 'tab' => [
"1\x09234\x09K",
'1263616'],
82 'coma' => [
'1,234K',
'1263616'],
83 'dot' => [
'1.234 K',
'1263616']
103 'more than one unit of measure' => [
'1234KB'],
104 'unknown unit of measure' => [
'1234Z'],
105 'non-integer value' => [
'1,234.56 K']
116 if (PHP_INT_SIZE <= 4) {
117 $this->markTestSkipped(
'A 64-bit system is required to perform this test.');
119 $this->assertEquals($expected, \
Magento\TestFramework\Helper\Memory::convertToBytes(
$number));
128 [
'2T',
'2199023255552'],
129 [
'1P',
'1125899906842624'],
130 [
'2E',
'2305843009213693952']
147 if (PHP_INT_SIZE > 4) {
148 $this->markTestSkipped(
'A 32-bit system is required to perform this test.');
testGetRealMemoryUsageUnix()
testConvertToBytesOutOfBounds()
testConvertToBytesInvalidArgument()
testConvertToBytes64($number, $expected)
testConvertToBytesBadFormat($number)
convertToBytes64DataProvider()
convertToBytesDataProvider()
testConvertToBytes($number, $expected)
static convertToBytes($number)
testGetRealMemoryUsageWin()
convertToBytesBadFormatDataProvider()