Skip to content

Commit 33879d1

Browse files
committed
chore: [LAR-131] fix phpstan and tests
1 parent fdbc834 commit 33879d1

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

app/Events/CommentWasAdded.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace App\Events;
66

7-
use App\Contracts\ReplyInterface;
87
use App\Models\Discussion;
98
use App\Models\Reply;
109
use Illuminate\Queue\SerializesModels;
@@ -13,5 +12,5 @@
1312
{
1413
use SerializesModels;
1514

16-
public function __construct(public Reply $reply, public Discussion|ReplyInterface $discussion) {}
15+
public function __construct(public Reply $reply, public Discussion $discussion) {}
1716
}

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parameters:
1212
# Remove this config after migrate everything to livewire
1313
- app/Http/Controllers/*
1414
- app/Markdown/*
15-
- app/Traits/HasSlug.php
15+
- app/Models/Traits/HasSlug.php
1616
ignoreErrors:
1717
- "#^Cannot access property \\$transaction on array\\|object\\.$#"
1818
- identifier: missingType.iterableValue

tests/Feature/Forum/DiscussionTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@
4747
it('generates a slug when valid url characters provided', function (): void {
4848
$discussion = Discussion::factory()->make(['slug' => 'Help with eloquent']);
4949

50-
expect($discussion->slug())->toEqual('help-with-eloquent');
50+
expect($discussion->slug)->toEqual('help-with-eloquent');
5151
});
5252

5353
it('generates a unique slug when valid url characters provided', function (): void {
5454
$discussionOne = Discussion::factory()->create(['slug' => 'Help with eloquent']);
5555
$discussionTwo = Discussion::factory()->create(['slug' => 'Help with eloquent']);
5656

57-
expect($discussionTwo->slug())->toEqual('help-with-eloquent-1');
57+
expect($discussionTwo->slug)->toEqual('help-with-eloquent-1');
5858
});
5959

6060
it('generates a slug when invalid url characters provided', function (): void {
6161
$discussion = Discussion::factory()->make(['slug' => '한글 테스트']);
6262

6363
// When providing a slug with invalid url characters, a random 5 character string is returned.
64-
expect($discussion->slug())->toMatch('/\w{5}/');
64+
expect($discussion->slug)->toMatch('/\w{5}/');
6565
});

tests/Feature/Forum/ThreadTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@
145145
it('generates a slug when valid url characters provided', function (): void {
146146
$thread = Thread::factory()->make(['slug' => 'Help with eloquent']);
147147

148-
expect($thread->slug())->toEqual('help-with-eloquent');
148+
expect($thread->slug)->toEqual('help-with-eloquent');
149149
});
150150

151151
it('generates a unique slug when valid url characters provided', function (): void {
152152
Thread::factory()->create(['slug' => 'Help with eloquent']);
153153
$thread = Thread::factory()->create(['slug' => 'Help with eloquent']);
154154

155-
expect($thread->slug())->toEqual('help-with-eloquent-1');
155+
expect($thread->slug)->toEqual('help-with-eloquent-1');
156156
});
157157

158158
it('generates a slug when invalid url characters provided', function (): void {
159159
$thread = Thread::factory()->make(['slug' => '한글 테스트']);
160160

161161
// When providing a slug with invalid url characters, a random 5 character string is returned.
162-
expect($thread->slug())->toMatch('/\w{5}/');
162+
expect($thread->slug)->toMatch('/\w{5}/');
163163
});

0 commit comments

Comments
 (0)