Commit 399b8bf9 authored by Laurent's avatar Laurent
Browse files

dev #13615 fix loans links

parent d4b66182
......@@ -75,11 +75,11 @@ class ZendAfi_View_Helper_Abonne_LoansHistory extends ZendAfi_View_Helper_Abonne
. $this->_tag('td',
$this->_renderDocTypeLabel($loan))
. $this->_tag('td',
$this->_renderThumbnail($loan, ['retour_abonne' => 'prets']))
$this->_renderThumbnail($loan, ['retour_abonne' => 'loans-history']))
. $this->_tag('td',
$this->_renderTitle($loan, ['retour_abonne' => 'prets']))
$this->_renderTitle($loan, ['retour_abonne' => 'loans-history']))
. $this->_tag('td',
$this->_renderAuthor($loan, ['retour_abonne' => 'prets']))
$this->_renderAuthor($loan, ['retour_abonne' => 'loans-history']))
. $this->_tag('td',
$loan->getIssueDate())
. $this->_tag('td',
......
......@@ -26,11 +26,13 @@ class ZendAfi_View_Helper_AuthorAnchor extends ZendAfi_View_Helper_BaseHelper {
if(!$author)
return '';
if($facet = Class_CodifAuteur::findWithFullName($author))
$params = array_merge(['controller' => 'recherche',
'action' => 'simple',
'facette' => Class_CodifAuteur::CODE_FACETTE . $facet->getId()],
$params);
if (!$facet = Class_CodifAuteur::findWithFullName($author))
return $author;
$params = array_merge(['controller' => 'recherche',
'action' => 'simple',
'facette' => Class_CodifAuteur::CODE_FACETTE . $facet->getId()],
$params);
return $this->view->tagAnchor($this->view->url($params, null, true),
$author);
......
......@@ -46,7 +46,8 @@ abstract class AbonneControllerLoansHistoryNanookTestCase extends AbstractContro
$this->_emprunteur = new Class_WebService_SIGB_Emprunteur('34', 'faustine');
$faustine->setFicheSigb(['type_comm' => Class_IntBib::COM_NANOOK,
'fiche' => $this->_emprunteur]);
'fiche' => $this->_emprunteur,
'int_bib' => $library]);
ZendAfi_Auth::getInstance()->logUser($faustine);
$this->_mock_web_client = $this->mock();
......@@ -55,6 +56,30 @@ abstract class AbonneControllerLoansHistoryNanookTestCase extends AbstractContro
$service->setWebClient($this->_mock_web_client);
$this->_emprunteur->setService($service);
$this->fixture('Class_Notice',
['id' => 464732,
'titre_principal' => 'La femme à droite sur la photo',
'auteur_principal' => 'Valentin Musso',
'type_doc' => Class_TypeDoc::LIVRE,
'exemplaires' => [$this->fixture('Class_Exemplaire',
['id' => 5,
'code_barres' => 231645,
'id_origine' => 464732,
'int_bib' => $library])]]);
$this->onLoaderOfModel('Class_CodifAuteur')
->whenCalled('findWithFullName')
->answers(null)
->whenCalled('findWithFullName')
->with('Valentin Musso')
->answers($this->fixture('Class_CodifAuteur',
['id' => 11,
'libelle' => 'Valentin Musso',
'formes' => 'MUSSOxxVALENTIN']));
$this->_mock_web_client
->whenCalled('open_url')
->with('http://localhost/afi_Nanook/ilsdi/service/GetLoanHistory/patronId/34?pageNumber=1')
......@@ -78,8 +103,16 @@ class AbonneControllerLoansHistoryNanookIndexTest extends AbonneControllerLoansH
}
/** @test */
public function pageShouldContainLoanLaFemmeADroite() {
$this->assertXPathContentContains('//table', 'La femme à droite sur la photo');
public function pageShouldContainLoanLaFemmeADroiteLink() {
$this->assertXPathContentContains('//table//a[contains(@href, "/recherche/viewnotice/page_size/2/id/464732/retour_abonne/loans-history")]',
'La femme à droite sur la photo');
}
/** @test */
public function valentinMussoShouldLinkToFacetA11() {
$this->assertXPathContentContains('//table//a[contains(@href, "/recherche/simple/facette/A11/retour_abonne/loans-history")]',
'Valentin Musso');
}
......
......@@ -38,13 +38,15 @@ class ZendAfi_View_Helper_AnchorAuthorSimpleTest extends ViewHelperTestCase {
'formes' => 'KONDxxMARIE']);
$this->onLoaderOfModel('Class_CodifAuteur')
->whenCalled('findWithFullName')
->answers(null)
->whenCalled('findByLastNameFirstName')
->with('Stéphanie', 'BRISSON')
->whenCalled('findWithFullName')
->with('Stéphanie BRISSON')
->answers($brisson)
->whenCalled('findByLastNameFirstName')
->with('Marie', 'Kondō')
->whenCalled('findWithFullName')
->with('Marie Kondō')
->answers($kondu);
......@@ -63,4 +65,10 @@ class ZendAfi_View_Helper_AnchorAuthorSimpleTest extends ViewHelperTestCase {
public function shouldReturnAnchorWithFacetA11() {
$this->assertContains('/recherche/simple/facette/A11">Marie Kondō</a>', $this->_helper->authorAnchor('Marie Kondō'));
}
/** @test */
public function withUnknownAuthorShouldNotRenderLink() {
$this->assertEquals('Anonymous', $this->_helper->authorAnchor('Anonymous'));
}
}
\ 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