SendNotificationsHookTest.php 802 B

1234567891011121314151617181920212223242526272829303132333435
  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' => 5,
  23. 'template_code' => 'fasfsad',
  24. 'template_context' => ['abd'=>123],
  25. ]
  26. ]);
  27. }
  28. }