Skip to content
Snippets Groups Projects
Commit 1a76504e authored by efalcy's avatar efalcy
Browse files

CVS : corrections tests

parent 835c74d1
Branches
Tags
No related merge requests found
......@@ -39,13 +39,13 @@ class ZendAfi_View_Helper_ListeCVSNotices extends ZendAfi_View_Helper_ListeNotic
public function listeCVSNotices($notices,$nombre_resultats,$page,$preferences) {
$html = '<div class="liste_notices_cvs" >';
$html .= $this->displayTriRecherche($page,$nombre_resultats,$criteres_recherche);
$html .= $this->displayTriRecherche($page,$nombre_resultats);
if(!$nombre_resultats) return $html;
$html = $this->displayList($html,$notices,$preferences);
return ($html.'</div>');
}
public function displayTriRecherche($page,$nombre_resultats,$criteres_recherche){
public function displayTriRecherche($page,$nombre_resultats){
$html='<div class="resultats_cvs_page"><div><span>';
if(!$nombre_resultats) $html.= $this->view->_('Aucun document trouvé');
if($nombre_resultats == 1) $html.=$this->view->_('1 document trouvée');
......
......@@ -725,14 +725,67 @@ class NoticeAjaxControllerNoticeWithAvisAvisAbonneTest extends AbstractControlle
abstract class NoticeAjaxControllerCvsSearchTest extends AbstractControllerTestCase {
class NoticeAjaxControllerCvsSearchTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_Users::newInstanceWithId(15,['login'=>'polo'])->beAbonneSIGB();
$logged_user=Class_Users::newInstanceWithId(15,['login'=>'polo'])->beAbonneSIGB();
$this->group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia',
'rights_token' => Class_UserGroup::RIGHT_ACCES_ARTEVOD]);
$logged_user->beAbonneSIGB()
->setUserGroups([$this->group_multimedia]);
ZendAfi_Auth::getInstance()->logUser($logged_user);
$preferences = [
'cvs_nb_result' => '5'];
$this->mock_cvs = Storm_Test_ObjectWrapper::mock();
RessourcesNumeriquesFixtures::activateCVS();
Storm_Test_ObjectWrapper::mock()
->whenCalled('forUser')
->answers($this->mock_cvs);
$this->mock_cvs
->whenCalled('searchNotices')
->answers([]);
Class_Profil::getCurrentProfil()->setCfgModules(['recherche' => ['resultat' => $preferences]]);
$this->dispatch('/opac/noticeajax/cvs-search/expressionRecherche/Cuisson/page/2', true);
}
/** @test */
public function withNoResultShouldReturnAucunDocument() {
$this->assertContains('Aucun document trouvé',$this->_response->getBody());
}
}
abstract class NoticeAjaxControllerCvsWithNoticesSearchTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$logged_user=Class_Users::newInstanceWithId(15,['login'=>'polo'])->beAbonneSIGB();
$this->group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia',
'rights_token' => Class_UserGroup::RIGHT_ACCES_ARTEVOD]);
$logged_user->beAbonneSIGB()
->setUserGroups([$this->group_multimedia]);
ZendAfi_Auth::getInstance()->logUser($logged_user);
$preferences = [
'cvs_nb_result' => '5'];
RessourcesNumeriquesFixtures::activateCVS();
$this->mock_cvs = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CVSLink');
$this->mock_cvs
->whenCalled('searchNotices')
->answers([Class_Notice::newInstanceWithId('10')]);
$this->mock_cvs
->whenCalled('forUser')
->answers($this->mock_cvs);
Class_Profil::getCurrentProfil()->setCfgModules(['recherche' => ['resultat' => $preferences]]);
$this->dispatch('/opac/noticeajax/cvs-search/expressionRecherche/Cuisson/page/2', true);
......@@ -740,8 +793,8 @@ abstract class NoticeAjaxControllerCvsSearchTest extends AbstractControllerTestC
/** @test */
public function pageShouldContainsTitreNotice() {
$this->assertXPathContentContains('//h1', 'Bending new corners');
public function withesultShouldReturnAucunDocument() {
$this->assertContains('Aucun document trouvé',$this->_response->getBody());
}
}
......
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