add test batches
This commit is contained in:
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use App\Models\AttendanceTracking;
|
||||
use App\Models\Student;
|
||||
use App\Services\AttendanceTracking\AttendanceCaseQueryService;
|
||||
use App\Services\AttendanceTracking\AttendanceParentLookupService;
|
||||
use App\Services\AttendanceTracking\ViolationRuleEngineService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -19,11 +14,11 @@ class AttendanceCaseQueryServiceTest extends TestCase
|
||||
public function test_returns_not_found_when_student_missing(): void
|
||||
{
|
||||
$service = new AttendanceCaseQueryService(
|
||||
new Student,
|
||||
new AttendanceData,
|
||||
new AttendanceTracking,
|
||||
Mockery::mock(ViolationRuleEngineService::class),
|
||||
Mockery::mock(AttendanceParentLookupService::class)
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\AttendanceData(),
|
||||
new \App\Models\AttendanceTracking(),
|
||||
Mockery::mock(\App\Services\AttendanceTracking\ViolationRuleEngineService::class),
|
||||
Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class)
|
||||
);
|
||||
|
||||
$result = $service->getStudentCase(999);
|
||||
|
||||
+5
-10
@@ -2,12 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Student;
|
||||
use App\Services\AttendanceTracking\AttendanceCommunicationSupportService;
|
||||
use App\Services\AttendanceTracking\AttendanceEmailComposerService;
|
||||
use App\Services\AttendanceTracking\AttendanceParentLookupService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mockery;
|
||||
@@ -54,13 +49,13 @@ class AttendanceCommunicationSupportServiceTest extends TestCase
|
||||
|
||||
private function makeService(): AttendanceCommunicationSupportService
|
||||
{
|
||||
$parentLookup = Mockery::mock(AttendanceParentLookupService::class);
|
||||
$emailComposer = Mockery::mock(AttendanceEmailComposerService::class);
|
||||
$parentLookup = Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class);
|
||||
$emailComposer = Mockery::mock(\App\Services\AttendanceTracking\AttendanceEmailComposerService::class);
|
||||
|
||||
return new AttendanceCommunicationSupportService(
|
||||
new Student,
|
||||
new AttendanceData,
|
||||
new Configuration,
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\AttendanceData(),
|
||||
new \App\Models\Configuration(),
|
||||
$parentLookup,
|
||||
$emailComposer
|
||||
);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceEmailTemplate;
|
||||
use App\Services\AttendanceTracking\AttendanceEmailComposerService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -22,7 +21,7 @@ class AttendanceEmailComposerServiceTest extends TestCase
|
||||
'is_active' => 1,
|
||||
]);
|
||||
|
||||
$service = new AttendanceEmailComposerService(new AttendanceEmailTemplate);
|
||||
$service = new AttendanceEmailComposerService(new \App\Models\AttendanceEmailTemplate());
|
||||
$context = ['{{student_name}}' => 'Student A', '{{parent_name}}' => 'Parent A'];
|
||||
$rendered = $service->renderTemplate('ABS_1', 'default', $context);
|
||||
|
||||
@@ -32,7 +31,7 @@ class AttendanceEmailComposerServiceTest extends TestCase
|
||||
|
||||
public function test_pick_variant_fallback(): void
|
||||
{
|
||||
$service = new AttendanceEmailComposerService(new AttendanceEmailTemplate);
|
||||
$service = new AttendanceEmailComposerService(new \App\Models\AttendanceEmailTemplate());
|
||||
$this->assertSame('no_answer', $service->pickVariant('ABS_2'));
|
||||
$this->assertSame('default', $service->pickVariant('ABS_1'));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\ParentNotification;
|
||||
use App\Services\AttendanceTracking\AttendanceNotificationLogService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -14,7 +13,7 @@ class AttendanceNotificationLogServiceTest extends TestCase
|
||||
|
||||
public function test_log_notification_creates_and_updates(): void
|
||||
{
|
||||
$service = new AttendanceNotificationLogService(new ParentNotification);
|
||||
$service = new AttendanceNotificationLogService(new \App\Models\ParentNotification());
|
||||
|
||||
$service->logNotification(1, 'ABS_1', '2025-01-01', 'email', 'parent@example.com', 'Subject', 'sent');
|
||||
$this->assertDatabaseHas('parent_notifications', [
|
||||
|
||||
+10
-20
@@ -2,17 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use App\Models\AttendanceTracking;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Student;
|
||||
use App\Models\StudentClass;
|
||||
use App\Services\AttendanceTracking\AttendanceEmailComposerService;
|
||||
use App\Services\AttendanceTracking\AttendanceMailerService;
|
||||
use App\Services\AttendanceTracking\AttendanceNotificationLogService;
|
||||
use App\Services\AttendanceTracking\AttendanceNotificationWorkflowService;
|
||||
use App\Services\AttendanceTracking\AttendanceParentLookupService;
|
||||
use App\Services\AttendanceTracking\ViolationRuleEngineService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mockery;
|
||||
@@ -37,20 +27,20 @@ class AttendanceNotificationWorkflowServiceTest extends TestCase
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$parentLookup = Mockery::mock(AttendanceParentLookupService::class);
|
||||
$parentLookup = Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class);
|
||||
$parentLookup->shouldReceive('getPrimaryParentForStudent')->once()->andReturn([]);
|
||||
|
||||
$service = new AttendanceNotificationWorkflowService(
|
||||
new Student,
|
||||
new StudentClass,
|
||||
new AttendanceData,
|
||||
new AttendanceTracking,
|
||||
new Configuration,
|
||||
Mockery::mock(AttendanceMailerService::class),
|
||||
Mockery::mock(ViolationRuleEngineService::class),
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\StudentClass(),
|
||||
new \App\Models\AttendanceData(),
|
||||
new \App\Models\AttendanceTracking(),
|
||||
new \App\Models\Configuration(),
|
||||
Mockery::mock(\App\Services\AttendanceTracking\AttendanceMailerService::class),
|
||||
Mockery::mock(\App\Services\AttendanceTracking\ViolationRuleEngineService::class),
|
||||
$parentLookup,
|
||||
Mockery::mock(AttendanceEmailComposerService::class),
|
||||
Mockery::mock(AttendanceNotificationLogService::class)
|
||||
Mockery::mock(\App\Services\AttendanceTracking\AttendanceEmailComposerService::class),
|
||||
Mockery::mock(\App\Services\AttendanceTracking\AttendanceNotificationLogService::class)
|
||||
);
|
||||
|
||||
$result = $service->record([
|
||||
|
||||
@@ -47,7 +47,7 @@ class AttendanceParentLookupServiceTest extends TestCase
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new AttendanceParentLookupService;
|
||||
$service = new AttendanceParentLookupService();
|
||||
$parent = $service->getPrimaryParentForStudent(1);
|
||||
|
||||
$this->assertSame('parent@example.com', $parent['email']);
|
||||
@@ -80,7 +80,7 @@ class AttendanceParentLookupServiceTest extends TestCase
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new AttendanceParentLookupService;
|
||||
$service = new AttendanceParentLookupService();
|
||||
$parent = $service->getSecondaryParentForStudent(1, '2025-2026');
|
||||
|
||||
$this->assertSame('second@example.com', $parent['email']);
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use App\Services\AttendanceTracking\AttendancePendingViolationService;
|
||||
use App\Services\AttendanceTracking\AttendanceViolationStudentResolverService;
|
||||
use App\Services\AttendanceTracking\ViolationRuleEngineService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
@@ -16,7 +13,7 @@ class AttendancePendingViolationServiceTest extends TestCase
|
||||
|
||||
public function test_returns_error_when_no_students(): void
|
||||
{
|
||||
$resolver = Mockery::mock(AttendanceViolationStudentResolverService::class);
|
||||
$resolver = Mockery::mock(\App\Services\AttendanceTracking\AttendanceViolationStudentResolverService::class);
|
||||
$resolver->shouldReceive('resolveForSchoolYear')->andReturn([
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
@@ -28,10 +25,10 @@ class AttendancePendingViolationServiceTest extends TestCase
|
||||
'debug' => [],
|
||||
]);
|
||||
|
||||
$engine = Mockery::mock(ViolationRuleEngineService::class);
|
||||
$engine = Mockery::mock(\App\Services\AttendanceTracking\ViolationRuleEngineService::class);
|
||||
|
||||
$service = new AttendancePendingViolationService(
|
||||
new AttendanceData,
|
||||
new \App\Models\AttendanceData(),
|
||||
$engine,
|
||||
$resolver
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ class AttendanceTrackingServiceTest extends TestCase
|
||||
|
||||
public function test_service_instantiates(): void
|
||||
{
|
||||
$service = new AttendanceTrackingService;
|
||||
$service = new AttendanceTrackingService();
|
||||
$this->assertInstanceOf(AttendanceTrackingService::class, $service);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-6
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceData;
|
||||
use App\Models\Student;
|
||||
use App\Models\StudentClass;
|
||||
use App\Services\AttendanceTracking\AttendanceViolationStudentResolverService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -37,9 +34,9 @@ class AttendanceViolationStudentResolverServiceTest extends TestCase
|
||||
]);
|
||||
|
||||
$service = new AttendanceViolationStudentResolverService(
|
||||
new Student,
|
||||
new StudentClass,
|
||||
new AttendanceData
|
||||
new \App\Models\Student(),
|
||||
new \App\Models\StudentClass(),
|
||||
new \App\Models\AttendanceData()
|
||||
);
|
||||
|
||||
$result = $service->resolveForSchoolYear('2025-2026', 'Fall');
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Tests\Unit\Services\AttendanceTracking;
|
||||
|
||||
use App\Models\AttendanceTracking;
|
||||
use App\Services\AttendanceTracking\AttendanceParentLookupService;
|
||||
use App\Services\AttendanceTracking\ViolationRuleEngineService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Mockery;
|
||||
@@ -32,8 +30,8 @@ class ViolationRuleEngineServiceTest extends TestCase
|
||||
|
||||
private function makeService(): ViolationRuleEngineService
|
||||
{
|
||||
$tracking = new AttendanceTracking;
|
||||
$parentLookup = Mockery::mock(AttendanceParentLookupService::class);
|
||||
$tracking = new \App\Models\AttendanceTracking();
|
||||
$parentLookup = Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class);
|
||||
|
||||
return new ViolationRuleEngineService($tracking, $parentLookup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user