fix is_active student flag logic and make moving with enrollment status
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?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', 1],
|
||||
['denied', 0],
|
||||
['withdrawn', 0],
|
||||
['waitlist', 0],
|
||||
];
|
||||
}
|
||||
|
||||
public function testUnknownStatusIsRejected(): void
|
||||
{
|
||||
$service = new EnrollmentStatusService($this->createMock(BaseConnection::class));
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
$service->activeFlagForStatus('accepted');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user