Commit cb63de83 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#85637_a_cacherretirer_par_variable' into 'master'

Dev#85637 a cacherretirer par variable

See merge request !2980
parents 90b78988 85f60fc8
Pipeline #6164 passed with stage
in 33 minutes and 10 seconds
- ticket #85637 : Administration : maintenance des entrées de menu gauche et ajout de liens vers la documentation.
\ No newline at end of file
......@@ -118,14 +118,14 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
if (null !== $this->all_vars)
return $this->all_vars;
return $this->all_vars=
return $this->all_vars =
[
'avis' => $this->_getCommentVars(),
'modo' => $this->_getModerationVars(),
'stat' => $this->_getStatVars(),
'global' => $this->_getGlobalVars(),
'cosmogramme' => $this->_getCosmogrammeVars(),
'catalogue' => $this->_getOAIVars(),
'catalogue' => $this->_getCatalogVars(),
'newsletter' => $this->_getNewsletterVars(),
'cms' => $this->_getCmsVars(),
'album' => $this->_getAlbumVars(),
......@@ -155,7 +155,10 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'ALBUM_MEDIA_NO_AUTOINDEX_TITLE' => Class_AdminVar_Meta::newOnOff($this->_('Bibliothèque numérique: ne pas créer de zone 464 pour les médias dont le titre n\'est pas saisi')),
'BIBNUM' => Class_AdminVar_Meta::newOnOff($this->_('Activer ou désactiver la bibliothèque numérique')),
'SITO_IN_ALBUMS' => Class_AdminVar_Meta::newOnOff($this->_('Gérer la sitothèque dans la bibliothèque numérique, nécessite l\'activation de la bibliothèque numérique'))->bePrivate(),
'IMPORT_EAD' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'import EAD')),
'OAI_REPOSITORY' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'import de dépôts OAI')),
'OPDS' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'import de catalogues OPDS')),
'SITO_IN_ALBUMS' => Class_AdminVar_Meta::newOnOff($this->_('Gérer la sitothèque dans la bibliothèque numérique, nécessite l\'activation de la bibliothèque numérique')),
'NUMILOG_URL' => Class_AdminVar_Meta::newDefault($this->_('Paramétrage <a href="http://forge.afi-sa.fr/projects/opac3/wiki/Ressources_externes_enrichissements#Numilog">Numilog</a>'))->bePrivate(),
'NUMILOG_OAI_URL' => Class_AdminVar_Meta::newDefault($this->_('Paramétrage <a href="http://forge.afi-sa.fr/projects/opac3/wiki/Ressources_externes_enrichissements#Numilog">Numilog</a>'))->bePrivate(),
......@@ -283,7 +286,7 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'WORKFLOW_TEXT_MAIL_ARTICLE_PENDING' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification d\'article en attente de validation. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE, STATUS_ARTICLE, NEXT_STATUS_ARTICLE')),
'WORKFLOW_TEXT_MAIL_ARTICLE_REFUSED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de refus d\'un article à valider. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE')),
'WORKFLOW_TEXT_MAIL_ARTICLE_VALIDATED' => Class_AdminVar_Meta::newDefault($this->_('Contenu de l\'email de notification de validation d\'un article. Termes substitués: TITRE_ARTICLE, URL_ARTICLE, AUTHOR_ARTICLE, SAVED_BY_ARTICLE')),
'CUSTOM_GENRE_ICON' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'interface de personnalisation des icones des genres')),
];
}
......@@ -368,7 +371,11 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
'BUSINESS_EMAIL' => Class_AdminVar_Meta::newDefault($this->_('Email utilisé pour les demandes d\'accompagnement de mise en place ou d\'utilisation des fonctionnalités du logiciel'), ['value' => 'cial-bib@afi-sa.fr'])->bePrivate(),
'CODIFICATION_BROWSER' => Class_AdminVar_Meta::newOnOff($this->_('Activer l\'outil de parcours des codifications')),
'TEMPLATING' => Class_AdminVar_Meta::newOnOff('Active l\'accès au magasin de thèmes',
['value' => 0])->bePrivate()
['value' => 0])->bePrivate(),
'GENERATION_SITE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la génération de site.')),
'CUSTOM_FIELDS_REPORT' => Class_AdminVar_Meta::newOnOff($this->_('Activation des rapports statistiques sur les champs personnalisés')),
'WEBSERVICE_TEST' => Class_AdminVar_Meta::newOnOff($this->_('Activation des tests de webservices')),
'IMPORT_AVIS_OPAC2' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'import des avis de l\'opac2')),
];
}
......@@ -407,8 +414,9 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
}
protected function _getOAIVars() {
protected function _getCatalogVars() {
return [
'IMPORT_THESAURUS' => Class_AdminVar_Meta::newOnOff($this->_('Activation de l\'import de thesaurus')),
'OAI_SERVER' => Class_AdminVar_Meta::newOnOff($this->_('Activation du serveur OAI: permet le moissonnage des domaines par d\'autres logiciels via OAI')),
'OAI_REPOSITORY_NAME' => Class_AdminVar_Meta::newDefault($this->_('Contenu de la balise "repositoryName" dans la réponse au verb Identify, si vide sera [NOM DU SERVEUR] Oai repository')),
'OAI_ADMIN_EMAIL' => Class_AdminVar_Meta::newDefault($this->_('Contenu de la balise "adminEmail" dans la réponse au verb Identify, si vide sera tiré de la variable cosmogramme "mail_admin"')),];
......@@ -877,6 +885,51 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
}
public static function isImportThesaurusEnabled() {
return Class_AdminVar::isModuleEnabled('IMPORT_THESAURUS');
}
public static function isImportEadEnabled() {
return Class_AdminVar::isModuleEnabled('IMPORT_EAD');
}
public static function isOaiRepositoryEnabled() {
return Class_AdminVar::isModuleEnabled('OAI_REPOSITORY');
}
public static function isOpdsEnabled() {
return Class_AdminVar::isModuleEnabled('OPDS');
}
public static function isCustomGenreIconEnabled() {
return Class_AdminVar::isModuleEnabled('CUSTOM_GENRE_ICON');
}
public static function isGenerationSiteEnabled() {
return Class_AdminVar::isModuleEnabled('GENERATION_SITE');
}
public static function isCustomFieldsReportEnabled() {
return Class_AdminVar::isModuleEnabled('CUSTOM_FIELDS_REPORT');
}
public static function isWebserviceTestEnabled() {
return Class_AdminVar::isModuleEnabled('WEBSERVICE_TEST');
}
public static function isImportAvisOpac2Enabled() {
return Class_AdminVar::isModuleEnabled('IMPORT_AVIS_OPAC2');
}
public function getBabelthequeId() {
$mathes = [];
if (preg_match('/bw_([^\.]+)\.js/', (string)Class_AdminVar::get('BABELTHEQUE_JS'), $matches))
......
......@@ -56,6 +56,13 @@ class BibLoader extends Storm_Model_Loader {
}
public function findAllRedmineEnabled() {
return (new Storm_Model_Collection(Class_Bib::findAllBy(['order' => 'libelle'])))
->select('isRedmineEnabled')
->getArrayCopy();
}
public function getUserFriendlyBibs() {
$all_bibs = Class_Bib::getLoader()->findAllBy(['order' => 'libelle']);
$bibs_as_array = [];
......@@ -732,6 +739,11 @@ class Class_Bib extends Storm_Model_Abstract {
}
public function isRedmineEnabled() {
return (bool)$this->getRedmineLoginOrKey();
}
public function isReceivedFile() {
if (!$this->_isFileInRequest('photo'))
return true;
......
......@@ -1815,8 +1815,8 @@ class Class_Users extends Storm_Model_Abstract {
public function getRedmineLibraries() {
if($this->getRoleLevel() >= ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL)
return Class_Bib::findAllBy(['order' => 'libelle']);
if ($this->getRoleLevel() >= ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL)
return Class_Bib::findAllRedmineEnabled();
return [$this->getRedmineLibrary()];
}
......
......@@ -50,8 +50,8 @@ class ZendAfi_Acl_AdminControllerGroup {
public function __construct() {
$this->_activated = ['activity' => Class_AdminVar::isActivityEnabled(),
'album' => Class_AdminVar::isBibNumEnabled(),
'oai' => Class_AdminVar::isBibNumEnabled(),
'ead' => Class_AdminVar::isBibNumEnabled(),
'oai' => Class_AdminVar::isBibNumEnabled() && Class_AdminVar::isOaiRepositoryEnabled(),
'opds' => Class_AdminVar::isBibNumEnabled() && Class_AdminVar::isOpdsEnabled(),
'harvest/arte-vod-browse' => Class_AdminVar::isArteVODEnabled(),
'harvest/vodeclic-browse' => Class_AdminVar::isVodeclicEnabled(),
'harvest/orphea-browse' => Class_AdminVar::isOrpheaEnabled(),
......@@ -61,11 +61,18 @@ class ZendAfi_Acl_AdminControllerGroup {
'harvest/soundcloud' => Class_AdminVar::isSoundCloudEnabled(),
'sito/create' => Class_AdminVar::isSitoInAlbums(),
'album/dilicom' => Class_AdminVar::isDilicomPNBEnabled(),
'album/import_ead' => Class_AdminVar::isImportEadEnabled(),
'premier-chapitre' => Class_AdminVar::isPremierChapitreEnabled(),
'i18n' => Class_AdminVar::isTranslationEnabled(),
'stat/matomo' => (new Class_AdminVar_Matomo())->isEnabled(),
'multimedia' => Class_AdminVar::isMultimediaEnabled(),
'search-form' => Class_AdminVar::isCustomSearchFormEnabled(),
'systeme/importthesaurus' => Class_AdminVar::isImportThesaurusEnabled(),
'systeme/generationsite' => Class_AdminVar::isGenerationSiteEnabled(),
'systeme/webservices' => Class_AdminVar::isWebserviceTestEnabled(),
'systeme/importavisopac2' => Class_AdminVar::isImportAvisOpac2Enabled(),
'profil/genres' => Class_AdminVar::isCustomGenreIconEnabled(),
'custom-fields-report' => Class_AdminVar::isCustomFieldsReportEnabled(),
];
$this->_activated = array_merge($this->_activated,
......
......@@ -90,6 +90,9 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl {
$this->add(new Zend_Acl_Resource('print'));
$this->add(new Zend_Acl_Resource('external-agendas'));
$this->add(new Zend_Acl_Resource('systeme'));
$this->add(new Zend_Acl_Resource('systeme/webservices'));
$this->add(new Zend_Acl_Resource('systeme/phpinfo'));
$this->add(new Zend_Acl_Resource('custom-fields-report'));
$this->add(new Zend_Acl_Resource('batch'));
$this->add(new Zend_Acl_Resource('file-manager'));
$this->add(new Zend_Acl_Resource('url-manager'));
......@@ -191,6 +194,9 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl {
$this->deny('modo_portail','systeme');
$this->deny('modo_portail','batch');
$this->deny('modo_portail','search-form');
$this->deny('modo_portail','custom-fields-report');
$this->deny('modo_portail','systeme/webservices');
$this->deny('modo_portail','systeme/phpinfo');
foreach($codifications as $controller)
$this->deny('modo_portail', $controller);
......
......@@ -32,8 +32,9 @@ class ZendAfi_View_Helper_Admin_ContentNav extends ZendAfi_View_Helper_BaseHelpe
$this->menuMiseEnPage(),
$this->menuStats(),
$this->menuPortail(),
$this->menuCatalogue(),
$this->menuSysteme(),
$this->menuCatalogue()];
];
return $this->_tag('div',
implode($content),
......@@ -67,6 +68,7 @@ class ZendAfi_View_Helper_Admin_ContentNav extends ZendAfi_View_Helper_BaseHelpe
['newsletters', $this->_("Lettres d'information"), '/admin/newsletter'],
['trainings', $this->_('Activités'), '/admin/activity'],
['places', $this->_('Lieux'), '/admin/lieu'],
['filebrowser', $this->_('Explorateur de fichiers'), '/admin/file-manager'],
]);
}
......@@ -140,24 +142,24 @@ class ZendAfi_View_Helper_Admin_ContentNav extends ZendAfi_View_Helper_BaseHelpe
['links', $this->_('Contrôle des URL'), '/admin/url-manager'],
['variables', $this->_('Variables'), '/admin/index/adminvar', [], $is_admin],
['webservice_tests', $this->_('Test des web-services'), '/admin/systeme/webservices',
[], $is_super_admin],
['webservice_tests', $this->_('Test des web-services'), '/admin/systeme/webservices', [], $is_super_admin],
['sendmail_tests', $this->_('Test envoi mails'), '/admin/systeme/mailtest', [], $is_super_admin],
['php', $this->_('Informations système'), '/admin/systeme/phpinfo', [], $is_super_admin],
['image_cache', $this->_('Cache des images'), '/admin/systeme/cacheimages', [], $is_admin],
['migrate_comments', $this->_('Import avis opac2'), '/admin/systeme/importavisopac2',
[], $is_super_admin],
[],
function ($user) use ($is_super_admin) {
return $is_super_admin($user) && Class_AdminVar::isImportAvisOpac2Enabled();
}],
['portal_init', $this->_('Génération du site'), '/admin/systeme/generationsite',
[], function($user) { return defined('DEVELOPMENT') && $user->isAdmin();}],
['portal_init', $this->_('Génération du site'), '/admin/systeme/generationsite'],
['filebrowser', $this->_('Explorateur de fichiers'), '/admin/file-manager'],
['search_form', $this->_('Formulaires de recherche'), '/admin/search-form'],
['customfields', $this->_('Champs personnalisés'), '/admin/custom-fields/index', [], $is_admin],
['customreports', $this->_('Rapports statistiques'), '/admin/custom-fields-report', [], $is_admin]
['customreports', $this->_('Rapports statistiques'), '/admin/custom-fields-report']
]);
}
......@@ -168,12 +170,8 @@ class ZendAfi_View_Helper_Admin_ContentNav extends ZendAfi_View_Helper_BaseHelpe
[["doctypes", $this->_("Types de documents"), "/admin/type-docs",
[], function($user) { return $user->isAdmin(); }],
["thesaurus_init", $this->_("Import Thesaurus"), "/admin/systeme/importthesaurus",
[], function($user) { return defined('DEVELOPMENT') && $user->isAdmin();}],
["thesaurus_edit",
$this->_("Parcourir les codifications"), "/admin/codification-browser",
[]]
["thesaurus_init", $this->_("Import Thesaurus"), "/admin/systeme/importthesaurus"],
["thesaurus_edit", $this->_("Parcourir les codifications"), "/admin/codification-browser"]
]);
}
......@@ -213,91 +211,3 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminBloc {
['class' => 'menuGaucheAdmin']);
}
}
class ZendAfi_View_Helper_Admin_MenuGaucheAdminItem {
protected static $_acl;
protected
$_icon,
$_title,
$_url,
$_attribs,
$_skin;
public static function newWith($params) {
return new static($params[0],
$params[1],
$params[2],
isset($params[3]) ? $params[3] : [],
isset($params[4]) ? $params[4] : null);
}
public function __construct($icon, $title, $url, $attribs=[], $filter=null) {
$this->_icon = $icon;
$this->_title = $title;
$this->_url = $url;
$this->_attribs = $attribs;
$this->_filter = $filter;
$this->_skin = Class_Admin_Skin::current();
}
public function renderFor($user, $view) {
if (!$this->_isAllowed($user))
return '';
$url = $this->_url;
if('http' != substr($url, 0, 4))
$url = BASE_URL . $url;
$extra_infos = isset($this->_attribs['extra_infos'])
? $view->tag('span', $this->_attribs['extra_infos'], ['class' => 'menu_info'])
: '';
$attributes = (array_key_exists('REQUEST_URI', $_SERVER)
&& false !== strpos($_SERVER['REQUEST_URI'], $url))
? ['class' => 'selected']
: [];
$anchor_params = ['href' => $url];
if (isset($this->_attribs['target']))
$anchor_params['target'] = $this->_attribs['target'];
$ico = $this->_skin->renderMenuIconOn($this->_icon, $view, ['alt' => $this->_title]);
return $view->tag('li',
$view->tag('a', $ico . $this->_title, $anchor_params) . $extra_infos,
$attributes);
}
protected function _isAllowed($user) {
if (($filter = $this->_filter) && !$filter($user))
return false;
if ('/admin/' != substr($this->_url, 0, 7))
return true;
$url = substr($this->_url, 7);
$parts = explode('/', $url);
return $this->getAcl()->isAllowed($user, $parts[0], isset($parts[1]) ? $parts[1] : '');
}
/** @category testing */
public static function setAcl($acl) {
static::$_acl = $acl;
}
protected function getAcl() {
return static::$_acl
? static::$_acl
: static::$_acl = new ZendAfi_Acl_AdminControllerGroup();
}
}
......@@ -76,7 +76,8 @@ class ZendAfi_View_Helper_Admin_HelpLinkBokehWiki {
'library' => 'Afficher_les_horaires_d\'ouverture'],
'ouvertures' => ['index' => 'Ouvertures_des_bibliothèques'],
'bibnum' => ['index' => 'Connecteurs'],
'album' => ['index' => 'Collections'],
'album' => ['index' => 'Collections',
'add-website' => 'Sitothèque_ressource_numérique'],
'catalogue' => ['index' => 'Domaines'],
'cms' => ['index' => 'Articles_-_Créer,_rédiger_et_ordonner'],
'custom-fields' => ['index' => 'Gestion_des_champs_personnalisés'],
......@@ -107,7 +108,15 @@ class ZendAfi_View_Helper_Admin_HelpLinkBokehWiki {
'stat' => ['matomo' => 'Matomo'],
'print' => ['index' => 'Imprimer_un_résultat_de_recherche,_une_notice_ou_des_articles'],
'file-manager' => ['index' => 'Explorateur_de_fichiers'],
'url-manager' => ['index' => 'Gestion_des_URL']
'url-manager' => ['index' => 'Gestion_des_URL'],
'search-form' => ['index' => 'Personnalisation_de_la_recherche_avancée'],
'sito' => ['index' => 'Indexation_des_sitothèques'],
'external-agendas' => ['index' => 'Agendas_Externes'],
'lieu' => ['index' => 'Modifier_un_Lieu'],
'users' => ['index' => 'Gestion_des_utilisateurs'],
'codification-browser' => ['index' => 'Explorateur_de_codifications'],
'batch' => ['index' => 'Batchs,_tâches_planifiées'],
'feature' => ['index' => 'Nouvelles_fonctionnalités'],
];
......
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Admin_MenuGaucheAdminItem {
protected static $_acl;
protected
$_icon,
$_title,
$_url,
$_attribs,
$_skin;
public static function newWith($params) {
return new static($params[0],
$params[1],
$params[2],
isset($params[3]) ? $params[3] : [],
isset($params[4]) ? $params[4] : null);
}
public function __construct($icon, $title, $url, $attribs=[], $filter=null) {
$this->_icon = $icon;
$this->_title = $title;
$this->_url = $url;
$this->_attribs = $attribs;
$this->_filter = $filter;
$this->_skin = Class_Admin_Skin::current();
}
public function renderFor($user, $view) {
if (!$this->_isAllowed($user))
return '';
$url = $this->_url;
if('http' != substr($url, 0, 4))
$url = BASE_URL . $url;
$extra_infos = isset($this->_attribs['extra_infos'])
? $view->tag('span', $this->_attribs['extra_infos'], ['class' => 'menu_info'])
: '';
$attributes = (array_key_exists('REQUEST_URI', $_SERVER)
&& false !== strpos($_SERVER['REQUEST_URI'], $url))
? ['class' => 'selected']
: [];
$anchor_params = ['href' => $url];
if (isset($this->_attribs['target']))
$anchor_params['target'] = $this->_attribs['target'];
$ico = $this->_skin->renderMenuIconOn($this->_icon, $view, ['alt' => $this->_title]);
return $view->tag('li',
$view->tag('a', $ico . $this->_title, $anchor_params) . $extra_infos,
$attributes);
}
protected function _isAllowed($user) {
if (($filter = $this->_filter) && !$filter($user))
return false;
if ('/admin/' != substr($this->_url, 0, 7))
return true;
$url = substr($this->_url, 7);
$parts = explode('/', $url);
return $this->getAcl()->isAllowed($user, $parts[0], isset($parts[1]) ? $parts[1] : '');
}
/** @category testing */
public static function setAcl($acl) {
static::$_acl = $acl;
}
protected function getAcl() {
return static::$_acl
? static::$_acl
: static::$_acl = new ZendAfi_Acl_AdminControllerGroup();
}
}
......@@ -31,5 +31,10 @@ abstract class Admin_AbstractControllerTestCase extends AbstractControllerTestCa
$account->LOGIN = "sysadmin";
$account->PSEUDO = "admin";
}
public function tearDown() {
ZendAfi_View_Helper_Admin_MenuGaucheAdminItem::setAcl(null);
parent::tearDown();
}
}
?>
\ No newline at end of file
......@@ -81,12 +81,6 @@ class AdminIndexControllerIndexActionTest extends AdminIndexControllerTestCase {
public function menuGaucheShouldContainsCustomFields() {
$this->assertXPathContentContains('//li//a','Champs personnalisés');
}
/** @test */
public function menuGaucheShouldContainsCustomFieldReport() {
$this->assertXPathContentContains('//li//a','Rapports statistiques');
}
}
......
......@@ -42,9 +42,9 @@ abstract class Admin_AlbumControllerTestCase extends Admin_AbstractControllerTes
$fre = $langue_loader->newInstanceWithId('fre')->setLibelle('français');
$dak = $langue_loader->newInstanceWithId('dak')->setLibelle('dakota');
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CodifLangue')
->whenCalled('findAllBy')
->answers(array($cus, $fre, $dak));
$this->onLoaderOfModel('Class_CodifLangue')
->whenCalled('findAllBy')
->answers([$cus, $fre, $dak]);
$favoris = $this->fixture('Class_AlbumCategorie', ['id' => 2])
->setParentId(0)
......@@ -2646,6 +2646,9 @@ class Admin_AlbumControllerPreviewAlbumBibleSouvignyPostTest extends Admin_Album
class Admin_AlbumControllerImportEADTest extends Admin_AlbumControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('IMPORT_EAD', 1);
$this->dispatch('/admin/album/import_ead');
}
......
......@@ -25,6 +25,7 @@ class CustomFieldsReportControllerAddTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('CUSTOM_FIELDS_REPORT', 1);
$this->dispatch('/admin/custom-fields-report/add', true);
}
......@@ -67,6 +68,8 @@ class CustomFieldsReportControllerEditTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('CUSTOM_FIELDS_REPORT', 1);
$this->fixture('Class_Report', [
'id' => 2,
'label' => 'Report',
......@@ -90,6 +93,9 @@ class CustomFieldsReportControllerGenerateTest extends AbstractControllerTestCas
public function setUp() {
parent::setUp();
Class_AdminVar::set('CUSTOM_FIELDS_REPORT', 1);
$this->fixture('Class_Report', [
'id' => 42,
'label' => '',
......@@ -108,5 +114,4 @@ class CustomFieldsReportControllerGenerateTest extends AbstractControllerTestCas
public function customFieldsJsShouldBePresent() {
$this->assertXPath('//script[contains(@src, "custom-fields/custom_fields.js")]');
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -48,6 +48,9 @@ abstract class Admin_OaiControllerTestCase extends Admin_AbstractControllerTestC
class Admin_OaiControllerIndexActionTest extends Admin_OaiControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$this->dispatch('/admin/oai');
}
......@@ -91,6 +94,7 @@ class Admin_OaiControllerIndexActionTest extends Admin_OaiControllerTestCase {
class Admin_OaiControllerAddActionTest extends Admin_OaiControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$this->dispatch('/admin/oai/add');
}
......@@ -107,6 +111,7 @@ class Admin_OaiControllerAddActionTest extends Admin_OaiControllerTestCase {
class Admin_OaiControllerEditActionTest extends Admin_OaiControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$this->dispatch('/admin/oai/edit/id/4');
}
......@@ -123,6 +128,7 @@ class Admin_OaiControllerEditActionTest extends Admin_OaiControllerTestCase {
class Admin_OaiControllerBrowseGallicaActionTest extends Admin_OaiControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$web_client = Storm_Test_ObjectWrapper::mock();
Class_WebService_OAI::setDefaultHttpClient($web_client);
......@@ -155,6 +161,9 @@ class Admin_OaiControllerImportIsaacAsimovFoundationTest extends Admin_OaiContro
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$foundation = Class_NoticeOAI::getLoader()
->newInstanceWithId(23)
->setData(serialize(array('titre' => 'Prelude to foundation',
......@@ -227,6 +236,7 @@ class Admin_OaiControllerImportIsaacAsimovFoundationTest extends Admin_OaiContro
class Admin_OaiControllerSearchAsimovActionTest extends Admin_OaiControllerTestCase {
/** @test */
public function pageShouldRedirectToOaiIndexWithExpressionRecherche() {
Class_AdminVar::set('OAI_REPOSITORY', 1);
$this->dispatch('/admin/oai/search?expression=asimov', true);
$this->assertRedirectTo('/admin/oai/index/expression/asimov');
}
......@@ -238,6 +248,7 @@ class Admin_OaiControllerSearchAsimovActionTest extends Admin_OaiControllerTestC
abstract class Admin_OaiControllerSearchActionTestCase extends Admin_OaiControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('OAI_REPOSITORY', 1);
$this->mock_sql = Storm_Test_ObjectWrapper::on(Zend_Registry::get('sql'));
Zend_Registry::set('sql', $this->mock_sql);
}
......@@ -307,8 +318,4 @@ class Admin_OaiControllerIndexSearchInsignifantWordActionTest extends Admin_OaiC
public function pageShouldContainsPasAssezDeMotsSignifications() {
$this->assertXPathContentContains('//div[@class="error"]', "Il n'y aucun mot assez significatif pour la recherche");
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -24,6 +24,9 @@ abstract class Admin_OpdsControllerTestCase extends Admin_AbstractControllerTest
public function setUp() {
parent::setUp();
Class_AdminVar::set('OPDS', 1);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_OpdsCatalog')
->whenCalled('findAllBy')
->with(array('order' => 'libelle'))
......@@ -59,6 +62,7 @@ class Admin_OpdsControllerWithReferentActionTest extends Admin_AbstractControlle
public function setUp() {
parent::setUp();
Class_AdminVar::set('OPDS', 1);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Users')
->whenCalled('getIdentity')
->answers($user_referent=Class_Users::getLoader()->newInstanceWithId(2)
......@@ -945,5 +949,4 @@ class Admin_OpdsControllerBrowseFeedbooksTestCase extends Admin_OpdsControllerTe
$album = Class_Album::getLoader()->getFirstAttributeForLastCallOn('save');
$this->assertEquals('In his extraordinary debut novel of psychological suspense, Thomas OCallaghan proves himself a worthy successor to Thomas Harris as he introduces one of the most compelling and terrifying serial killers since Hannibal Lecter in a book where every...', $album->getDescription());
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -1357,17 +1357,19 @@ class Admin_ProfilControllerNonExistingProfileTest extends Admin_AbstractControl
class Admin_ProfilControllerGenresActionTest extends Admin_AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_AdminVar::set('CUSTOM_GENRE_ICON', 1);
$this->dispatch('/admin/profil/genres');
}
/** @test */
function actionShouldBeGenres() {
public function actionShouldBeGenres() {
$this->assertAction('genres');