add controllers, servoices
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Payments;
|
||||
|
||||
use App\Services\Payments\PaymentEnrollmentEventService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PaymentEnrollmentEventServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_build_event_data_requires_parent(): void
|
||||
{
|
||||
$service = new PaymentEnrollmentEventService();
|
||||
|
||||
$this->expectException(\RuntimeException::class);
|
||||
|
||||
$service->buildEventData(999, [], '2025-2026', 'Fall');
|
||||
}
|
||||
|
||||
public function test_build_event_data_returns_parent_payload_when_no_students(): void
|
||||
{
|
||||
DB::table('users')->insert([
|
||||
'id' => 10,
|
||||
'school_id' => 1,
|
||||
'firstname' => 'Parent',
|
||||
'lastname' => 'User',
|
||||
'cellphone' => '555-555-5555',
|
||||
'email' => 'parent@example.com',
|
||||
'address_street' => '123 Main',
|
||||
'city' => 'City',
|
||||
'state' => 'ST',
|
||||
'zip' => '12345',
|
||||
'accept_school_policy' => 1,
|
||||
'is_verified' => 1,
|
||||
'status' => 'Active',
|
||||
'is_suspended' => 0,
|
||||
'failed_attempts' => 0,
|
||||
'password' => bcrypt('secret'),
|
||||
'semester' => 'Fall',
|
||||
'school_year' => '2025-2026',
|
||||
]);
|
||||
|
||||
$service = new PaymentEnrollmentEventService();
|
||||
[$parent, $students] = $service->buildEventData(10, [], '2025-2026', 'Fall', 'https://example.test/login');
|
||||
|
||||
$this->assertSame(10, $parent['user_id']);
|
||||
$this->assertSame('parent@example.com', $parent['email']);
|
||||
$this->assertSame([], $students);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user