-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathFakeExceptionHandler.php
More file actions
40 lines (31 loc) Β· 892 Bytes
/
FakeExceptionHandler.php
File metadata and controls
40 lines (31 loc) Β· 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php declare(strict_types=1);
namespace Tests;
use Illuminate\Contracts\Debug\ExceptionHandler;
use PHPUnit\Framework\Assert;
use Symfony\Component\HttpFoundation\Response;
final class FakeExceptionHandler implements ExceptionHandler
{
/** @var array<\Throwable> */
private array $reported = [];
public function report(\Throwable $e): void
{
$this->reported[] = $e;
}
public function shouldReport(\Throwable $e): bool
{
return true;
}
public function assertNothingReported(): void
{
Assert::assertEmpty($this->reported);
}
public function assertReported(\Throwable $e): void
{
Assert::assertContainsEquals($e, $this->reported);
}
public function render($request, \Throwable $e): Response
{
throw $e;
}
public function renderForConsole($output, \Throwable $e): void {}
}