Skip to content
Snippets Groups Projects
Commit 740a0e5e authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #28967 fix use of nb_display in blog hierarchical view

parent 4632a33b
Branches
Tags
1 merge request!1060Hotline #28967 blog hierarchical limit nb display
- ticket #28967 : Correction de la prise en compte du paramètre qui permet de limiter le nombre d'avis dans l'affichage hiérarchique.
\ No newline at end of file
......@@ -154,10 +154,13 @@ class BlogController extends ZendAfi_Controller_Action {
public function hierarchicalAction() {
$cfg = Class_Profil::getCurrentProfil()->getConfigurationOf('blog','hierarchical','');
$nb_display = isset($cfg['nb_display']) ? $cfg['nb_display'] : null;
$this->view->list = $this->_helper
->reviewListViewMode(['model' => Class_Catalogue::find($this->_getParam('id', 0)),
'id' => $this->_getParam('id'),
'page' => $this->_getParam('page', 1),
'truncate_at' => $this->_getParam('truncate_at')]);
'truncate_at' => $this->_getParam('truncate_at'),
'nb_display' => $nb_display]);
}
}
\ No newline at end of file
......@@ -94,6 +94,11 @@ abstract class ZendAfi_Controller_Action_Helper_AbstractListViewMode extends Zen
}
protected function getNbDisplay() {
return (isset($this->_params['nb_display']) && $this->_params['nb_display']) ? $this->_params['nb_display'] : $this->_items_by_page;
}
protected function getItemsParams() {
$default_params = ['limitPage' => [$this->getPage(), $this->_items_by_page]];
......
......@@ -70,7 +70,8 @@ class ZendAfi_Controller_Action_Helper_ReviewListViewMode extends ZendAfi_Contro
public function getItems() {
return Class_AvisNotice::getAvisFromPreferences(['id_catalogue' => $this->getModelId()],
[$this->getPage(), $this->_items_by_page]);
[$this->getPage(),
$this->getNbDisplay()]);
}
......
......@@ -26,6 +26,9 @@ class BlogControllerHierarchicalTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_Profil::getCurrentProfil()
->setCfgModules(['blog' => ['hierarchical' => ['nb_display' => 2]]]);
Class_AdminVar::set('AVIS_MIN_SAISIE', 0);
Class_AdminVar::set('AVIS_MAX_SAISIE', 1000);
......@@ -73,6 +76,26 @@ class BlogControllerHierarchicalTest extends AbstractControllerTestCase {
'id_user' => 3,
'clef_oeuvre' => $this->ksp->getClefOeuvre()]);
$this->fixture('Class_AvisNotice',
['id' => 2,
'note' => 4,
'entete' => 'Nice !',
'avis' => 'What a nice game',
'statut' => 1,
'date_avis' => '2016-05-18 00:00:00',
'id_user' => 3,
'clef_oeuvre' => $this->ksp->getClefOeuvre()]);
$this->fixture('Class_AvisNotice',
['id' => 3,
'note' => 5,
'entete' => 'So hot !',
'avis' => 'What a hot game',
'statut' => 1,
'date_avis' => '2014-05-18 00:00:00',
'id_user' => 3,
'clef_oeuvre' => $this->ksp->getClefOeuvre()]);
$this->fixture('Class_Users',
['id' => 3,
'login' => 'Harlock',
......@@ -145,6 +168,20 @@ class BlogControllerHierarchicalTest extends AbstractControllerTestCase {
}
/** @test */
public function kspSecondReviewTitleShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "blog/viewavis/id/2")]',
'Nice');
}
/** @test */
public function kspThirdReviewTitleShouldNotBePresent() {
$this->assertNotXPathContentContains('//a[contains(@href, "blog/viewavis/id/3")]',
'So hot !');
}
/** @test */
public function kspAuthorShouldBePresent() {
$this->assertXPathContentContains('//a[contains(@href, "blog/viewauteur/id/3")]',
......
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