<?php

namespace Tests\Unit\Services\Administrator;

use App\Services\Administrator\AdministratorNotificationService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mockery;
use Tests\TestCase;

class AdministratorNotificationServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_delegates_to_subject_and_print_services(): void
    {
        $subject = Mockery::mock(\App\Services\Administrator\AdminNotificationSubjectService::class);
        $subject->shouldReceive('alertsData')->once()->andReturn(['admins' => []]);
        $subject->shouldReceive('save')->once()->andReturn(['success' => true]);

        $print = Mockery::mock(\App\Services\Administrator\AdminPrintRecipientService::class);
        $print->shouldReceive('data')->once()->andReturn(['admins' => []]);
        $print->shouldReceive('save')->once()->andReturn(['success' => true]);

        $service = new AdministratorNotificationService($subject, $print);

        $this->assertSame(['admins' => []], $service->notificationsAlertsData());
        $this->assertSame(['success' => true], $service->saveNotificationSubjects([]));
        $this->assertSame(['admins' => []], $service->printNotificationRecipientsData());
        $this->assertSame(['success' => true], $service->savePrintNotificationRecipients([]));
    }
}
