Commit 26bd31f9 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #50082 fix test failures

parent a023b37d
Pipeline #320 failed with stage
in 8 minutes and 4 seconds
......@@ -399,7 +399,7 @@ class AbonneController extends ZendAfi_Controller_Action {
? $this->_('Prolongation des prêts')
: $this->_('Prolongation du prêt');
$this->_renderExtendPopup($title, $this->view->abonne_LoansExtension($cards, $results, $ids));
$this->_renderExtendPopup($title, $this->view->abonne_LoansExtension($this->_user, $cards, $results, $ids));
}
......
......@@ -89,7 +89,7 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_BaseHelper {
'id' => $record->getId(),
'retour_abonne' => 'prets'],
null, true),
$record_title);
$record->getTitrePrincipal());
return
$this->_tag('tr',
$this->_tag('td',
......
......@@ -23,11 +23,13 @@
class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_BaseHelper {
protected
$_cards,
$_results;
$_results,
$_user;
public function abonne_LoansExtension($cards, $results, $ids) {
public function abonne_LoansExtension($user, $cards, $results, $ids) {
$this->_cards = $cards;
$this->_results = $results;
$this->_user = $user;
return count($ids) == 1
? $this->_renderOneLoanExtension()
......@@ -71,8 +73,18 @@ class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_Base
return '';
foreach ($this->_cards->getLoansWithOutPNB() as $loan) {
if ($loan->getId() == $result['id'])
return '<br>'. $this->_tag('strong', $loan->getTitre() . ':') . ' ' . $result['erreur'];
if ($loan->getId() != $result['id'])
continue;
$record = new Class_Entity();
if($item = Class_Exemplaire::findFirstBySIGBOperation($this->_user, $loan))
$record = $item->getNotice();
$title = $record->getId()
? $record->getTitrePrincipal()
: $loan->getTitre();
return '<br>'. $this->_tag('strong', $title . ':') . ' ' . $result['erreur'];
}
return '';
......
......@@ -488,16 +488,18 @@ class AbonneControllerPretsListThreePretsPnbEarlyReturnTest extends AbonneContro
class AbonneControllerPretsListReservationTest extends AbstractAbonneControllerPretsTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_Exemplaire::beVolatile();
$exemplaire_potter = $this->fixture('Class_Exemplaire',
['id' => 120,
'notice' => $this->fixture('Class_Notice',
['id' => 820,
'titre_principal' => 'Potter'])]);
['id' => 12089,
'code_barres' => 123,
'id_int_bib' => 1,
'id_notice' => 820]);
$this->fixture('Class_Notice',
['id' => 820,
'titre_principal' => 'Potter']);
$potter =
(new Class_WebService_SIGB_Reservation('12',
(new Class_WebService_SIGB_Exemplaire(123))
......@@ -903,6 +905,7 @@ class AbonneControllerPretsPeriodicalTitleTest extends AbstractAbonneControllerP
$this->fixture('Class_Exemplaire',
['id' => 967,
'id_origine' => 13340,
'id_int_bib' => 1,
'zone995' => serialize([['clef' => 'a', 'valeur' => 'Espace Culturel'],
['clef' => 'f', 'valeur' => '0720028863'],
['clef' => 'k', 'valeur' => 'J-REV 10-N90']]),
......@@ -937,84 +940,3 @@ class AbonneControllerPretsPeriodicalTitleTest extends AbstractAbonneControllerP
$this->assertXPathContentContains('//a', utf8_encode('Petites mains n 90'));
}
}
/** @see http://forge.afi-sa.fr/issues/50082 **/
class AbonneControllerPretsActionWithLoanMatchingDigitalResource extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
Class_WebService_SIGB_Nanook::reset();
$mock_web_client = $this->mock()
->whenCalled('open_url')
->with('http://localhost:8080/afi_Nanook/ilsdi/service/AuthenticatePatron/username/7942236/password/1900')
->answers(NanookFixtures::xmlAuthenticatePatronFrancoisMorel())
->whenCalled('open_url')
->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPatronInfo/patronId/5352')
->answers(NanookFixtures::xmlGetPatronInfoFrancoisMorel());
$service = Class_WebService_SIGB_Nanook::getService(['url_serveur' => 'http://localhost:8080/afi_Nanook/ilsdi/']);
$service->setWebClient($mock_web_client);
$this->fixture('Class_Bib',
['id' => 3,
'libelle' => 'Cran-Gvrier']);
$this->fixture('Class_CodifAnnexe' , ['id' => 3,
'libelle' => 'Annexe Cran-Gevrier',
'id_bib' => 3,
'code' => 10]);
$this->fixture('Class_Bib',
['id' => 5,
'libelle' => 'Seynod']);
$this->fixture('Class_IntBib',
['id' => 5,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => ['url_serveur' => 'http://bib.valensol.net']]);
$this->fixture('Class_CodifAnnexe' , ['id' => 4,
'libelle' => 'Annexe Seynod',
'id_bib' => 5,
'code' => 8]);
$user = $this->fixture('Class_Users',
['id' => 123,
'id_sigb' => 5352,
'login' => 7942236,
'password' => 1900]);
$emprunteur = $service->getEmprunteur($user);
$emprunteur->updateUser($user);
ZendAfi_Auth::getInstance()->logUser($user);
$this->fixture('Class_Notice',
['id' => 123,
'titre_principal' => 'Le Montespan']);
$this->fixture('Class_IntBib',
['id' => 25,
'comm_sigb' => Class_IntBib::COM_CDSCRIPT,
'comm_params' => ['server_url' => 'http://bib.valensol.net',
'remote_library_id' => 1]]);
$this->fixture('Class_Exemplaire',
['id' => 21,
'id_origine' => 273559,
'id_notice' => 123,
'id_int_bib' => 25
]);
$this->dispatch('/opac/abonne/prets', true);
}
/** @test */
public function titleShouldBeUnFleuveDeFumee() {
$this->assertXPathContentContains('//td', utf8_encode('Un fleuve de fume'));
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class PatronTest extends AbstractControllerTestCase {
public function setup() {
parent::setup();
}
/** @test */
public function loanNoticeShouldBeLinked() {
$this->dispatch('/opac/abonne/loans-history', true);
$this->assertXPath('//td/a[contains(@href, "/recherche/viewnotice/id/1456/retour_abonne/prets")]');
}
/** @test */
public function loanWithoutNoticeShouldNotBeLink() {
$this->dispatch('/opac/abonne/loans-history', true);
$this->assertXPath('//td[not(a)][contains(text(), "L\'hôpital")]');
}
}
?>
\ No newline at end of file
Markdown is supported
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