Commit d24499ca authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Extraction de TheseCorrectionAwareTrait à partir de la classe d'entité These...

Extraction de TheseCorrectionAwareTrait à partir de la classe d'entité These pour isoler ce qui concerne les corrections
parent 6bca88cd
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -386,4 +386,14 @@ class Role extends AbstractRole implements SourceAwareInterface, HistoriqueAware
        return $this->profils->contains($profil);
    }

    public function estUsurpable(): bool
    {
        return in_array($this->getCode(), [
            Role::CODE_DIRECTEUR_THESE,
            Role::CODE_CODIRECTEUR_THESE,
            Role::CODE_PRESIDENT_JURY,
            Role::CODE_RAPPORTEUR_JURY,
            Role::CODE_RAPPORTEUR_ABSENT,
        ]);
    }
}
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -38,13 +38,13 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE);

        // correction autorisee = mineure
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE);

        // correction autorisee = majeure
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_OBLIGATOIRE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_OBLIGATOIRE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE);
@@ -52,13 +52,13 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
        $this->_franchir_etape_rdv_bu_validation_bu();

        // correction autorisee = mineure
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE);

        // correction autorisee = majeure
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_OBLIGATOIRE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_OBLIGATOIRE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE);
@@ -67,7 +67,7 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
    public function test_etape_validation_correction_directeurs_necessite_toutes_les_validations()
    {
        // pré-requis: correction autorisee != null
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->assertEtapeEstCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE);
@@ -108,7 +108,7 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
    public function test_cas_version_originale_valide()
    {
        // pré-requis: correction autorisee != null
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);
        $this->_assertSeuleEtapeCourante(WfEtape::CODE_DEPOT_VERSION_ORIGINALE_CORRIGEE);
@@ -154,7 +154,7 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
    public function test_cas_vo_nonvalide_va_valide_conforme()
    {
        // pré-requis: correction autorisee != null
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);

@@ -200,7 +200,7 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
    public function test_cas_vo_nonvalide_va_valide_nonconforme()
    {
        // pré-requis: correction autorisee != null
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);

@@ -225,7 +225,7 @@ class WorkflowServiceTest extends WorkflowServiceAbstractTest
    public function test_cas_vo_nonvalide_va_nonvalide()
    {
        // pré-requis: correction autorisee != null
        $this->these->setCorrectionAutorisee(These::CORRECTION_AUTORISEE_FACULTATIVE);
        $this->these->setCorrectionAutorisee(These::$CORRECTION_AUTORISEE_FACULTATIVE);
        $this->em()->flush($this->these);
        $this->wfs->reloadWorkflow($this->these);

+3 −3
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit_Framework
{
    public function test_retourne_date_null_si_date_butoire_null()
    {
        $correctionAutorisee = These::CORRECTION_AUTORISEE_FACULTATIVE;
        $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE;

        $these = $this->theseMock($correctionAutorisee, $dateButoir = null);

@@ -88,7 +88,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit_Framework
     */
    public function test_correction_mineure($aujourdhui, $dateDerniereNotif, $dateButoir, $expectedDateProchaineNotif, $expectedEstPremiereNotif)
    {
        $correctionAutorisee = These::CORRECTION_AUTORISEE_FACULTATIVE;
        $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE;

        $these = $this->theseMock($correctionAutorisee, $dateButoir);

@@ -216,7 +216,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit_Framework
     */
    public function test_correction_majeure($aujourdhui, $dateDerniereNotif, $dateButoir, $expectedDateProchaineNotif, $expectedEstPremiereNotif)
    {
        $correctionAutorisee = These::CORRECTION_AUTORISEE_OBLIGATOIRE;
        $correctionAutorisee = These::$CORRECTION_AUTORISEE_OBLIGATOIRE;

        $these = $this->theseMock($correctionAutorisee, $dateButoir);

+8 −8
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase
    public function getTypeCorrectionAttendue()
    {
        return [
            [These::CORRECTION_AUTORISEE_FACULTATIVE],
            [These::CORRECTION_AUTORISEE_OBLIGATOIRE],
            [These::$CORRECTION_AUTORISEE_FACULTATIVE],
            [These::$CORRECTION_AUTORISEE_OBLIGATOIRE],
        ];
    }

@@ -59,7 +59,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase
            ->expects($this->exactly(1)) // 1 fois par record
            ->method('triggerCorrectionAttendue');

        if ($typeCorrectionAttendue === These::CORRECTION_AUTORISEE_FACULTATIVE) {
        if ($typeCorrectionAttendue === These::$CORRECTION_AUTORISEE_FACULTATIVE) {
            $this->service->handleImportObservResultsForCorrectionMineure();
        }
        else {
@@ -87,7 +87,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase
            ->expects($this->never())
            ->method('triggerCorrectionAttendue');

        if ($typeCorrectionAttendue === These::CORRECTION_AUTORISEE_FACULTATIVE) {
        if ($typeCorrectionAttendue === These::$CORRECTION_AUTORISEE_FACULTATIVE) {
            $this->service->handleImportObservResultsForCorrectionMineure();
        }
        else {
@@ -114,7 +114,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase
            ->expects($this->never())
            ->method('triggerCorrectionAttendue');

        if ($typeCorrectionAttendue === These::CORRECTION_AUTORISEE_FACULTATIVE) {
        if ($typeCorrectionAttendue === These::$CORRECTION_AUTORISEE_FACULTATIVE) {
            $this->service->handleImportObservResultsForCorrectionMineure();
        }
        else {
@@ -126,7 +126,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase

    public function test_directeurs_de_these_ne_sont_pas_en_copie_de_la_notif_correction_mineure_attendue()
    {
        $typeCorrectionAttendue = These::CORRECTION_AUTORISEE_FACULTATIVE;
        $typeCorrectionAttendue = These::$CORRECTION_AUTORISEE_FACULTATIVE;
        $record = $this->createImportObservResult($typeCorrectionAttendue);
        $aujourdhui = new DateTime('today'); // set time to 0

@@ -144,7 +144,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase

    public function test_directeurs_de_these_ne_sont_pas_en_copie_de_la_1ere_notif_correction_majeure_attendue()
    {
        $typeCorrectionAttendue = These::CORRECTION_AUTORISEE_OBLIGATOIRE;
        $typeCorrectionAttendue = These::$CORRECTION_AUTORISEE_OBLIGATOIRE;
        $record = $this->createImportObservResult($typeCorrectionAttendue);
        $aujourdhui = new DateTime('today'); // set time to 0

@@ -165,7 +165,7 @@ class NotifCorrectionAttendueTest extends \PHPUnit_Framework_TestCase

    public function test_directeurs_de_these_sont_en_copie_de_la_2eme_notif_correction_majeure_attendue()
    {
        $typeCorrectionAttendue = These::CORRECTION_AUTORISEE_OBLIGATOIRE;
        $typeCorrectionAttendue = These::$CORRECTION_AUTORISEE_OBLIGATOIRE;
        $record = $this->createImportObservResult($typeCorrectionAttendue);
        $aujourdhui = new DateTime('today'); // set time to 0

+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ class TheseEntityAssertion extends GeneratedTheseEntityAssertion

    protected function isDateButoirDepotVersionCorrigeeDepassee(): bool
    {
        return $this->these->isDateButoirDepotVersionCorrigeeDepassee();
        return $this->these->isDateButoirDepotVersionCorrigeeDepassee($this->these->getDateSoutenance());
    }

    protected function isUtilisateurEstAuteurDeLaThese(): bool
Loading