|  | 
| 6 | 6 | 
 | 
| 7 | 7 | use App\Filament\Resources\ThreadResource; | 
| 8 | 8 | use App\Filament\Resources\ThreadResource\Pages\ListThreads; | 
|  | 9 | +use App\Models\Channel; | 
| 9 | 10 | use App\Models\Thread; | 
| 10 | 11 | use Illuminate\Database\Eloquent\Factories\Sequence; | 
| 11 | 12 | use Livewire\Livewire; | 
| 12 | 13 | 
 | 
| 13 | 14 | beforeEach(function (): void { | 
| 14 | 15 |     $this->user = $this->login(); | 
| 15 | 16 |     $this->ActingAs($this->user); | 
| 16 |  | -    $this->threads = Thread::factory()->count(10)->state( | 
|  | 17 | +    $this->threads = Thread::factory()->count(2)->state( | 
| 17 | 18 |         new Sequence( | 
| 18 | 19 |             ['locked' => false], | 
| 19 | 20 |             ['locked' => true] | 
|  | 
| 28 | 29 |         Livewire::test(ThreadResource\Pages\ListThreads::class) | 
| 29 | 30 |             ->assertCanSeeTableRecords($this->threads); | 
| 30 | 31 |     }); | 
| 31 |  | - | 
| 32 |  | -    it('can filter thread by `user_id`', function (): void { | 
| 33 |  | -        $authorId = $this->threads->first()->user_id; | 
| 34 |  | -        Livewire::test(ListThreads::class) | 
| 35 |  | -            ->assertCanSeeTableRecords($this->threads) | 
| 36 |  | -            ->filterTable('Auteur', $authorId) | 
| 37 |  | -            ->assertCanSeeTableRecords($this->threads->where('user_id', $authorId)) | 
| 38 |  | -            ->assertCanNotSeeTableRecords($this->threads->where('user_id', '!=', $authorId)); | 
| 39 |  | -    }); | 
| 40 |  | - | 
| 41 |  | -    it('can redirect to thread page ', function (): void { | 
| 42 |  | -        $thread = $this->threads->first(); | 
| 43 |  | -        Livewire::test(ListThreads::class) | 
| 44 |  | -            ->callTableAction('view_thread', $thread) | 
| 45 |  | -            ->assertRedirect(route('forum.show', $thread)); | 
| 46 |  | -    }); | 
| 47 | 32 | })->group('threads'); | 
0 commit comments