Skip to content
Snippets Groups Projects
bootstrap.php 3.42 KiB
Newer Older
llaffont's avatar
llaffont committed
<?php
/**
 * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
 *
Laurent's avatar
Laurent committed
 * BOKEH is free software; you can redistribute it and/or modify
llaffont's avatar
llaffont committed
 * 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).
 *
Laurent's avatar
Laurent committed
 * BOKEH is distributed in the hope that it will be useful,
llaffont's avatar
llaffont committed
 * 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
Laurent's avatar
Laurent committed
 * along with BOKEH; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
chdir(realpath(dirname(__FILE__)).'/../');
llaffont's avatar
llaffont committed

error_reporting(E_ALL^E_DEPRECATED);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
ini_set('memory_limit', '3072M');
llaffont's avatar
llaffont committed
date_default_timezone_set('Europe/Paris');

set_include_path( realpath(dirname(__FILE__)).'/../library'
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/library/Class'
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/../library/Class'
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/library/'
llaffont's avatar
llaffont committed
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/../library/ZendAfi'
llaffont's avatar
llaffont committed
. PATH_SEPARATOR . './library/storm/src'
. PATH_SEPARATOR . './library/storm/tests'
. PATH_SEPARATOR . './library/storm/zf/library'
llaffont's avatar
llaffont committed
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/../application/modules'
. PATH_SEPARATOR . realpath(dirname(__FILE__)).'/application/modules'
. PATH_SEPARATOR . realpath(dirname(__FILE__))
. PATH_SEPARATOR . get_include_path());

// Includes de base
include_once( "fonctions/fonctions.php");
require_once "Zend/Loader.php";
require_once "library/startup.php";
llaffont's avatar
llaffont committed
$path = dirname(__FILE__);
$parts = explode(DIRECTORY_SEPARATOR, $path);
$parts = array_reverse($parts);

defineConstant("BASE_URL", "/" . $parts[1]);
defineConstant('ROOT_URL', 'http://localhost');
llaffont's avatar
llaffont committed
defineConstant("URL_IMG", BASE_URL . "/public/opac/skins/original/images/");
defineConstant("URL_SHARED_IMG", BASE_URL . "/public/opac/images");
$_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_HOST'] = 'localhost';

llaffont's avatar
llaffont committed
setupOpac();

(new Storm_Cache())->getCache()->setOption('caching', true);

$db_cache = Zend_Cache::factory('Core',
Patrick Barroca's avatar
Patrick Barroca committed
                                'File',
                                ['lifetime' => 300 ,
                                 'automatic_serialization' => true],
                                ['cache_dir' => PATH_TEMP ]);

Zend_Db_Table_Abstract::setDefaultMetadataCache($db_cache);

gloas's avatar
gloas committed
Storm_Cache::setSeed('local');
$cfg = new Zend_Config(Zend_Registry::get('cfg')->toArray(), true);
$cfg->amber = new Zend_Config(array('deploy' => false));
llaffont's avatar
llaffont committed

Zend_Registry::set('cfg', $cfg);
$translate = Zend_Registry::get('translate');
$translate->addTranslation(LANG_DIR.'ro.mo', 'ro');
$translate->addTranslation(LANG_DIR.'en.mo', 'en');
$translate->setLocale('fr');
require_once 'tests/library/ZendAfi/View/Helper/ViewHelperTestCase.php';
require_once 'tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php';
require_once 'tests/fixtures/RessourcesNumeriquesFixtures.php';

register_shutdown_function(function(){
Patrick Barroca's avatar
Patrick Barroca committed
  TestSpeedTrap::printSpeedTrappedTests();