From c8433e0e76a237f9fcda9916f2904f808fbc5037 Mon Sep 17 00:00:00 2001 From: Alex Arnaud <alex.arnaud@biblibre.com> Date: Wed, 8 Jul 2015 17:09:38 +0200 Subject: [PATCH] dev #24821 - Notify users of the due documents --- library/Class/Users.php | 9 ++++++++- tests/library/Class/UsersTest.php | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/library/Class/Users.php b/library/Class/Users.php index 743444c4e18..74186575e3f 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -1540,7 +1540,14 @@ class Class_Users extends Storm_Model_Abstract { $this->_plural($this->ilsExpireIn(), 'Votre abonnement expire aujourd\'hui.', 'Votre abonnement arrivera à expiration demain.', - 'Votre abonnement arrivera à expiration dans %d jours.', $this->ilsExpireIn())); + 'Votre abonnement arrivera à expiration dans %d jours.', $this->ilsExpireIn())) + ->_notifyOn($notifiable, + $this->getNbEmpruntsRetard(), + $this->_plural($this->getNbEmpruntsRetard(), + '', + 'Vous avez %d document en retard.', + 'Vous avez %d documents en retard.', + $this->getNbEmpruntsRetard())); } diff --git a/tests/library/Class/UsersTest.php b/tests/library/Class/UsersTest.php index 9d895db7e70..13d7f722d01 100644 --- a/tests/library/Class/UsersTest.php +++ b/tests/library/Class/UsersTest.php @@ -747,6 +747,15 @@ class UsersFicheAbonneTest extends ModelTestCase { } + /** @test */ + public function amadouNotificationsShouldContainsVousAvez2DocumentsEnRetard() { + $this->amadou->registerNotificationsOn($this->_notifiable); + + $this->assertContains('Vous avez 2 documents en retard.', + $this->_notifications); + } + + /** @test */ public function withoutIdAbonShouldReturnErrorVousDevezVousConnecter() { $this->assertContains("Vous devez vous connecter", -- GitLab