/** * @param TestStepResult $testStepResult The test results of this step * @param UrlGenerator $urlGenerator For video frame URL generation for this tep * @param TestPaths $nameOnlyPaths To get the name of the video dir for this step * @return array Array with the additional information about this step */ private function getAdditionalInfoArray($testStepResult, $urlGenerator, $nameOnlyPaths) { $ret = array(); $progress = $testStepResult->getVisualProgress(); if (array_key_exists('frames', $progress) && is_array($progress['frames']) && count($progress['frames'])) { $ret['videoFrames'] = array(); foreach ($progress['frames'] as $ms => $frame) { $videoFrame = array('time' => $ms); $videoFrame['image'] = $urlGenerator->getFile($frame['file'], $nameOnlyPaths->videoDir()); $videoFrame['VisuallyComplete'] = $frame['progress']; $ret['videoFrames'][] = $videoFrame; } } $requests = $testStepResult->getRequests(); $ret['domains'] = $testStepResult->getDomainBreakdown(); $ret['breakdown'] = $testStepResult->getMimeTypeBreakdown(); // add requests if (!$this->hasInfoFlag(self::WITHOUT_REQUESTS)) { $ret['requests'] = $requests; } // Check to see if we're adding the console log if (!$this->hasInfoFlag(self::WITHOUT_CONSOLE)) { $console_log = $testStepResult->getConsoleLog(); if (isset($console_log)) { $ret['consoleLog'] = $console_log; } } $statusMessages = $testStepResult->getStatusMessages(); if ($statusMessages) { $ret['status'] = $statusMessages; return $ret; } return $ret; }
/** * Print a breakdown of the requests and bytes by mime type * @param TestStepResult $testResult Result data of affected run */ private function printMimeTypeBreakdown($testResult) { if (!$this->shouldPrintInfo(self::INFO_MIMETYPE_BREAKDOWN)) { return; } echo "<breakdown>\n"; $breakdown = $testResult->getMimeTypeBreakdown(); foreach ($breakdown as $mime => &$values) { echo "<{$mime}>\n"; echo "<requests>{$values['requests']}</requests>\n"; echo "<bytes>{$values['bytes']}</bytes>\n"; echo "</{$mime}>\n"; } echo "</breakdown>\n"; }