Skip to content
Snippets Groups Projects
Commit 4317e5bb authored by Alex Arnaud's avatar Alex Arnaud
Browse files

dev #24821 - Fix an error when users have no doc waiting to be pulled

parent 1c55fb8f
Branches
Tags
3 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1010Dev#24821 valence user notices,!1006Dev#24821 valence user notices
......@@ -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;
......
......@@ -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());
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment