Loading module/Application/tests/ApplicationUnitTest/Rule/NotificationDepotVersionCorrigeeAttenduRuleTest.php +37 −36 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE; $these = $this->theseMock($correctionAutorisee, $dateButoir = null); $these = $this->theseMock($correctionAutorisee); $rule = new NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading @@ -25,15 +25,15 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework $this->assertTrue($rule->estPremiereNotif()); } public function getDataSetMineure() static public function getDataSetMineure() { $aujourdhui = $this->zeroTimeDate('05/03/2017'); $aujourdhui = self::zeroTimeDate('05/03/2017'); return [ 'date butoir dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = true, Loading @@ -41,8 +41,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir dépassée, pas 1ere notif' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = false, Loading @@ -51,7 +51,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir non dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, Loading @@ -59,8 +59,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir non dépassée, pas 1ere notif' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = null, $expectedEstPremiereNotif = false, Loading @@ -68,8 +68,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'notif dejà faite' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = null, // plus de notif $expectedEstPremiereNotif = false, Loading @@ -90,7 +90,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE; $these = $this->theseMock($correctionAutorisee, $dateButoir); $these = $this->theseMock($correctionAutorisee); $these->getDateButoirDepotVersionCorrigeeFromDateSoutenance($these->getDateSoutenance())->willReturn($dateButoir); $rule = new NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading @@ -104,14 +105,13 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework /** * @param string $correctionAutorisee * @param DateTime $dateButoir * @return These */ private function theseMock($correctionAutorisee, $dateButoir) private function theseMock($correctionAutorisee) { $theseProphecy = $this->theseProphecy(); $theseProphecy->getCorrectionAutorisee()->willReturn($correctionAutorisee); $theseProphecy->getDateButoirDepotVersionCorrigeeFromDateSoutenance($theseProphecy->getDateSoutenance())->willReturn($dateButoir); $these = $theseProphecy->reveal(); return $these; Loading @@ -128,13 +128,13 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework public function getDataSetMajeure() { $aujourdhui = $this->zeroTimeDate('05/03/2017'); $aujourdhui = self::zeroTimeDate('05/03/2017'); return [ 'date butoir dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = true, Loading @@ -142,8 +142,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir dépassée, 1ere notif faite' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = false, Loading @@ -152,7 +152,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework '1ere notif, aujourdhui < date de prochaine notif theorique' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, // 1ere notif aujourdhui $expectedEstPremiereNotif = true, Loading @@ -160,44 +160,44 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework '1ere notif faite, aujourdhui < date de prochaine notif theorique' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $this->zeroTimeDate('11/03/2017'), // 1 mois avant la date butoire $expectedDateProchaineNotif = self::zeroTimeDate('11/03/2017'), // 1 mois avant la date butoire $expectedEstPremiereNotif = false, ], '1ere notif, aujourdhui == date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('11/03/2017'), $aujourdhui = self::zeroTimeDate('11/03/2017'), $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, ], '1ere notif faite, aujourdhui == date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('11/03/2017'), $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $aujourdhui = self::zeroTimeDate('11/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = false, ], '1ere notif, aujourdhui > date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('20/03/2017'), $aujourdhui = self::zeroTimeDate('20/03/2017'), $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, ], '1ere notif faite, aujourdhui > date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('20/03/2017'), $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $aujourdhui = self::zeroTimeDate('20/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = null, $expectedEstPremiereNotif = false, Loading @@ -218,7 +218,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_OBLIGATOIRE; $these = $this->theseMock($correctionAutorisee, $dateButoir); $these = $this->theseMock($correctionAutorisee); $these->getDateButoirDepotVersionCorrigeeFromDateSoutenance($these->getDateSoutenance())->willReturn($dateButoir); $rule = new \Depot\Rule\NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading Loading @@ -247,7 +248,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework * @param string|DateTime $date * @return DateTime|null */ private function zeroTimeDate($date) static private function zeroTimeDate($date) { if ($date === null) { return null; Loading module/Import/tests/Functional/DetectionResultatAdmisTest.php +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,8 @@ EOS; public function setUp(): void { $this->applicationConfigPath = __DIR__ . '/../../../../config/application.config.php'; parent::setUp(); // // forçage du proriétaire et des permissions requis pour éviter l'erreur "Bad permissions" Loading module/Retraitement/test/RetraitementTest/Filter/Command/CinesCommandTest.php +8 −6 Original line number Diff line number Diff line Loading @@ -4,22 +4,24 @@ namespace RetraitementTest\Filter\Command; use Application\Command\Exception\ShellCommandException; use Retraitement\Filter\Command\RetraitementShellCommandCines; use UnicaenApp\Exception\RuntimeException; class CinesCommandTest extends \PHPUnit\Framework\TestCase { public function testCheckingResourcesDoesNotFail() { $exception = null; $command = new RetraitementShellCommandCines(); try { $command->checkRequirements(); } catch (ShellCommandException $e) { $this->fail(sprintf( "La vérification des ressources par la commande '%s' n'aurait pas dû lever une %s.", $command->getName(), get_class($e) )); $exception = $e; } $this->assertNull($exception, sprintf( "La vérification des ressources par la commande '%s' n'aurait pas dû lever une ShellCommandException.", $command->getName() )); } } No newline at end of file Loading
module/Application/tests/ApplicationUnitTest/Rule/NotificationDepotVersionCorrigeeAttenduRuleTest.php +37 −36 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE; $these = $this->theseMock($correctionAutorisee, $dateButoir = null); $these = $this->theseMock($correctionAutorisee); $rule = new NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading @@ -25,15 +25,15 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework $this->assertTrue($rule->estPremiereNotif()); } public function getDataSetMineure() static public function getDataSetMineure() { $aujourdhui = $this->zeroTimeDate('05/03/2017'); $aujourdhui = self::zeroTimeDate('05/03/2017'); return [ 'date butoir dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = true, Loading @@ -41,8 +41,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir dépassée, pas 1ere notif' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = false, Loading @@ -51,7 +51,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir non dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, Loading @@ -59,8 +59,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir non dépassée, pas 1ere notif' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = null, $expectedEstPremiereNotif = false, Loading @@ -68,8 +68,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'notif dejà faite' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/05/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/05/2017'), // $expectedDateProchaineNotif = null, // plus de notif $expectedEstPremiereNotif = false, Loading @@ -90,7 +90,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_FACULTATIVE; $these = $this->theseMock($correctionAutorisee, $dateButoir); $these = $this->theseMock($correctionAutorisee); $these->getDateButoirDepotVersionCorrigeeFromDateSoutenance($these->getDateSoutenance())->willReturn($dateButoir); $rule = new NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading @@ -104,14 +105,13 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework /** * @param string $correctionAutorisee * @param DateTime $dateButoir * @return These */ private function theseMock($correctionAutorisee, $dateButoir) private function theseMock($correctionAutorisee) { $theseProphecy = $this->theseProphecy(); $theseProphecy->getCorrectionAutorisee()->willReturn($correctionAutorisee); $theseProphecy->getDateButoirDepotVersionCorrigeeFromDateSoutenance($theseProphecy->getDateSoutenance())->willReturn($dateButoir); $these = $theseProphecy->reveal(); return $these; Loading @@ -128,13 +128,13 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework public function getDataSetMajeure() { $aujourdhui = $this->zeroTimeDate('05/03/2017'); $aujourdhui = self::zeroTimeDate('05/03/2017'); return [ 'date butoir dépassée, 1ere notif' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = true, Loading @@ -142,8 +142,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework 'date butoir dépassée, 1ere notif faite' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/02/2017'), $dateButoir = $this->zeroTimeDate('01/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/02/2017'), $dateButoir = self::zeroTimeDate('01/03/2017'), // $expectedDateProchaineNotif = null, // notif inutile $expectedEstPremiereNotif = false, Loading @@ -152,7 +152,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework '1ere notif, aujourdhui < date de prochaine notif theorique' => [ $aujourdhui, $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, // 1ere notif aujourdhui $expectedEstPremiereNotif = true, Loading @@ -160,44 +160,44 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework '1ere notif faite, aujourdhui < date de prochaine notif theorique' => [ $aujourdhui, $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $this->zeroTimeDate('11/03/2017'), // 1 mois avant la date butoire $expectedDateProchaineNotif = self::zeroTimeDate('11/03/2017'), // 1 mois avant la date butoire $expectedEstPremiereNotif = false, ], '1ere notif, aujourdhui == date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('11/03/2017'), $aujourdhui = self::zeroTimeDate('11/03/2017'), $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, ], '1ere notif faite, aujourdhui == date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('11/03/2017'), $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $aujourdhui = self::zeroTimeDate('11/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = false, ], '1ere notif, aujourdhui > date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('20/03/2017'), $aujourdhui = self::zeroTimeDate('20/03/2017'), $dateDerniereNotif = null, $dateButoir = $this->zeroTimeDate('11/04/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = $aujourdhui, $expectedEstPremiereNotif = true, ], '1ere notif faite, aujourdhui > date de prochaine notif theorique' => [ $aujourdhui = $this->zeroTimeDate('20/03/2017'), $dateDerniereNotif = $this->zeroTimeDate('01/03/2017'), $dateButoir = $this->zeroTimeDate('11/04/2017'), $aujourdhui = self::zeroTimeDate('20/03/2017'), $dateDerniereNotif = self::zeroTimeDate('01/03/2017'), $dateButoir = self::zeroTimeDate('11/04/2017'), // $expectedDateProchaineNotif = null, $expectedEstPremiereNotif = false, Loading @@ -218,7 +218,8 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework { $correctionAutorisee = These::$CORRECTION_AUTORISEE_OBLIGATOIRE; $these = $this->theseMock($correctionAutorisee, $dateButoir); $these = $this->theseMock($correctionAutorisee); $these->getDateButoirDepotVersionCorrigeeFromDateSoutenance($these->getDateSoutenance())->willReturn($dateButoir); $rule = new \Depot\Rule\NotificationDepotVersionCorrigeeAttenduRule(); $rule->setThese($these); Loading Loading @@ -247,7 +248,7 @@ class NotificationDepotVersionCorrigeeAttenduRuleTest extends \PHPUnit\Framework * @param string|DateTime $date * @return DateTime|null */ private function zeroTimeDate($date) static private function zeroTimeDate($date) { if ($date === null) { return null; Loading
module/Import/tests/Functional/DetectionResultatAdmisTest.php +2 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,8 @@ EOS; public function setUp(): void { $this->applicationConfigPath = __DIR__ . '/../../../../config/application.config.php'; parent::setUp(); // // forçage du proriétaire et des permissions requis pour éviter l'erreur "Bad permissions" Loading
module/Retraitement/test/RetraitementTest/Filter/Command/CinesCommandTest.php +8 −6 Original line number Diff line number Diff line Loading @@ -4,22 +4,24 @@ namespace RetraitementTest\Filter\Command; use Application\Command\Exception\ShellCommandException; use Retraitement\Filter\Command\RetraitementShellCommandCines; use UnicaenApp\Exception\RuntimeException; class CinesCommandTest extends \PHPUnit\Framework\TestCase { public function testCheckingResourcesDoesNotFail() { $exception = null; $command = new RetraitementShellCommandCines(); try { $command->checkRequirements(); } catch (ShellCommandException $e) { $this->fail(sprintf( "La vérification des ressources par la commande '%s' n'aurait pas dû lever une %s.", $command->getName(), get_class($e) )); $exception = $e; } $this->assertNull($exception, sprintf( "La vérification des ressources par la commande '%s' n'aurait pas dû lever une ShellCommandException.", $command->getName() )); } } No newline at end of file