Skip to content

Commit a6dd039

Browse files
committed
Show "error" on failed statements
1 parent 371b1a3 commit a6dd039

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Database.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ protected function finalizeAddToDebug(
792792
) : void {
793793
$end = \microtime(true);
794794
$rows = $this->mysqli->affected_rows;
795-
$rows = $rows < 0 ? $rows . ' (failed)' : $rows;
795+
$rows = $rows < 0 ? 'error' : $rows;
796796
$this->debugCollector->addData([
797797
'start' => $start,
798798
'end' => $end,

tests/Debug/DatabaseCollectorTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ public function testFinalizeAddToDebug() : void
130130
$data = $this->collector->getData();
131131
$data = $data[\array_key_last($data)];
132132
self::assertSame('Foo Bar', $data['statement']);
133-
self::assertSame('-1 (failed)', $data['rows']);
133+
self::assertSame('error', $data['rows']);
134+
$contents = $this->collector->getContents();
135+
self::assertStringContainsString('error', $contents);
136+
self::assertStringContainsString(
137+
\htmlentities($data['description']),
138+
$contents
139+
);
134140
}
135141
}

0 commit comments

Comments
 (0)