46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\App\Services;
|
|
|
|
use App\Services\EnrollmentStatusService;
|
|
use CodeIgniter\Database\BaseConnection;
|
|
use InvalidArgumentException;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class EnrollmentStatusServiceTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider statusMappingProvider
|
|
*/
|
|
public function testEnrollmentStatusMapsToStudentActivity(string $status, int $expected): void
|
|
{
|
|
$service = new EnrollmentStatusService($this->createMock(BaseConnection::class));
|
|
|
|
$this->assertSame($expected, $service->activeFlagForStatus($status));
|
|
}
|
|
|
|
public static function statusMappingProvider(): array
|
|
{
|
|
return [
|
|
['admission under review', 1],
|
|
['review & decision', 1],
|
|
['payment pending', 1],
|
|
['enrolled', 1],
|
|
['withdraw under review', 1],
|
|
['refund pending', 0],
|
|
['denied', 0],
|
|
['withdrawn', 0],
|
|
['waitlist', 0],
|
|
];
|
|
}
|
|
|
|
public function testUnknownStatusIsRejected(): void
|
|
{
|
|
$service = new EnrollmentStatusService($this->createMock(BaseConnection::class));
|
|
|
|
$this->expectException(InvalidArgumentException::class);
|
|
|
|
$service->activeFlagForStatus('accepted');
|
|
}
|
|
}
|