diff --git a/library/Class/WebService/SIGB/Emprunteur.php b/library/Class/WebService/SIGB/Emprunteur.php index 127ffd36d73bdec3ff570c52ff5611af9117fdfa..7eefe78eaccef89b6049b2869f37a0272167fff7 100644 --- a/library/Class/WebService/SIGB/Emprunteur.php +++ b/library/Class/WebService/SIGB/Emprunteur.php @@ -344,6 +344,7 @@ class Class_WebService_SIGB_Emprunteur { public function getHoldsWaitingToBePulled() { if (null === $this->_waiting_holds) { + $this->_waiting_holds = []; foreach ($this->getReservations() as $hold) { if ($hold->isWaitingToBePulled()) $this->_waiting_holds[] = $hold; diff --git a/tests/library/Class/WebService/SIGB/KohaTest.php b/tests/library/Class/WebService/SIGB/KohaTest.php index 6191f6347fef48862b011ec6c41608f6cf7bea47..4510c0c4b8c70b5f0d7dc6dd3fbb755c1bca8403 100644 --- a/tests/library/Class/WebService/SIGB/KohaTest.php +++ b/tests/library/Class/WebService/SIGB/KohaTest.php @@ -352,53 +352,64 @@ class KohaGetEmprunteurLaureAfondTest extends KohaTestCase { ->getEmprunteur(Class_Users::newInstance() ->setLogin('lafond') ->setPassword('afi') - ->setIdabon('012345') - ); + ->setIdabon('012345')); + + $this->pierre = $this->service + ->getEmprunteur(Class_Users::newInstance() + ->setLogin('pierre') + ->setPassword('toto') + ->setIdabon('9865')); } /** @test */ - function getIdShouldReturn572() { + public function getIdShouldReturn572() { $this->assertEquals(572, $this->laurent->getId()); } /** @test */ - function getHoldsWaitingToBePulledShouldReturn2Holds() { + public function getHoldsWaitingToBePulledForPierreShouldReturn0Holds() { + $this->assertCount(0, $this->pierre->getHoldsWaitingToBePulled()); + } + + + /** @test */ + public function getHoldsWaitingToBePulledForLaurentShouldReturn2Holds() { $this->assertCount(2, $this->laurent->getHoldsWaitingToBePulled()); } /** @test */ - function firstHoldWaitingToBePulledTitleShouldBeHarryPotterEtLaCoupeDeFeu() { + public function firstHoldWaitingToBePulledTitleShouldBeHarryPotterEtLaCoupeDeFeu() { $waiting_holds = $this->laurent->getHoldsWaitingToBePulled(); $this->assertEquals('Harry Potter et le prisonnier d\'Azkaban', $waiting_holds[0]->getTitre()); } /** @test */ - function firstHoldWaitingToBePulledPickUpLocationShouldBeMontmedy() { + public function firstHoldWaitingToBePulledPickUpLocationShouldBeMontmedy() { $waiting_holds = $this->laurent->getHoldsWaitingToBePulled(); $this->assertEquals('Médiathèque publique', $waiting_holds[0]->getPickupLocationLabel()); } /** @test */ - function secondHoldWaitingToBePulledTitleShouldBeHarryPotterEtLePrisonnierDAzkaban() { + public function secondHoldWaitingToBePulledTitleShouldBeHarryPotterEtLePrisonnierDAzkaban() { $waiting_holds = $this->laurent->getHoldsWaitingToBePulled(); $this->assertEquals('Harry Potter et l\'ordre du Phénix', $waiting_holds[1]->getTitre()); } /** @test */ - function secondHoldWaitingToBePulledPickUpLocationShouldBeMediathequePublique() { + public function secondHoldWaitingToBePulledPickUpLocationShouldBeMediathequePublique() { $waiting_holds = $this->laurent->getHoldsWaitingToBePulled(); $this->assertEquals('Montmedy', $waiting_holds[1]->getPickupLocationLabel()); } /** @test */ - function nbReservationsShouldReturnThree() { + public function nbReservationsShouldReturnThree() { $this->assertEquals(4, $this->laurent->getNbReservations()); }