Skip to content

Commit 0253cfe

Browse files
committed
patch(tests): falling test
1 parent 6102ab2 commit 0253cfe

File tree

3 files changed

+6
-53
lines changed

3 files changed

+6
-53
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ parameters:
55
level: 5
66
paths:
77
- src
8-
- config
9-
- database
108
tmpDir: build/phpstan
119
checkOctaneCompatibility: true
1210
checkModelProperties: true

src/SlackLogging.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getExceptionData(\Throwable $exception): array
6262
$data['host'] = Request::server('SERVER_NAME');
6363
$data['method'] = Request::method();
6464
$data['fullUrl'] = Request::fullUrl();
65-
$data['exception'] = $exception->getMessage() ?? '-';
65+
$data['exception'] = $exception->getMessage();
6666
$data['error'] = $exception->getTraceAsString();
6767
$data['line'] = $exception->getLine();
6868
$data['file'] = $exception->getFile();
@@ -212,13 +212,11 @@ private function createExceptionString(array $data): string
212212

213213
public function getUser(): ?array
214214
{
215-
if (function_exists('auth') && (app() instanceof Application && auth()->check())) {
216-
/** @var \Illuminate\Contracts\Auth\Authenticatable $user */
217-
$user = auth()->user();
215+
/** @var \Illuminate\Contracts\Auth\Authenticatable $user */
216+
$user = auth()->user();
218217

219-
if ($user instanceof Model) {
220-
return $user->toArray();
221-
}
218+
if ($user instanceof Model) {
219+
return $user->toArray();
222220
}
223221

224222
return null;

src/SlackLoggingFake.php

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,14 @@
66

77
class SlackLoggingFake extends SlackLogging
88
{
9-
/** @var class-string[] */
9+
/** @var class-string[][] */
1010
public array $exceptions = [];
1111

1212
public function assertRequestsSent(int $expectedCount): void
1313
{
1414
PHPUnit::assertCount($expectedCount, $this->exceptions);
1515
}
1616

17-
/**
18-
* @param mixed $throwable
19-
* @param callable|null $callback
20-
*/
21-
public function assertNotSent($throwable, $callback = null): void
22-
{
23-
$collect = collect($this->exceptions[$throwable] ?? []);
24-
25-
$callback = $callback ?: function () {
26-
return true;
27-
};
28-
29-
$filtered = $collect->filter(function ($arguments) use ($callback) {
30-
return $callback($arguments);
31-
});
32-
33-
PHPUnit::assertTrue($filtered->count() == 0);
34-
}
35-
36-
public function assertNothingSent(): void
37-
{
38-
PHPUnit::assertCount(0, $this->exceptions);
39-
}
40-
41-
/**
42-
* @param mixed $throwable
43-
* @param callable|null $callback
44-
*/
45-
public function assertSent($throwable, $callback = null): void
46-
{
47-
$collect = collect($this->exceptions[$throwable] ?? []);
48-
49-
$callback = $callback ?: function () {
50-
return true;
51-
};
52-
53-
$filtered = $collect->filter(function ($arguments) use ($callback) {
54-
return $callback($arguments);
55-
});
56-
57-
PHPUnit::assertTrue($filtered->count() > 0);
58-
}
59-
6017
public function handle(\Throwable $exception): bool
6118
{
6219
$this->exceptions[get_class($exception)][] = $exception;

0 commit comments

Comments
 (0)