Commit 6e9b8b95 authored by Patrick Barroca's avatar Patrick Barroca 🐧

hotline #83536 : add missing return context to records link

parent f3d22d3c
Pipeline #5680 passed with stage
in 31 minutes and 29 seconds
- ticket #83536 : Boite Avis : ajout du contexte de retour manquant dans les liens vers les notices
\ No newline at end of file
......@@ -102,7 +102,7 @@ class BlogController extends ZendAfi_Controller_Action {
public function viewcritiquesAction() {
$this->view->page = $this->_getParam('page', 1);
$id_module = (int)$this->_getParam('id_module');
$this->view->id_module = $id_module = (int)$this->_getParam('id_module');
$profil = Class_Profil::getCurrentProfil();
$preferences = $profil->getModuleAccueilPreferences($id_module, 'CRITIQUES');
......
<?php
$this->openBoite($this->title);
if(is_array($this->liste_avis))
{
if (is_array($this->liste_avis)) {
$helper = $this->getHelper('Avis');
if ($this->id_module)
$helper->addUrlContext(['retour_avis' => $this->id_module]);
$html_avis = [];
foreach($this->liste_avis as $avis)
$html_avis []= $this->avis($avis);
$html_avis []= $helper->avis($avis);
echo implode('<div class="separator"></div>', $html_avis);
}
echo BR.'<div align="center" style="width:100%">'.$this->pager($this->total,$this->config['nb_display'],$this->page,$this->params_url ).'</div>';
echo BR . $this->tag('div',
$this->pager($this->total,
$this->config['nb_display'],
$this->page,
$this->params_url),
['align' => 'center',
'style' => 'width:100%s']);
$this->closeBoite();
?>
......@@ -661,14 +661,12 @@ abstract class ModuleSelectionCritiquesTestCase extends AvisControllersFixturesT
$preferences = ['modules' => [3 => ['division' => 2,
'type_module' => 'CRITIQUES',
'preferences' => ['titre' => 'Coups de coeur'
]
]]];
'preferences' => ['titre' => 'Coups de coeur']]]];
$profil = $this->fixture('Class_Profil',
['id'=>2,
['id' => 2,
'cfg_modules' => ['blog' => ['viewcritiques' => ['nb_display' => 2]]],
'cfg_accueil' => $preferences]);
}
}
......@@ -700,34 +698,49 @@ class AbonneControllerAvisBlogControllerViewCritiquesDefaultTest extends ModuleS
}
class AbonneControllerAvisBlogControllerViewCritiquesTest extends ModuleSelectionCritiquesTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/blog/viewcritiques/id_profil/2/id_module/3');
}
public function testMilleniumIsHere() {
$this->assertQueryContentContains('h2', 'Millenium',$this->_response->getBody());
/** @test */
public function titleShouldBeCoupsDeCoeur() {
$this->assertXPathContentContains('//h1', 'Coups de coeur');
}
public function testPotterIsHere() {
$this->assertQueryContentContains('h2', 'Potter',$this->_response->getBody());
/** @test */
public function milleniumShouldBeDisplayed() {
$this->assertXPathContentContains('//h2', 'Millenium');
}
/** @test */
public function pagerShouldBeDisplayed() {
$this->assertXPath('//a[@href="/blog/viewcritiques/id_profil/2/id_module/3/page/2"]', $this->_response->getBody());
public function milleniumRecordLinkShouldContainsReturnContext() {
$this->assertXPath('//a[contains(@href, "id/817")][contains(@href, "retour_avis/3")]',
$this->_response->getBody());
}
/** @test */
public function pagerShouldNotContains3Pages() {
$this->assertNotXPath('//a[contains(@href,"/page/3")]', $this->_response->getBody());
public function potterShouldBeDisplayed() {
$this->assertXPathContentContains('//h2', 'Potter');
}
/** @test */
public function titleShouldBeCoupsDeCoeur() {
$this->assertXPathContentContains('//h1', 'Coups de coeur');
public function pagerShouldBeDisplayed() {
$this->assertXPath('//a[@href="/blog/viewcritiques/id_profil/2/id_module/3/page/2"]',
$this->_response->getBody());
}
/** @test */
public function pagerShouldNotContains3Pages() {
$this->assertNotXPath('//a[contains(@href,"/page/3")]', $this->_response->getBody());
}
}
......
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