diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php index 8b3e7444da00dd62514dc071ec484d07553cdee1..67fa81d9381cfb5e8e4a59608fbdd0788670c80b 100644 --- a/library/Class/Catalogue.php +++ b/library/Class/Catalogue.php @@ -970,7 +970,6 @@ class Class_Catalogue extends Storm_Model_Abstract { public function saveThesaurus(){ - xdebug_break(); if ($thesaurus=Class_CodifThesaurus::findThesaurusForCatalogue($this->getId())) $this->deleteThesaurusInFacette($thesaurus->getIdThesaurus()); else diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 8f5fe415fb222341a1d715d2fd59354397dc239a..778dd7ec086025049249a7b3bcb7eb860cef000a 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -21,19 +21,17 @@ require_once 'AbstractControllerTestCase.php'; abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractControllerTestCase { - protected function _loginHook($account) { - $account->ROLE = ""; - $account->ROLE_LEVEL = 0; - $account->ID_USER = ""; - $account->PSEUDO = ""; - } + protected $admin_var; public function setUp() { parent::setUp(); - Class_AdminVar::newInstanceWithId('MENU_BOITE', ['valeur' => 1]); + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); Class_Systeme_ModulesMenu::reset(); - + $this->admin_var=$this->fixture('Class_AdminVar',['id' => 'FORMATIONS', + 'valeur' => 1]); +// $this->admin_var->beModuleEnabled('FORMATIONS'); + $this->admin_var->save(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') ->whenCalled('countBySQLSelect') ->answers(1) @@ -46,7 +44,7 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC 'clef_alpha' => 'POTTER', 'exemplaires' => []])]); - + $cfg_menus = ['H' => ['libelle' => 'Menu horizontal', 'picto' => 'vide.gif', 'menus' => [['type_menu' => 'MENU', @@ -224,8 +222,8 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC class ProfilOptionsControllerProfilAdulteWithCacheTest extends ProfilOptionsControllerWithProfilAdulteTestCase { public function setUp(){ parent::setUp(); - Class_AdminVar::newInstanceWithId('AFFICHER_DISPONIBILITE_SUR_RECHERCHE', ['valeur'=>1] ); - Class_AdminVar::newInstanceWithId('CACHE_ACTIF', ['valeur'=>1] ); + $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE', 'valeur'=>1] ); + $this->fixture('Class_AdminVar', ['id'=>'CACHE_ACTIF', 'valeur'=>1] ); $this->dispatch('/'); $this->bootstrap(); Class_Profil::setCurrentProfil($this->profil_adulte); @@ -266,7 +264,7 @@ class ProfilOptionsControllerProfilAdulteWithCacheTest extends ProfilOptionsCont /** @test */ public function withOutOptionAfficherDisponibiliteSurRechercheScriptShouldNotContainsDisponibiliteAjaxBaseUrl(){ - Class_AdminVar::newInstanceWithId('AFFICHER_DISPONIBILITE_SUR_RECHERCHE', ['valeur'=>0] ); + $this->fixture('Class_AdminVar', ['id'=>'AFFICHER_DISPONIBILITE_SUR_RECHERCHE', 'valeur'=>0] ); $this->bootstrap(); Class_ScriptLoader::resetInstance(); $this->dispatch('/'); @@ -317,6 +315,12 @@ class ProfilOptionsControllerTwitterLinkWithProfilAdulteTest extends ProfilOptio class ProfilOptionsControllerProfilAdulteTest extends ProfilOptionsControllerWithProfilAdulteTestCase { + protected function _loginHook($account) { + $account->ROLE = ""; + $account->ROLE_LEVEL = 0; + $account->ID_USER = ""; + $account->PSEUDO = ""; + } /** @test */ public function titleShouldBeSeConnecterInAuth() { $this->dispatch('/opac/auth/login'); @@ -353,9 +357,7 @@ class ProfilOptionsControllerProfilAdulteTest extends ProfilOptionsControllerWit /** @test */ function withSiteDownShouldDisplaySiteBloque() { - Class_AdminVar::getLoader() - ->newInstanceWithId('SITE_OK') - ->setValeur('0'); + $this->fixture('Class_AdminVar', ['id'=>'SITE_OK', 'valeur' => 0]); $this->dispatch('/opac/'); $this->assertXPathContentContains('//div', 'accès au site est momentanément bloqué'); @@ -366,6 +368,7 @@ class ProfilOptionsControllerProfilAdulteTest extends ProfilOptionsControllerWit class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControllerWithProfilAdulteTestCase { + public function setUp() { parent::setUp(); $this->dispatch('/opac/'); @@ -453,7 +456,7 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalShouldIncludeLinkToFormations() { $this->assertXPathContentContains("//div[@id='menu_horizontal']//li//a[contains(@href, '/abonne/formations')]", - 'Formations'); + 'Formations',$this->_response->getBody()); } @@ -657,7 +660,9 @@ abstract class ProfilOptionsControllerProfilAdulteAsAdminTestCase extends Profil ->whenCalled('save') ->answers(true); - $admin = Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail(); + $admin = $this->fixture('Class_Users',['id'=>34, + 'login' => 'admin', + 'password' => 'toto'])->beAdminPortail(); ZendAfi_Auth::getInstance()->logUser($admin); } } @@ -762,7 +767,11 @@ abstract class ProfilOptionsControllerProfilJeunesseWithPagesJeuxMusiqueTestCase public function setUp() { parent::setUp(); - + Class_AdminVar::beVolatile(); + $this->admin = $this->fixture('Class_Users',['id'=>34, + 'login' => 'admin', + 'password' => 'toto'])->beAdminPortail(); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Notice') ->whenCalled('countBySQLSelect') ->answers(1) @@ -907,9 +916,8 @@ class ProfilOptionsControllerPopupLoginProfilAdulteTest extends ProfilOptionsCon public function setUp() { parent::setUp(); - Class_AdminVar::getLoader() - ->newInstanceWithId('INTERDIRE_ENREG_UTIL') - ->setValeur(0); + $this->fixture('Class_AdminVar', ['id'=>'INTERDIRE_ENREG_UTIL', + 'valeur' => 0]); $this->dispatch('/opac/auth/popup-login/render/popup', true); $this->_xpath = new Storm_Test_XPath(); @@ -943,7 +951,8 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function titleBoitePanierShouldLinkToPanierIndex() { - ZendAfi_Auth::getInstance()->logUser(Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail()); + + ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac'); $this->assertXPath('//div[contains(@class,"panier")]//h1/a[contains(@href,"/panier")]',$this->_response->getBody()); } @@ -951,7 +960,7 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function titleBoitePanierShouldNotLinkToAbonne() { - ZendAfi_Auth::getInstance()->logUser(Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail()); + ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac'); $this->assertNotXPath('//div[contains(@class,"panier")]//h1/a[contains(@href,"/abonne")]'); } @@ -959,7 +968,7 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function boitePanierFlottantShouldBePresentOnAccueil() { - ZendAfi_Auth::getInstance()->logUser(Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail()); + ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac'); $this->assertXPathContentContains('//div[contains(@class,"panier")]','Mes Paniers flottants',$this->_response->getBody()); } @@ -967,7 +976,7 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function boitePanierFlottantShouldBePresentOnRecherche() { - ZendAfi_Auth::getInstance()->logUser(Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail()); + ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac/recherche/simple'); $this->assertXPathContentContains('//div[contains(@class,"panier")]','Mes Paniers flottants',$this->_response->getBody()); } @@ -975,7 +984,7 @@ class ProfilOptionsControllerProfilJeunesseAndJeuxTest extends ProfilOptionsCont /** @test **/ public function divisionFlottantShouldContainsClassColFlottant() { - ZendAfi_Auth::getInstance()->logUser(Class_Users::newInstanceWithId(34, ['login' => 'admin'])->beAdminPortail()); + ZendAfi_Auth::getInstance()->logUser($this->admin); $this->dispatch('/opac'); $this->assertXPath('//div[contains(@class,"colFlottant")]',$this->_response->getBody()); } @@ -1160,7 +1169,7 @@ class ProfilOptionsControllerViewProfilJeunesseAccueilTest extends ProfilOptions public function setUp() { parent::setUp(); - Class_AdminVar::newInstanceWithId('MULTIMEDIA_KEY',['valeur'=>'81b3ab7b0b9a621afb6044a9c2f48ed2']); + $this->fixture('Class_AdminVar',['id'=>'MULTIMEDIA_KEY','valeur'=>'81b3ab7b0b9a621afb6044a9c2f48ed2']); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_TypeDoc') ->whenCalled('findUsedTypeDocIds') ->answers([1, 2, 4]); @@ -1413,7 +1422,7 @@ abstract class ProfilOptionsControllerProfilBoiteCalendarTestCase extends Abstra public function setup() { parent::setup(); - + Class_AdminVar::beVolatile(); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') ->answers([Class_Article::newInstanceWithId(34, [ @@ -1586,7 +1595,7 @@ class ProfilOptionsControllerProfilBoiteCalendarWithCalendarNotDisplayedAndDonTD public function setup() { parent::setup(); - + Class_AdminVar::beVolatile(); $cfg_accueil = ['modules' => ['45' => ['division' => '1', 'type_module' => 'CALENDAR', 'preferences' => ['display_calendar' => '0',