fix financial and certificates
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Grading;
|
||||
|
||||
use App\Services\Grading\Validation\ScoreValueValidator;
|
||||
use InvalidArgumentException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ScoreValueValidatorTest extends TestCase
|
||||
{
|
||||
public function test_blank_score_remains_null(): void
|
||||
{
|
||||
$validator = new ScoreValueValidator();
|
||||
|
||||
$this->assertNull($validator->normalizeNullable('', 100));
|
||||
$this->assertNull($validator->normalizeNullable(null, 100));
|
||||
}
|
||||
|
||||
public function test_score_must_be_inside_range(): void
|
||||
{
|
||||
$validator = new ScoreValueValidator();
|
||||
|
||||
$this->assertSame(95.0, $validator->normalizeNullable('95', 100));
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$validator->normalizeNullable(101, 100);
|
||||
}
|
||||
|
||||
public function test_status_inference_preserves_legacy_pending_behavior(): void
|
||||
{
|
||||
$validator = new ScoreValueValidator();
|
||||
|
||||
$this->assertSame('scored', $validator->inferStatus(80.0));
|
||||
$this->assertSame('pending', $validator->inferStatus(null, false));
|
||||
$this->assertSame('excused', $validator->inferStatus(null, true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user