<?php

namespace Tests\Unit\Services\Administrator;

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

class AdministratorEnrollmentServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_delegates_to_query_and_status_services(): void
    {
        $query = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentQueryService::class);
        $query->shouldReceive('enrollmentWithdrawalData')->once()->andReturn(['rows' => []]);
        $query->shouldReceive('newStudentsData')->once()->andReturn(['students' => []]);

        $status = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentStatusService::class);
        $status->shouldReceive('updateStatuses')->once()->andReturn(['success' => true]);

        $service = new AdministratorEnrollmentService($query, $status);

        $this->assertSame(['rows' => []], $service->enrollmentWithdrawalData());
        $this->assertSame(['students' => []], $service->showNewStudentsData());
        $this->assertSame(['success' => true], $service->updateStatuses([], 1));
    }
}
