Ejemplo n.º 1
0
 public function testDisplay()
 {
     ob_start();
     $this->_object->display();
     $actualHtml = ob_get_clean();
     $expectedHtmlFile = __DIR__ . '/../_files/output.html';
     $this->assertStringEqualsFile($expectedHtmlFile, $actualHtml);
 }
Ejemplo n.º 2
0
 public function testDisplay()
 {
     ob_start();
     $this->_object->display();
     $actualHtml = ob_get_clean();
     $expectedString = file_get_contents(__DIR__ . '/../_files/output.html');
     $expectedString = ltrim(preg_replace('/^<!--.+?-->/s', '', $expectedString));
     $this->assertEquals($expectedString, $actualHtml);
 }
Ejemplo n.º 3
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);
 }