Files
alrahma_sunday_school_api/tests/Unit/Services/AttendanceTracking/AttendanceNotificationLogServiceTest.php
T
2026-03-08 16:33:24 -04:00

46 lines
1.4 KiB
PHP

<?php
namespace Tests\Unit\Services\AttendanceTracking;
use App\Models\ParentNotification;
use App\Services\AttendanceNotificationLogService;
use Mockery;
use Tests\TestCase;
class AttendanceNotificationLogServiceTest extends TestCase
{
protected function tearDown(): void
{
Mockery::close();
parent::tearDown();
}
public function test_notification_already_sent_returns_true_when_model_has_sent_returns_true(): void
{
$model = Mockery::mock(ParentNotification::class);
$model->shouldReceive('hasSent')
->once()
->with(10, 'ABS_1', '2026-03-01', 'email', 'parent@example.com')
->andReturn(true);
$service = new AttendanceNotificationLogService($model);
$this->assertTrue(
$service->notificationAlreadySent(10, 'ABS_1', '2026-03-01', 'email', 'parent@example.com')
);
}
public function test_notification_already_sent_returns_false_when_model_has_sent_returns_false(): void
{
$model = Mockery::mock(ParentNotification::class);
$model->shouldReceive('hasSent')
->once()
->andReturn(false);
$service = new AttendanceNotificationLogService($model);
$this->assertFalse(
$service->notificationAlreadySent(10, 'ABS_1', '2026-03-01', 'email', 'parent@example.com')
);
}
}