update tests

This commit is contained in:
root
2026-06-08 22:06:30 -04:00
parent 79024235ef
commit 60ecacb7f8
54 changed files with 13243 additions and 5561 deletions
@@ -19,7 +19,7 @@ class NotificationUserListServiceTest extends TestCase
'title' => 'Unread',
'message' => 'Message 1',
'target_group' => 'parent',
'delivery_channels' => json_encode(['in_app']),
'delivery_channels' => 'in_app',
'scheduled_at' => now()->subHour(),
'created_at' => now(),
'updated_at' => now(),
@@ -29,7 +29,7 @@ class NotificationUserListServiceTest extends TestCase
'title' => 'Read',
'message' => 'Message 2',
'target_group' => 'parent',
'delivery_channels' => json_encode(['in_app']),
'delivery_channels' => 'in_app',
'scheduled_at' => now()->subHours(2),
'created_at' => now(),
'updated_at' => now(),
@@ -17,6 +17,9 @@ class ParentAttendanceReportServiceTest extends TestCase
public function test_form_data_returns_students(): void
{
// Pin calendar so upcoming Sundays exist within the 2025-2026 school year.
$this->travelTo('2025-10-05 10:00:00');
$this->seedConfig();
$parentId = $this->seedParent();
$this->seedStudent($parentId);
@@ -2,6 +2,7 @@
namespace Tests\Unit\Services\Payments;
use App\Services\ApplicationUrlService;
use App\Services\Payments\PaymentEnrollmentEventService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
@@ -11,9 +12,14 @@ class PaymentEnrollmentEventServiceTest extends TestCase
{
use RefreshDatabase;
private function makeService(): PaymentEnrollmentEventService
{
return new PaymentEnrollmentEventService(new ApplicationUrlService());
}
public function test_build_event_data_requires_parent(): void
{
$service = new PaymentEnrollmentEventService();
$service = $this->makeService();
$this->expectException(\RuntimeException::class);
@@ -43,7 +49,7 @@ class PaymentEnrollmentEventServiceTest extends TestCase
'school_year' => '2025-2026',
]);
$service = new PaymentEnrollmentEventService();
$service = $this->makeService();
[$parent, $students] = $service->buildEventData(10, [], '2025-2026', 'Fall', 'https://example.test/login');
$this->assertSame(10, $parent['user_id']);
@@ -23,7 +23,16 @@ class PaymentMissedCheckServiceTest extends TestCase
'id' => 1,
'firstname' => 'Parent',
'lastname' => 'Late',
'cellphone' => '5551112222',
'email' => 'late@example.com',
'address_street' => '123 Main',
'city' => 'City',
'state' => 'ST',
'zip' => '12345',
'accept_school_policy' => 1,
'password' => bcrypt('secret'),
'semester' => 'Spring',
'school_year' => '2024-2025',
'status' => 'Active',
]);
@@ -24,7 +24,7 @@ class PaymentNotificationDispatchServiceTest extends TestCase
$this->assertDatabaseHas('notifications', [
'title' => 'Payment Reminder',
'message' => 'Reminder body',
'target_group' => 'user',
'target_group' => 'everyone',
'status' => 'sent',
'school_year' => '2025-2026',
'semester' => 'Fall',
@@ -21,8 +21,38 @@ class PaymentTestNotificationServiceTest extends TestCase
]);
DB::table('users')->insert([
['id' => 10, 'firstname' => 'Primary', 'lastname' => 'Parent', 'email' => 'primary@example.com', 'status' => 'Active'],
['id' => 11, 'firstname' => 'Secondary', 'lastname' => 'Parent', 'email' => 'secondary@example.com', 'status' => 'Active'],
[
'id' => 10,
'firstname' => 'Primary',
'lastname' => 'Parent',
'cellphone' => '5551112222',
'email' => 'primary@example.com',
'address_street' => '123 Main',
'city' => 'City',
'state' => 'ST',
'zip' => '12345',
'accept_school_policy' => 1,
'password' => bcrypt('secret'),
'semester' => 'Spring',
'school_year' => '2024-2025',
'status' => 'Active',
],
[
'id' => 11,
'firstname' => 'Secondary',
'lastname' => 'Parent',
'cellphone' => '5553334444',
'email' => 'secondary@example.com',
'address_street' => '456 Oak',
'city' => 'City',
'state' => 'ST',
'zip' => '12345',
'accept_school_policy' => 1,
'password' => bcrypt('secret'),
'semester' => 'Spring',
'school_year' => '2024-2025',
'status' => 'Active',
],
]);
DB::table('families')->insert([
@@ -2,6 +2,7 @@
namespace Tests\Unit\Services\Payments;
use App\Services\ApplicationUrlService;
use App\Services\Payments\PaypalPaymentService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
@@ -11,6 +12,11 @@ class PaypalPaymentServiceTest extends TestCase
{
use RefreshDatabase;
private function makeService(): PaypalPaymentService
{
return new PaypalPaymentService(new ApplicationUrlService());
}
public function test_create_payment_falls_back_to_hosted_when_sdk_missing(): void
{
DB::table('payments')->insert([
@@ -27,7 +33,7 @@ class PaypalPaymentServiceTest extends TestCase
'status' => 'Pending',
]);
$service = new PaypalPaymentService();
$service = $this->makeService();
$result = $service->createPayment(1);
$this->assertSame('hosted', $result['mode']);
@@ -36,7 +42,7 @@ class PaypalPaymentServiceTest extends TestCase
public function test_execute_payment_throws_when_sdk_missing(): void
{
$service = new PaypalPaymentService();
$service = $this->makeService();
$this->expectException(\RuntimeException::class);