public function testDisplay()
 {
     $this->markTestSkipped('Remove it when task(MAGETWO-33495) will be fixed');
     $this->_response->expects($this->atLeastOnce())->method('sendHeaders');
     $this->_request->expects($this->atLeastOnce())->method('getHeader');
     $stat = (include __DIR__ . '/_files/timers.php');
     $this->_output->display($stat);
     $actualHeaders = $this->_response->getHeaders();
     $this->assertNotEmpty($actualHeaders);
     $actualProtocol = false;
     $actualProfilerData = false;
     foreach ($actualHeaders as $oneHeader) {
         $headerName = $oneHeader->getFieldName();
         $headerValue = $oneHeader->getFieldValue();
         if (!$actualProtocol && $headerName == 'X-Wf-Protocol-1') {
             $actualProtocol = $headerValue;
         }
         if (!$actualProfilerData && $headerName == 'X-Wf-1-1-1-1') {
             $actualProfilerData = $headerValue;
         }
     }
     $this->assertNotEmpty($actualProtocol, 'Cannot get protocol header');
     $this->assertNotEmpty($actualProfilerData, 'Cannot get profiler header');
     $this->assertContains('Protocol/JsonStream', $actualProtocol);
     $this->assertRegExp('/"Type":"TABLE","Label":"Code Profiler \\(Memory usage: real - \\d+, emalloc - \\d+\\)"/', $actualProfilerData);
     $this->assertContains('[' . '["Timer Id","Time","Avg","Cnt","Emalloc","RealMem"],' . '["root","0.080000","0.080000","1","1,000","50,000"],' . '[". init","0.040000","0.040000","1","200","2,500"],' . '[". . init_store","0.020000","0.010000","2","100","2,000"],' . '["system","0.030000","0.015000","2","400","20,000"]' . ']', $actualProfilerData);
 }
Beispiel #2
0
 public function testDisplay()
 {
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 with FirePHP/1.6';
     $this->_response->expects($this->atLeastOnce())->method('sendHeaders');
     $this->_object->display();
     $actualHeaders = $this->_response->getHeaders();
     $this->assertNotEmpty($actualHeaders);
     $actualProtocol = false;
     $actualProfilerData = false;
     foreach ($actualHeaders as $oneHeader) {
         $headerName = $oneHeader['name'];
         $headerValue = $oneHeader['value'];
         if (!$actualProtocol && $headerName == 'X-Wf-Protocol-1') {
             $actualProtocol = $headerValue;
         }
         if (!$actualProfilerData && $headerName == 'X-Wf-1-1-1-1') {
             $actualProfilerData = $headerValue;
         }
     }
     $this->assertContains('Protocol/JsonStream', $actualProtocol);
     $this->assertContains('"Type":"TABLE","Label":"Code Profiler Title"', $actualProfilerData);
     $this->assertContains('[' . '["Timer Id","Time","Avg","Cnt","Emalloc","RealMem"],' . '["some_root_timer","0.080000","0.040000","2","51,000,000","50,000,000"],' . '[". some_nested_timer","0.080000","0.026667","3","42,000,000","40,000,000"],' . '[". . some_deeply_nested_timer","0.030000","0.010000","3","13,000,000","10,000,000"],' . '["one_more_root_timer","0.010000","0.010000","1","23,456,789","12,345,678"]]', $actualProfilerData);
 }