SendNotificationsHookTest.php 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\Message\Hook;
  4. use PHPUnit\Framework\TestCase;
  5. use think\Event;
  6. class SendNotificationsHookTest extends TestCase
  7. {
  8. protected SendNotificationsHook $sendNotifications;
  9. protected Event $event;
  10. protected function setUp(): void
  11. {
  12. $this->event = app()->get('event');
  13. $this->sendNotifications = app(SendNotificationsHook::class);
  14. }
  15. public function testHandle(): void
  16. {
  17. $this->event->trigger('message.send_notifications', [
  18. [
  19. 'user_id' => 1,
  20. 'title' => 'test',
  21. 'content' => 'test',
  22. 'type' => 2,
  23. ], [
  24. 'user_id' => 1,
  25. 'title' => 'test',
  26. 'content' => 'test',
  27. 'type' => 1,
  28. ],
  29. [
  30. 'user_id' => 1,
  31. 'title' => 'test',
  32. 'content' => 'test',
  33. 'type' => 5,
  34. ]
  35. ]);
  36. }
  37. }