Definition at line 8 of file MemoryTest.php.
◆ convertToBytes64DataProvider()
convertToBytes64DataProvider |
( |
| ) |
|
- Returns
- array
Definition at line 125 of file MemoryTest.php.
128 [
'2T',
'2199023255552'],
129 [
'1P',
'1125899906842624'],
130 [
'2E',
'2305843009213693952']
◆ convertToBytesBadFormatDataProvider()
convertToBytesBadFormatDataProvider |
( |
| ) |
|
- Returns
- array
Definition at line 100 of file MemoryTest.php.
103 'more than one unit of measure' => [
'1234KB'],
104 'unknown unit of measure' => [
'1234Z'],
105 'non-integer value' => [
'1,234.56 K']
◆ convertToBytesDataProvider()
convertToBytesDataProvider |
( |
| ) |
|
- Returns
- array
Definition at line 72 of file MemoryTest.php.
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']
◆ setUp()
Definition at line 15 of file MemoryTest.php.
17 $this->_shell = $this->createPartialMock(\
Magento\Framework\Shell::class, [
'execute']);
◆ testConvertToBytes()
testConvertToBytes |
( |
|
$number, |
|
|
|
$expected |
|
) |
| |
- Parameters
-
string | $number | |
string | $expected | @dataProvider convertToBytesDataProvider |
Definition at line 64 of file MemoryTest.php.
66 $this->assertEquals($expected, \
Magento\TestFramework\Helper\Memory::convertToBytes(
$number));
◆ testConvertToBytes64()
testConvertToBytes64 |
( |
|
$number, |
|
|
|
$expected |
|
) |
| |
- Parameters
-
string | $number | |
string | $expected | @dataProvider convertToBytes64DataProvider |
Definition at line 114 of file MemoryTest.php.
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));
◆ testConvertToBytesBadFormat()
testConvertToBytesBadFormat |
( |
|
$number | ) |
|
- Parameters
-
string | $number | @dataProvider convertToBytesBadFormatDataProvider @expectedException \InvalidArgumentException |
Definition at line 92 of file MemoryTest.php.
static convertToBytes($number)
◆ testConvertToBytesInvalidArgument()
testConvertToBytesInvalidArgument |
( |
| ) |
|
@expectedException \InvalidArgumentException
Definition at line 137 of file MemoryTest.php.
static convertToBytes($number)
◆ testConvertToBytesOutOfBounds()
testConvertToBytesOutOfBounds |
( |
| ) |
|
@expectedException \OutOfBoundsException
Definition at line 145 of file MemoryTest.php.
147 if (PHP_INT_SIZE > 4) {
148 $this->markTestSkipped(
'A 32-bit system is required to perform this test.');
static convertToBytes($number)
◆ testGetRealMemoryUsageUnix()
testGetRealMemoryUsageUnix |
( |
| ) |
|
Definition at line 20 of file MemoryTest.php.
22 $object = new \Magento\TestFramework\Helper\Memory($this->_shell);
23 $this->_shell->expects(
28 $this->stringStartsWith(
'tasklist.exe ')
30 $this->throwException(
new \
Magento\Framework\Exception\LocalizedException(
__(
'command not found')))
32 $this->_shell->expects(
37 $this->stringStartsWith(
'ps ')
39 $this->returnValue(
'26321')
41 $this->assertEquals(26952704, $object->getRealMemoryUsage());
◆ testGetRealMemoryUsageWin()
testGetRealMemoryUsageWin |
( |
| ) |
|
Definition at line 44 of file MemoryTest.php.
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());
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/MemoryTest.php