Skip to content
Snippets Groups Projects
Commit a61bef6a authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #44519 : hide news pref in bib view applied again

parent 1d034cc5
Branches
Tags
3 merge requests!1797Master,!1727Dev#44519 recette fiche bibliotheque mauvais affichage des articles,!1725Dev#44519 recette fiche bibliotheque mauvais affichage des articles
......@@ -24,6 +24,9 @@ class ZendAfi_View_Helper_NewsBibHelper extends ZendAfi_View_Helper_BaseHelper {
use Trait_TimeSource;
public function newsBibHelper($id_bib) {
if ($this->_isHidden())
return '';
$prefs = ['id_bib' => $id_bib,
'events_only' => true,
'display_order' => 'EventDebut',
......@@ -45,6 +48,12 @@ class ZendAfi_View_Helper_NewsBibHelper extends ZendAfi_View_Helper_BaseHelper {
}
protected function _isHidden() {
return 1 == Class_Profil::getCurrentProfil()
->getModulePreference('bib', 'bibview', 'hide_news');
}
protected function _renderArticles($articles) {
$helper = $this->view->getHelper('Article_RenderWall');
return $this->view->tag('div', implode('',
......
......@@ -83,6 +83,11 @@ abstract class BibControllerWithZoneTestCase extends AbstractControllerTestCase
'event_end_after' => '2016-07-14'])
->answers([$ecrivez_des_tests])
->whenCalled('getArticlesByPreferences')
->with(['id_bib' => '4'])
->answers([$ecrivez_des_tests])
->whenCalled('getArticlesByPreferences')
->with(['id_bib' => '22',
'events_only' => true,
......@@ -90,6 +95,11 @@ abstract class BibControllerWithZoneTestCase extends AbstractControllerTestCase
'event_end_after' => '2016-07-14'])
->answers([$ecrivez_des_tests])
->whenCalled('getArticlesByPreferences')
->with(['id_bib' => '22'])
->answers([$ecrivez_des_tests])
->whenCalled('filterByLocaleAndWorkflow')
->with([$ecrivez_des_tests])
->answers([$ecrivez_des_tests]);
......@@ -179,6 +189,7 @@ class BibControllerZoneViewOneWithHideNewsTest extends BibControllerWithZoneTest
}
class BibControllerIndexWithHideNewsTest extends BibControllerWithZoneTestCase {
public function setUp() {
parent::setUp();
......@@ -531,6 +542,25 @@ class BibControllerBibViewAnnecyTest extends BibControllerBibViewTestCase {
class BibControllerBibViewAnnecyHideNewsTest extends BibControllerBibViewTestCase {
public function setUp() {
parent::setUp();
Class_Profil::getCurrentProfil()
->setModulePreference('bib', 'bibview', 'hide_news', 1);
$this->dispatch('bib/bibview/id/4', true);
}
/** @test */
public function articleEcrivezDesTestsShouldNotBeVisible() {
$this->assertNotXPathContentContains('//article//header//a[contains(@href, "/cms/articleview/id/2")]',
'Ecrivez des tests !');
}
}
class BibControllerBibViewAnnecyRangeOpeningsTest extends BibControllerBibViewTestCase {
public function setUp() {
parent::setUp();
......
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