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

hotline MT #119272 sync template profile with detected profile

parent 213b0b7f
No related merge requests found
Pipeline #13066 failed with stage
in 16 minutes and 58 seconds
- ticket #119272 : Magasin de thèmes : Correction du comportement de Bokeh quand on accéde à un profil qui n'exist plus. Bokeh utilise en priorité le profil en session. Si la session est vide Bokeh utilise le profil 1.
\ No newline at end of file
......@@ -68,7 +68,7 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra
$detector = new ZendAfi_Controller_Plugin_DefineURLs_ProfileDetector();
$profil = Class_Profil::setCurrentProfil($detector->detectFrom($request));
Class_Template::setCurrentFrom($request->getParam('id_profil', $request->getParam('profile_id', $profil->getId())));
Class_Template::setCurrentFrom($profil->getId());
if (static::ADMIN == $request->getModuleName())
return $this->adminRequest();
......
......@@ -1066,4 +1066,62 @@ class IndexControllerPageWithDoubleColumnsTest extends AbstractControllerTestCas
$this->assertXPathCount('//div[@id="boite_1000"]', 1);
$this->assertXPathCount('//div[@id="boite_1001"]', 1);
}
}
class IndexControllerWrongProfileIdTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_buildTemplateProfil(['id' => '5']);
$this->dispatch('/index/index/id_profil/8989');
}
/** @test */
public function currentProfilShouldBe5() {
$this->assertXPath('//body[@data-profile-id="5"]');
}
/** @test */
public function templateSixShouldNotHaveBeenCreated() {
$this->assertNull(Class_Profil::find(6));
}
}
class IndexControllerWrongProfileIdWithNoSessionTest extends Admin_AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->_buildTemplateProfil(['id' => '5']);
Class_Profil::setCurrentProfil(new Class_Entity(['Id' => null]));
$this->dispatch('/index/index/id_profil/8989');
}
/** @test */
public function currentProfilShouldBe1() {
$this->assertXPath('//body[contains(@class, "profil_1")]');
}
/** @test */
public function templateSixShouldNotHaveBeenCreated() {
$this->assertNull(Class_Profil::find(6));
}
}
\ 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