Skip to content

Commit 87e627a

Browse files
committed
Fix tests
1 parent d848222 commit 87e627a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/DebugBar/JavascriptRenderer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ public function renderHead()
947947
}
948948

949949
foreach ($inlineJs as $content) {
950-
$html .= sprintf('<script type="text/javascript" %s>%s</script>' . "\n", $nonce, $content);
950+
$html .= sprintf('<script type="text/javascript"%s>%s</script>' . "\n", $nonce, $content);
951951
}
952952

953953
foreach ($inlineHead as $content) {
@@ -1045,9 +1045,9 @@ public function render($initialize = true, $renderStackedData = true)
10451045
$nonce = $this->getNonceAttribute();
10461046

10471047
if ($this->useRequireJs){
1048-
return "<script type=\"text/javascript\" {$nonce}>\nrequire(['debugbar'], function(PhpDebugBar){ $js });\n</script>\n";
1048+
return "<script type=\"text/javascript\"{$nonce}>\nrequire(['debugbar'], function(PhpDebugBar){ $js });\n</script>\n";
10491049
} else {
1050-
return "<script type=\"text/javascript\" {$nonce}>\n$js\n</script>\n";
1050+
return "<script type=\"text/javascript\"{$nonce}>\n$js\n</script>\n";
10511051
}
10521052

10531053
}
@@ -1188,7 +1188,7 @@ protected function getAddDatasetCode($requestId, $data, $suffix = null)
11881188
protected function getNonceAttribute()
11891189
{
11901190
if ($nonce = $this->getCspNonce()) {
1191-
return 'nonce="' . $nonce .'"';
1191+
return ' nonce="' . $nonce .'"';
11921192
}
11931193

11941194
return '';

tests/DebugBar/Tests/DataCollector/TimeDataCollectorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function testAddMeasure()
2727
public function testStartStopMeasure()
2828
{
2929
$this->c->startMeasure('foo', 'bar', 'baz');
30+
usleep(1000);
3031
$this->c->stopMeasure('foo', array('bar' => 'baz'));
3132
$m = $this->c->getMeasures();
3233
$this->assertCount(1, $m);

tests/DebugBar/Tests/JavascriptRendererTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testRenderFullInitialization()
124124
{
125125
$this->debugbar->addCollector(new \DebugBar\DataCollector\MessagesCollector());
126126
$this->r->addControl('time', array('icon' => 'time', 'map' => 'time', 'default' => '"0s"'));
127-
$expected = rtrim(file_get_contents(__DIR__ . '/full_init.html'));
127+
$expected = str_replace("\r\n", "\n", rtrim(file_get_contents(__DIR__ . '/full_init.html')));
128128
$this->assertStringStartsWith($expected, $this->r->render());
129129
}
130130

0 commit comments

Comments
 (0)