8000 WIP [DebugBundle] Allow configuring a dumper while collecting dumps, add a default one writing to stderr when the cli-server is in use by nicolas-grekas · Pull Request #14373 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

WIP [DebugBundle] Allow configuring a dumper while collecting dumps, add a default one writing to stderr when the cli-server is in use #14373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[DebugBundle] Always collect dumps
  • Loading branch information
nicolas-grekas committed May 14, 2015
commit 04af67e33c9494cf3347ee47f56fa43cd755e0f2
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public function dump(Data $data)

if ($this->dumper) {
$this->doDump($data, $name, $file, $line);
} else {
$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount;
}

$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount;

if ($this->stopwatch) {
$this->stopwatch->stop('dump');
}
Expand All @@ -136,7 +136,7 @@ public function dump(Data $data)
public function collect(Request $request, Response $response, \Exception $exception = null)
{
// Sub-requests and programmatic calls stay in the collected profile.
if (($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
if ($this->dumper || ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) || $request->isXmlHttpRequest() || $request->headers->has('Origin')) {
return;
}

Expand All @@ -154,13 +154,9 @@ public function collect(Request $request, Response $response, \Exception $except
$this->dumper = new CliDumper('php://output', $this->charset);
}

foreach ($this->data as $i => $dump) {
$this->data[$i] = null;
foreach ($this->data as $dump) {
$this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
}

$this->data = array();
$this->dataCount = 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function testCollectDefault()
$output = ob_get_clean();

$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
$this->assertSame(1, $collector->getDumpsCount());
}

public function testCollectHtml()
Expand Down Expand Up @@ -99,6 +100,7 @@ public function testCollectHtml()
$output = preg_replace('/sf-dump-\d+/', 'sf-dump', $output);

$this->assertSame($xOutput, $output);
$this->assertSame(1, $collector->getDumpsCount());
}

public function testFlush()
Expand Down
0