|
8 | 8 | use App\Notifications\MentionNotification;
|
9 | 9 | use App\Rules\InvalidMentionRule;
|
10 | 10 | use Illuminate\Foundation\Testing\DatabaseMigrations;
|
| 11 | +use Illuminate\Foundation\Testing\RefreshDatabase; |
11 | 12 | use Illuminate\Notifications\DatabaseNotification;
|
12 | 13 | use Illuminate\Support\Facades\Notification;
|
13 | 14 | use Illuminate\Support\HtmlString;
|
14 | 15 | use Livewire\Livewire;
|
15 | 16 | use Tests\TestCase;
|
16 | 17 |
|
17 | 18 | uses(TestCase::class);
|
18 |
| -uses(DatabaseMigrations::class); |
| 19 | +uses(RefreshDatabase::class); |
19 | 20 |
|
20 | 21 | test('users can add a reply to a thread', function () {
|
21 | 22 | $thread = Thread::factory()->create(['subject' => 'The first thread', 'slug' => 'the-first-thread']);
|
|
75 | 76 | });
|
76 | 77 |
|
77 | 78 | test('users cannot delete a reply they do not own', function () {
|
78 |
| - Reply::factory()->create(); |
| 79 | + $reply = Reply::factory()->create(); |
79 | 80 |
|
80 | 81 | $this->login();
|
81 | 82 |
|
82 |
| - $this->delete('/replies/1') |
| 83 | + $this->delete("/replies/{$reply->id}") |
83 | 84 | ->assertForbidden();
|
84 | 85 | });
|
85 | 86 |
|
|
200 | 201 | 'replyable_id' => $thread->id,
|
201 | 202 | 'replyable_type' => Thread::TABLE,
|
202 | 203 | ]);
|
203 |
| - |
| 204 | + |
204 | 205 | $notification = DatabaseNotification::first();
|
205 | 206 | $this->assertSame($user->id, (int) $notification->notifiable_id);
|
206 | 207 | $this->assertSame('users', $notification->notifiable_type);
|
207 | 208 | $this->assertSame('mention', $notification->data['type']);
|
208 | 209 | $this->assertSame('The first thread', $notification->data['replyable_subject']);
|
209 |
| -}); |
| 210 | +})->only(); |
210 | 211 |
|
211 | 212 | test('users are not notified when mentioned in an edited reply', function () {
|
212 | 213 | Notification::fake();
|
|
0 commit comments