public function DumpDataCollectorTest::testCollectHtml in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php \Symfony\Component\HttpKernel\Tests\DataCollector\DumpDataCollectorTest::testCollectHtml()
File
- vendor/
symfony/ http-kernel/ Tests/ DataCollector/ DumpDataCollectorTest.php, line 83
Class
- DumpDataCollectorTest
- @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\HttpKernel\Tests\DataCollectorCode
public function testCollectHtml() {
$data = new Data(array(
array(
123,
),
));
$collector = new DumpDataCollector(null, 'test://%f:%l');
$collector
->dump($data);
$line = __LINE__ - 1;
$file = __FILE__;
if (PHP_VERSION_ID >= 50400) {
$xOutput = <<<EOTXT
<pre class=sf-dump id=sf-dump data-indent-pad=" "><a href="test://{<span class="php-variable">$file</span>}:{<span class="php-variable">$line</span>}" title="{<span class="php-variable">$file</span>}"><span class=sf-dump-meta>DumpDataCollectorTest.php</span></a> on line <span class=sf-dump-meta>{<span class="php-variable">$line</span>}</span>:
<span class=sf-dump-num>123</span>
</pre>
EOTXT;
}
else {
$len = strlen("DumpDataCollectorTest.php on line {$line}:");
$xOutput = <<<EOTXT
<pre class=sf-dump id=sf-dump data-indent-pad=" ">"<span class=sf-dump-str title="{<span class="php-variable">$len</span>} characters">DumpDataCollectorTest.php on line {<span class="php-variable">$line</span>}:</span>"
</pre>
<pre class=sf-dump id=sf-dump data-indent-pad=" "><span class=sf-dump-num>123</span>
</pre>
EOTXT;
}
ob_start();
$response = new Response();
$response->headers
->set('Content-Type', 'text/html');
$collector
->collect(new Request(), $response);
$output = ob_get_clean();
$output = preg_replace('#<(script|style).*?</\\1>#s', '', $output);
$output = preg_replace('/sf-dump-\\d+/', 'sf-dump', $output);
$this
->assertSame($xOutput, $output);
$this
->assertSame(1, $collector
->getDumpsCount());
$collector
->serialize();
}