From 295c8023d391510a7b8a55e85a65078064e2b99a Mon Sep 17 00:00:00 2001 From: Artus Kolanowski Date: Thu, 21 Feb 2013 21:52:22 +0100 Subject: [PATCH] Fix helper for determining system memory usage on Windows On Windows systems in other languages than English, the method 'Magento_Test_Helper_Memory::getWinProcessMemoryUsage()' calls 'Magento_Test_Helper_Memory::convertToBytes()' with an invalid argument, because the column names from the output of 'tasklist' are language specific. The alternative usage of the column index seems to be stable over the various versions of Windows, where 'tasklist' is available. Tested on Windows 8 related #237 --- .../integration/framework/Magento/Test/Helper/Memory.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/framework/Magento/Test/Helper/Memory.php b/dev/tests/integration/framework/Magento/Test/Helper/Memory.php index 0e017a9849b39..97646c774a70b 100644 --- a/dev/tests/integration/framework/Magento/Test/Helper/Memory.php +++ b/dev/tests/integration/framework/Magento/Test/Helper/Memory.php @@ -104,17 +104,15 @@ public function getUnixProcessMemoryUsage($pid) */ public function getWinProcessMemoryUsage($pid) { - $output = $this->_shell->execute('tasklist /fi %s /fo CSV', array("PID eq $pid")); + $output = $this->_shell->execute('tasklist /fi %s /fo CSV /nh', array("PID eq $pid")); /** @link http://www.php.net/manual/en/wrappers.data.php */ $csvStream = 'data://text/plain;base64,' . base64_encode($output); $csvHandle = fopen($csvStream, 'r'); - $keys = fgetcsv($csvHandle); - $values = fgetcsv($csvHandle); + $stats = fgetcsv($csvHandle); fclose($csvHandle); - $stats = array_combine($keys, $values); - $result = $stats['Mem Usage']; + $result = $stats[4]; return self::convertToBytes($result); }