fix gitlab tests
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdminNotificationSubjectService;
|
||||
use App\Services\Administrator\AdminNotificationUserService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
@@ -45,7 +44,7 @@ class AdminNotificationSubjectServiceTest extends TestCase
|
||||
'role_id' => 1,
|
||||
]);
|
||||
|
||||
$userService = new AdminNotificationUserService;
|
||||
$userService = new \App\Services\Administrator\AdminNotificationUserService();
|
||||
$service = new AdminNotificationSubjectService($userService);
|
||||
|
||||
$data = $service->alertsData();
|
||||
|
||||
@@ -66,7 +66,7 @@ class AdminNotificationUserServiceTest extends TestCase
|
||||
['id' => 2, 'user_id' => 2, 'role_id' => 2],
|
||||
]);
|
||||
|
||||
$service = new AdminNotificationUserService;
|
||||
$service = new AdminNotificationUserService();
|
||||
$admins = $service->fetchAdminNotificationUsers();
|
||||
|
||||
$this->assertCount(1, $admins);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdminNotificationUserService;
|
||||
use App\Services\Administrator\AdminPrintRecipientService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -51,7 +50,7 @@ class AdminPrintRecipientServiceTest extends TestCase
|
||||
'subject' => 'print_requests',
|
||||
]);
|
||||
|
||||
$service = new AdminPrintRecipientService(new AdminNotificationUserService);
|
||||
$service = new AdminPrintRecipientService(new \App\Services\Administrator\AdminNotificationUserService());
|
||||
$data = $service->data();
|
||||
|
||||
$this->assertTrue($data['assigned'][1]);
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Models\StaffAttendance;
|
||||
use App\Models\User;
|
||||
use App\Services\Administrator\AdministratorAbsenceService;
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use App\Services\SemesterRangeService;
|
||||
use App\Services\Semesters\SemesterConfigService;
|
||||
use App\Services\Staff\StaffTimeOffLinkService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\Request;
|
||||
use Mockery;
|
||||
@@ -20,17 +14,17 @@ class AdministratorAbsenceServiceTest extends TestCase
|
||||
|
||||
public function test_submit_requires_reason(): void
|
||||
{
|
||||
$shared = Mockery::mock(AdministratorSharedService::class);
|
||||
$shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
|
||||
$shared->shouldReceive('getSemester')->andReturn('Fall');
|
||||
$shared->shouldReceive('getSchoolYear')->andReturn('2025-2026');
|
||||
$shared->shouldReceive('allowedAbsenceDates')->andReturn(['2025-01-05']);
|
||||
|
||||
$service = new AdministratorAbsenceService(
|
||||
$shared,
|
||||
new User,
|
||||
new StaffAttendance,
|
||||
new SemesterRangeService(new SemesterConfigService),
|
||||
Mockery::mock(StaffTimeOffLinkService::class)
|
||||
new \App\Models\User(),
|
||||
new \App\Models\StaffAttendance(),
|
||||
new \App\Services\SemesterRangeService(new \App\Services\Semesters\SemesterConfigService()),
|
||||
Mockery::mock(\App\Services\Staff\StaffTimeOffLinkService::class)
|
||||
);
|
||||
|
||||
$request = Request::create('/absences', 'POST', ['dates' => ['2025-01-05']]);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorDashboardService;
|
||||
use App\Services\Administrator\AdministratorMetricsService;
|
||||
use App\Services\Administrator\AdministratorUserSearchService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -15,10 +13,10 @@ class AdministratorDashboardServiceTest extends TestCase
|
||||
|
||||
public function test_delegates_to_metrics_and_search(): void
|
||||
{
|
||||
$metrics = Mockery::mock(AdministratorMetricsService::class);
|
||||
$metrics = Mockery::mock(\App\Services\Administrator\AdministratorMetricsService::class);
|
||||
$metrics->shouldReceive('metrics')->once()->andReturn(['counts' => []]);
|
||||
|
||||
$search = Mockery::mock(AdministratorUserSearchService::class);
|
||||
$search = Mockery::mock(\App\Services\Administrator\AdministratorUserSearchService::class);
|
||||
$search->shouldReceive('search')->once()->with('john')->andReturn(['results' => []]);
|
||||
|
||||
$service = new AdministratorDashboardService($metrics, $search);
|
||||
|
||||
@@ -15,7 +15,7 @@ class AdministratorEnrollmentEventServiceTest extends TestCase
|
||||
{
|
||||
Event::fake();
|
||||
|
||||
$service = new AdministratorEnrollmentEventService;
|
||||
$service = new AdministratorEnrollmentEventService();
|
||||
$service->dispatchGroupedEvents([], [], [], '2025-2026');
|
||||
|
||||
Event::assertNotDispatched('studentEnrolled');
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Models\ClassSection;
|
||||
use App\Models\Enrollment;
|
||||
use App\Models\Student;
|
||||
use App\Models\StudentClass;
|
||||
use App\Services\Administrator\AdministratorEnrollmentQueryService;
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -18,17 +13,17 @@ class AdministratorEnrollmentQueryServiceTest extends TestCase
|
||||
|
||||
public function test_enrollment_withdrawal_data_returns_structure(): void
|
||||
{
|
||||
$shared = Mockery::mock(AdministratorSharedService::class);
|
||||
$shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
|
||||
$shared->shouldReceive('getSchoolYear')->andReturn('2025-2026');
|
||||
$shared->shouldReceive('getSemester')->andReturn('Fall');
|
||||
$shared->shouldReceive('getSchoolYearStartYear')->andReturn(2025);
|
||||
|
||||
$service = new AdministratorEnrollmentQueryService(
|
||||
$shared,
|
||||
new Student,
|
||||
new StudentClass,
|
||||
new Enrollment,
|
||||
new ClassSection
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\StudentClass(),
|
||||
new \App\Models\Enrollment(),
|
||||
new \App\Models\ClassSection()
|
||||
);
|
||||
|
||||
$data = $service->enrollmentWithdrawalData('2025-2026');
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorEnrollmentRefundService;
|
||||
use App\Services\FeeCalculationService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mockery;
|
||||
@@ -25,7 +24,7 @@ class AdministratorEnrollmentRefundServiceTest extends TestCase
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$feeCalc = Mockery::mock(FeeCalculationService::class);
|
||||
$feeCalc = Mockery::mock(\App\Services\FeeCalculationService::class);
|
||||
$service = new AdministratorEnrollmentRefundService($feeCalc);
|
||||
|
||||
$result = $service->processRefunds([10], '2025-2026', 1);
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorEnrollmentQueryService;
|
||||
use App\Services\Administrator\AdministratorEnrollmentService;
|
||||
use App\Services\Administrator\AdministratorEnrollmentStatusService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -15,11 +13,11 @@ class AdministratorEnrollmentServiceTest extends TestCase
|
||||
|
||||
public function test_delegates_to_query_and_status_services(): void
|
||||
{
|
||||
$query = Mockery::mock(AdministratorEnrollmentQueryService::class);
|
||||
$query = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentQueryService::class);
|
||||
$query->shouldReceive('enrollmentWithdrawalData')->once()->andReturn(['rows' => []]);
|
||||
$query->shouldReceive('newStudentsData')->once()->andReturn(['students' => []]);
|
||||
|
||||
$status = Mockery::mock(AdministratorEnrollmentStatusService::class);
|
||||
$status = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentStatusService::class);
|
||||
$status->shouldReceive('updateStatuses')->once()->andReturn(['success' => true]);
|
||||
|
||||
$service = new AdministratorEnrollmentService($query, $status);
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Models\Student;
|
||||
use App\Models\User;
|
||||
use App\Services\Administrator\AdministratorEnrollmentEventService;
|
||||
use App\Services\Administrator\AdministratorEnrollmentRefundService;
|
||||
use App\Services\Administrator\AdministratorEnrollmentStatusService;
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -18,17 +13,17 @@ class AdministratorEnrollmentStatusServiceTest extends TestCase
|
||||
|
||||
public function test_update_statuses_requires_payload(): void
|
||||
{
|
||||
$shared = Mockery::mock(AdministratorSharedService::class);
|
||||
$shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
|
||||
$shared->shouldReceive('getSchoolYear')->andReturn('2025-2026');
|
||||
$shared->shouldReceive('getSemester')->andReturn('Fall');
|
||||
|
||||
$refundService = Mockery::mock(AdministratorEnrollmentRefundService::class);
|
||||
$eventService = Mockery::mock(AdministratorEnrollmentEventService::class);
|
||||
$refundService = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentRefundService::class);
|
||||
$eventService = Mockery::mock(\App\Services\Administrator\AdministratorEnrollmentEventService::class);
|
||||
|
||||
$service = new AdministratorEnrollmentStatusService(
|
||||
$shared,
|
||||
new Student,
|
||||
new User,
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\User(),
|
||||
$refundService,
|
||||
$eventService
|
||||
);
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Models\Configuration;
|
||||
use App\Models\LoginActivity;
|
||||
use App\Models\User;
|
||||
use App\Services\Administrator\AdministratorMetricsService;
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
@@ -23,9 +19,9 @@ class AdministratorMetricsServiceTest extends TestCase
|
||||
]);
|
||||
|
||||
$service = new AdministratorMetricsService(
|
||||
new AdministratorSharedService(new Configuration),
|
||||
new User,
|
||||
new LoginActivity
|
||||
new \App\Services\Administrator\AdministratorSharedService(new \App\Models\Configuration()),
|
||||
new \App\Models\User(),
|
||||
new \App\Models\LoginActivity()
|
||||
);
|
||||
|
||||
$metrics = $service->metrics();
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorNotificationService;
|
||||
use App\Services\Administrator\AdminNotificationSubjectService;
|
||||
use App\Services\Administrator\AdminPrintRecipientService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -15,11 +13,11 @@ class AdministratorNotificationServiceTest extends TestCase
|
||||
|
||||
public function test_delegates_to_subject_and_print_services(): void
|
||||
{
|
||||
$subject = Mockery::mock(AdminNotificationSubjectService::class);
|
||||
$subject = Mockery::mock(\App\Services\Administrator\AdminNotificationSubjectService::class);
|
||||
$subject->shouldReceive('alertsData')->once()->andReturn(['admins' => []]);
|
||||
$subject->shouldReceive('save')->once()->andReturn(['success' => true]);
|
||||
|
||||
$print = Mockery::mock(AdminPrintRecipientService::class);
|
||||
$print = Mockery::mock(\App\Services\Administrator\AdminPrintRecipientService::class);
|
||||
$print->shouldReceive('data')->once()->andReturn(['admins' => []]);
|
||||
$print->shouldReceive('save')->once()->andReturn(['success' => true]);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Models\Configuration;
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
@@ -13,7 +12,7 @@ class AdministratorSharedServiceTest extends TestCase
|
||||
|
||||
public function test_get_previous_school_year(): void
|
||||
{
|
||||
$service = new AdministratorSharedService(new Configuration);
|
||||
$service = new AdministratorSharedService(new \App\Models\Configuration());
|
||||
|
||||
$this->assertSame('2024-2025', $service->getPreviousSchoolYear('2025-2026'));
|
||||
$this->assertSame('2024-25', $service->getPreviousSchoolYear('2025-26'));
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorTeacherSubmissionService;
|
||||
use App\Services\Administrator\TeacherSubmissionNotificationService;
|
||||
use App\Services\Administrator\TeacherSubmissionReportService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\Request;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -16,15 +13,15 @@ class AdministratorTeacherSubmissionServiceTest extends TestCase
|
||||
|
||||
public function test_delegates_to_report_and_notification(): void
|
||||
{
|
||||
$report = Mockery::mock(TeacherSubmissionReportService::class);
|
||||
$report = Mockery::mock(\App\Services\Administrator\TeacherSubmissionReportService::class);
|
||||
$report->shouldReceive('report')->once()->andReturn(['rows' => []]);
|
||||
|
||||
$notify = Mockery::mock(TeacherSubmissionNotificationService::class);
|
||||
$notify = Mockery::mock(\App\Services\Administrator\TeacherSubmissionNotificationService::class);
|
||||
$notify->shouldReceive('send')->once()->andReturn(['success' => true]);
|
||||
|
||||
$service = new AdministratorTeacherSubmissionService($report, $notify);
|
||||
|
||||
$this->assertSame(['rows' => []], $service->report());
|
||||
$this->assertSame(['success' => true], $service->sendNotifications(new Request, 1));
|
||||
$this->assertSame(['success' => true], $service->sendNotifications(new \Illuminate\Http\Request(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class AdministratorUserSearchServiceTest extends TestCase
|
||||
|
||||
public function test_empty_query_returns_no_results(): void
|
||||
{
|
||||
$service = new AdministratorUserSearchService;
|
||||
$service = new AdministratorUserSearchService();
|
||||
$result = $service->search('');
|
||||
|
||||
$this->assertSame('', $result['query']);
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use App\Services\Administrator\TeacherSubmissionNotificationService;
|
||||
use App\Services\Administrator\TeacherSubmissionSupportService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\Request;
|
||||
use Mockery;
|
||||
@@ -16,8 +14,8 @@ class TeacherSubmissionNotificationServiceTest extends TestCase
|
||||
|
||||
public function test_send_requires_targets(): void
|
||||
{
|
||||
$shared = Mockery::mock(AdministratorSharedService::class);
|
||||
$support = Mockery::mock(TeacherSubmissionSupportService::class);
|
||||
$shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
|
||||
$support = Mockery::mock(\App\Services\Administrator\TeacherSubmissionSupportService::class);
|
||||
|
||||
$service = new TeacherSubmissionNotificationService($shared, $support);
|
||||
$request = Request::create('/notify', 'POST', []);
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\Administrator;
|
||||
|
||||
use App\Services\Administrator\AdministratorSharedService;
|
||||
use App\Services\Administrator\TeacherSubmissionReportService;
|
||||
use App\Services\Administrator\TeacherSubmissionSupportService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -15,11 +13,11 @@ class TeacherSubmissionReportServiceTest extends TestCase
|
||||
|
||||
public function test_report_returns_summary(): void
|
||||
{
|
||||
$shared = Mockery::mock(AdministratorSharedService::class);
|
||||
$shared = Mockery::mock(\App\Services\Administrator\AdministratorSharedService::class);
|
||||
$shared->shouldReceive('getSemester')->andReturn('Fall');
|
||||
$shared->shouldReceive('getSchoolYear')->andReturn('2025-2026');
|
||||
|
||||
$support = Mockery::mock(TeacherSubmissionSupportService::class);
|
||||
$support = Mockery::mock(\App\Services\Administrator\TeacherSubmissionSupportService::class);
|
||||
$support->shouldReceive('submissionStatus')->andReturn([
|
||||
'label' => 'No students',
|
||||
'badge' => 'bg-secondary',
|
||||
|
||||
@@ -12,7 +12,7 @@ class TeacherSubmissionSupportServiceTest extends TestCase
|
||||
|
||||
public function test_submission_status_labels(): void
|
||||
{
|
||||
$service = new TeacherSubmissionSupportService;
|
||||
$service = new TeacherSubmissionSupportService();
|
||||
$status = $service->submissionStatus(3, 5);
|
||||
|
||||
$this->assertSame('Missing', $status['label']);
|
||||
@@ -21,7 +21,7 @@ class TeacherSubmissionSupportServiceTest extends TestCase
|
||||
|
||||
public function test_build_missing_items(): void
|
||||
{
|
||||
$service = new TeacherSubmissionSupportService;
|
||||
$service = new TeacherSubmissionSupportService();
|
||||
$items = $service->buildMissingItems([
|
||||
'attendance_status' => ['completed' => false],
|
||||
'midterm_score_status' => ['completed' => true],
|
||||
|
||||
Reference in New Issue
Block a user