feat: Permettre à l'enseignant de créer et gérer ses évaluations
Les enseignants avaient besoin de définir les critères de notation (barème, coefficient) avant de pouvoir saisir des notes. Sans cette brique, le module Notes & Évaluations (Epic 6) ne pouvait pas démarrer. L'évaluation est un agrégat du bounded context Scolarité avec deux Value Objects (GradeScale 1-100, Coefficient 0.1-10). Le barème est verrouillé dès qu'une note existe pour éviter les incohérences. Un port EvaluationGradesChecker (stub pour l'instant) sera branché sur le repository de notes dans la story 6.2.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Unit\Scolarite\Domain\Model\Evaluation;
|
||||
|
||||
use App\Scolarite\Domain\Exception\CoefficientInvalideException;
|
||||
use App\Scolarite\Domain\Model\Evaluation\Coefficient;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class CoefficientTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function acceptsValidValues(): void
|
||||
{
|
||||
self::assertSame(0.1, (new Coefficient(0.1))->value);
|
||||
self::assertSame(0.5, (new Coefficient(0.5))->value);
|
||||
self::assertSame(1.0, (new Coefficient(1.0))->value);
|
||||
self::assertSame(1.5, (new Coefficient(1.5))->value);
|
||||
self::assertSame(2.0, (new Coefficient(2.0))->value);
|
||||
self::assertSame(10.0, (new Coefficient(10.0))->value);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function rejectsTooSmall(): void
|
||||
{
|
||||
$this->expectException(CoefficientInvalideException::class);
|
||||
|
||||
new Coefficient(0.0);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function rejectsTooLarge(): void
|
||||
{
|
||||
$this->expectException(CoefficientInvalideException::class);
|
||||
|
||||
new Coefficient(10.1);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function rejectsNegative(): void
|
||||
{
|
||||
$this->expectException(CoefficientInvalideException::class);
|
||||
|
||||
new Coefficient(-1.0);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function equalsComparesValue(): void
|
||||
{
|
||||
$a = new Coefficient(1.5);
|
||||
$b = new Coefficient(1.5);
|
||||
$c = new Coefficient(2.0);
|
||||
|
||||
self::assertTrue($a->equals($b));
|
||||
self::assertFalse($a->equals($c));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user