fix test issues
This commit is contained in:
@@ -2348,13 +2348,17 @@ final class EnrollmentTransitionService
|
||||
$overridableFailed = array_values(array_diff($failedCodes, self::NON_OVERRIDABLE_RULE_CODES));
|
||||
$recordedCodes = json_decode((string) ($exception['bypassed_rule_codes_json'] ?? ''), true);
|
||||
$recordedCodes = is_array($recordedCodes) ? array_values(array_filter(array_map('strval', $recordedCodes))) : [];
|
||||
$applicableCodes = array_values(array_intersect($overridableFailed, $recordedCodes));
|
||||
if ($applicableCodes === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
$evaluation['admin_exception'] = [
|
||||
'id' => (int) $exception['id'],
|
||||
'reason_code' => (string) ($exception['reason_code'] ?? ''),
|
||||
'source_school_year' => $sourceSchoolYear,
|
||||
'status' => (string) ($exception['status'] ?? ''),
|
||||
'bypassed_rule_codes' => $overridableFailed !== [] ? $overridableFailed : $recordedCodes,
|
||||
'bypassed_rule_codes' => $applicableCodes,
|
||||
];
|
||||
$evaluation['decision'] = self::DECISION_EXCEPTION_ELIGIBLE;
|
||||
$evaluation['parent_enrollment_allowed'] = true;
|
||||
|
||||
@@ -87,6 +87,11 @@ final class EnrollmentTransitionServiceTest extends TestCase
|
||||
{
|
||||
return $this->row;
|
||||
}
|
||||
|
||||
public function getResultArray(): array
|
||||
{
|
||||
return $this->row === null ? [] : [$this->row];
|
||||
}
|
||||
});
|
||||
|
||||
return $builder;
|
||||
@@ -303,6 +308,7 @@ final class EnrollmentTransitionServiceTest extends TestCase
|
||||
$builder->method('groupStart')->willReturnSelf();
|
||||
$builder->method('orWhere')->willReturnSelf();
|
||||
$builder->method('groupEnd')->willReturnSelf();
|
||||
$builder->method('whereIn')->willReturnSelf();
|
||||
$builder->method('orderBy')->willReturnSelf();
|
||||
$builder->method('limit')->willReturnSelf();
|
||||
$builder->method('get')->willReturn(new class {
|
||||
@@ -314,6 +320,11 @@ final class EnrollmentTransitionServiceTest extends TestCase
|
||||
'bypassed_rule_codes_json' => '[]',
|
||||
];
|
||||
}
|
||||
|
||||
public function getResultArray(): array
|
||||
{
|
||||
return [$this->getRowArray()];
|
||||
}
|
||||
});
|
||||
|
||||
$db = $this->createMock(BaseConnection::class);
|
||||
|
||||
Reference in New Issue
Block a user