add notifications logic and add support of both JWT and Sanctum
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Whatsapp;
|
||||
|
||||
use App\Services\EmailService;
|
||||
use App\Services\Whatsapp\WhatsappInviteEmailService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WhatsappInviteEmailServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_send_requires_recipients(): void
|
||||
{
|
||||
$service = new WhatsappInviteEmailService(Mockery::mock(EmailService::class));
|
||||
$result = $service->send([]);
|
||||
|
||||
$this->assertFalse($result['ok']);
|
||||
}
|
||||
|
||||
public function test_send_dispatches_email(): void
|
||||
{
|
||||
$email = Mockery::mock(EmailService::class);
|
||||
$email->shouldReceive('send')->once()->andReturn(true);
|
||||
|
||||
$service = new WhatsappInviteEmailService($email);
|
||||
$result = $service->send([
|
||||
'to_emails' => ['parent@example.com'],
|
||||
'sections' => [
|
||||
[
|
||||
'class_section_id' => 1,
|
||||
'class_section_name' => 'Class A',
|
||||
'invite_link' => 'https://chat.whatsapp.com/test',
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertTrue($result['ok']);
|
||||
$this->assertSame(1, $result['recipients']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user