Skip to content
Snippets Groups Projects
Commit ebaa0278 authored by llaffont's avatar llaffont
Browse files

Correction affichage de la biographie: si aucune bio trouvée, affiche "Aucune information trouvée"

git-svn-id: http://afi-forge.afi-sa.fr/svn/opacce/trunk@2751 e3cc70dd-a52f-4065-8a26-0e09943c8c5c
parent 8a9fbc6a
No related merge requests found
......@@ -20,6 +20,8 @@
*/
class ZendAfi_View_Helper_Biographie extends Zend_View_Helper_HtmlElement {
use Trait_Translator;
public function biographie($notice) {
$notice_html = new Class_NoticeHtml();
......@@ -53,8 +55,10 @@ class ZendAfi_View_Helper_Biographie extends Zend_View_Helper_HtmlElement {
public function renderBiographie($data,$notice) {
if(!$data["biographie"])
return $this->getNonTrouve("",true);
if(!$data["biographie"]) {
$data['source'] = $this->_("Aucune information n'a été trouvée");
$data["biographie"] = [];
}
$auteur = $notice->getAuteurPrincipal();
......
......@@ -1019,8 +1019,7 @@ class NoticeAjaxControllerErrorTagsTest extends AbstractControllerTestCase {
class NoticeAjaxControllerBiographieTest extends AbstractControllerTestCase {
abstract class NoticeAjaxControllerBiographieTestCase extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
......@@ -1031,6 +1030,15 @@ class NoticeAjaxControllerBiographieTest extends AbstractControllerTestCase {
$admin = Class_Users::newInstanceWithId(15,['login'=>'admin'])->beAdminPortail();
Zend_Auth::getInstance()->logUser($admin);
}
}
class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieTestCase {
public function setUp() {
parent::setUp();
Class_WebService_AllServices::setHttpClient($http_client = Storm_Test_ObjectWrapper::mock()
->whenCalled('open_url')
......@@ -1048,7 +1056,6 @@ class NoticeAjaxControllerBiographieTest extends AbstractControllerTestCase {
['texte' => 'Auteur de H.Potter']
]
])));
$this->dispatch('/opac/noticeajax/biographie/id_notice/23', true);
}
......@@ -1089,4 +1096,29 @@ class NoticeAjaxControllerBiographieTest extends AbstractControllerTestCase {
}
}
class NoticeAjaxControllerBiographieNonTrouveeTest extends NoticeAjaxControllerBiographieTestCase {
public function setUp() {
parent::setUp();
Class_WebService_AllServices::setHttpClient($http_client = Storm_Test_ObjectWrapper::mock()
->whenCalled('open_url')
->answers(json_encode(['statut_recherche' => '0',
'source' => '',
'vignette' => '',
'image' => '',
'biographie' => ''
])));
$this->dispatch('/opac/noticeajax/biographie/id_notice/23', true);
}
/** @test */
public function answerShouldDisplayAucuneInformationTrouvee() {
$this->assertXPathContentContains('//td', 'Aucune information');
}
}
?>
\ No newline at end of file
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