···21212222 public static function dispatch(Message $message)
2323 {
2424+ // TODO: how to test Octane tasks?
2425 DB::afterCommit(fn () => Octane::tasks()->dispatch([new static($message)]));
2526 }
2627
-22
tests/Models/Chat/ChannelTest.php
···190190 Event::assertNotDispatched(ChatChannelEvent::class);
191191 }
192192193193- public function testHiddenChannelReceiveMessage()
194194- {
195195- Event::fake();
196196-197197- $user = User::factory()->withGroup('announce')->create();
198198- $otherUsers = User::factory()->count(2)->create();
199199- $channel = $this->createChannel([$user, ...$otherUsers], 'announce');
200200- $channel->userChannels()->whereIn('user_id', $otherUsers->pluck('user_id'))->update(['hidden' => true]);
201201-202202- // Don't care about the ones from createChannel.
203203- app(BroadcastsPendingForTests::class)->reset();
204204-205205- $channel->receiveMessage($user, 'test');
206206-207207- $broadcastsPending = app(BroadcastsPendingForTests::class)->dispatched(
208208- ChatChannelEvent::class,
209209- fn (ChatChannelEvent $event) => $event->action === 'join' && $otherUsers->find($event->user)
210210- );
211211- $this->assertSame($otherUsers->count(), count($broadcastsPending));
212212- Event::assertNotDispatched(ChatChannelEvent::class);
213213- }
214214-215193 public function testPmChannelIcon()
216194 {
217195 Storage::fake('local-avatar');