|
|
@@ -0,0 +1,65 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Test\Service\Access;
|
|
|
+
|
|
|
+use App\Entity\Access\Access;
|
|
|
+use App\Entity\Education\CriteriaNotation;
|
|
|
+use App\Entity\Education\EducationNotation;
|
|
|
+use App\Entity\Education\EducationStudent;
|
|
|
+use App\Entity\Organization\Organization;
|
|
|
+use App\Entity\Organization\Parameters;
|
|
|
+use App\Enum\Education\TypeCriteriaEnum;
|
|
|
+use App\Service\Education\EducationNotationUtils;
|
|
|
+use PHPUnit\Framework\TestCase;
|
|
|
+
|
|
|
+class EducationNotationUtilsTest extends TestCase
|
|
|
+{
|
|
|
+ private EducationNotationUtils $educationNotationUtils;
|
|
|
+ private EducationNotation $educationNotation;
|
|
|
+
|
|
|
+ public function setUp():void
|
|
|
+ {
|
|
|
+ $this->educationNotationUtils = new EducationNotationUtils();
|
|
|
+
|
|
|
+ $criteriaNotation = new CriteriaNotation();
|
|
|
+ $criteriaNotation->setType(TypeCriteriaEnum::WITH_NOTATION()->getValue());
|
|
|
+ $criteriaNotation->setNoteMax(50);
|
|
|
+
|
|
|
+ $this->educationNotation = new EducationNotation();
|
|
|
+ $this->educationNotation->setCriteriaNotation($criteriaNotation);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see EducationNotationUtils::getNotationTransformed()
|
|
|
+ */
|
|
|
+ public function testGetNotationTransformed()
|
|
|
+ {
|
|
|
+ $parameters = new Parameters();
|
|
|
+ $parameters->setAverage(80);
|
|
|
+ $organization = new Organization();
|
|
|
+ $organization->setParameters($parameters);
|
|
|
+ $access = new Access();
|
|
|
+ $access->setOrganization($organization);
|
|
|
+ $educationStudent = new EducationStudent();
|
|
|
+ $educationStudent->setAccess($access);
|
|
|
+
|
|
|
+ $this->educationNotation->setEducationStudent($educationStudent);
|
|
|
+ $this->educationNotation->setNote(100);
|
|
|
+ $this->assertEquals(80, $this->educationNotationUtils->getNotationTransformed($this->educationNotation));
|
|
|
+
|
|
|
+ $this->educationNotation->setNote(50);
|
|
|
+ $this->assertEquals(40, $this->educationNotationUtils->getNotationTransformed($this->educationNotation));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see EducationNotationUtils::getNotationOriginal()
|
|
|
+ */
|
|
|
+ public function testGetNotationOriginal()
|
|
|
+ {
|
|
|
+ $this->educationNotation->setNote(100);
|
|
|
+ $this->assertEquals(50, $this->educationNotationUtils->getNotationOriginal($this->educationNotation));
|
|
|
+
|
|
|
+ $this->educationNotation->setNote(50);
|
|
|
+ $this->assertEquals(25, $this->educationNotationUtils->getNotationOriginal($this->educationNotation));
|
|
|
+ }
|
|
|
+}
|