Skip to content
Snippets Groups Projects
Commit d9d8b119 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

dev #13060 page preferences in profil portal are the default values for other profil

parent 524c2b88
Branches
Tags
5 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!180Master,!169Dev#13060 Amelioration Formulaire Inscription,!167Master,!152Dev#13060 Amelioration Formulaire Inscription
......@@ -745,14 +745,16 @@ class Class_Profil extends Storm_Model_Abstract {
public function getCfgModulesPreferences($controller, $action, $subaction = '') {
$cfg_modules = $this->getCfgModulesAsArray();
$cls_module = new Class_Systeme_ModulesAppli();
$preferences_defaut = $cls_module->getValeursParDefaut($controller,$action);
$preferences_defaut = $this->isPortail()
? (new Class_Systeme_ModulesAppli())->getValeursParDefaut($controller,$action)
: Class_Profil::getLoader()->getPortail()->getCfgModulesPreferences($controller, $action, $subaction);
if (!array_key_exists($controller, $cfg_modules) ||
!array_key_exists($action.$subaction, $cfg_modules[$controller]))
return $preferences_defaut;
else
return array_merge($preferences_defaut,
$cfg_modules[$controller][$action.$subaction]);
return array_merge($preferences_defaut,
$cfg_modules[$controller][$action.$subaction]);
}
......
......@@ -1241,4 +1241,47 @@ class ProfilHeaderImgAccessTest extends Storm_Test_ModelTestCase {
}
class ProfilPreferenceAuthRegisterTest extends Storm_Test_ModelTestCase {
public function setUp() {
parent::setUp();
$this->portal = $this->fixture('Class_Profil',
['id' => 1,
'libelle' => 'portail']);
$this->youth = $this->fixture('Class_Profil',
['id' => 5,
'libelle' => 'jeunesse']);
$this->modules = new Class_Systeme_ModulesAppli();
}
/** @test */
public function withoutConfigurationYouthProfilPrefsShouldBeDefaultValues() {
$this->assertEquals($this->modules->getValeursParDefaut('auth','register'),
$this->youth->getCfgModulesPreferences('auth', 'register'));
}
/** @test */
public function withConfigInPortalYouthProfilPrefsShouldBePortalValues() {
$this->portal->setModulePreference('auth', 'register', 'register_confirm', 'I confirm');
$this->assertEquals('I confirm',
$this->youth->getModulePreference('auth', 'register', 'register_confirm'));
}
/** @test */
public function withConfigInYouthProfilPrefsShouldBeYouthValues() {
$this->portal->setModulePreference('auth', 'register', 'register_confirm', 'I confirm');
$this->youth->setModulePreference('auth', 'register', 'register_confirm', 'Youpi');
$this->assertEquals('Youpi',
$this->youth->getModulePreference('auth', 'register', 'register_confirm'));
}
}
?>
\ 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