[HttpKernel] DumpDataCollector: do not flush when a dumper is provided
This commit is contained in:
parent
2349e977ff
commit
11a0392516
@ -67,7 +67,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||||||
if ($this->stopwatch) {
|
if ($this->stopwatch) {
|
||||||
$this->stopwatch->start('dump');
|
$this->stopwatch->start('dump');
|
||||||
}
|
}
|
||||||
if ($this->isCollected) {
|
if ($this->isCollected && !$this->dumper) {
|
||||||
$this->isCollected = false;
|
$this->isCollected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\VarDumper\Cloner\Data;
|
use Symfony\Component\VarDumper\Cloner\Data;
|
||||||
|
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
@ -130,4 +131,24 @@ EOTXT;
|
|||||||
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
|
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFlushNothingWhenDataDumperIsProvided()
|
||||||
|
{
|
||||||
|
$data = new Data(array(array(456)));
|
||||||
|
$dumper = new CliDumper('php://output');
|
||||||
|
$collector = new DumpDataCollector(null, null, null, null, $dumper);
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$collector->dump($data);
|
||||||
|
$line = __LINE__ - 1;
|
||||||
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
|
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
|
||||||
|
} else {
|
||||||
|
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$collector->__destruct();
|
||||||
|
$this->assertEmpty(ob_get_clean());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user