Skip to content
Snippets Groups Projects
Commit 5fe3c9d7 authored by llaffont's avatar llaffont
Browse files

Search for bokeh's config.ini now handled by CosmoPaths

parent 3bbb0d66
Branches
Tags
No related merge requests found
......@@ -36,6 +36,11 @@ class CosmoPaths {
}
public function getBokehConfigPath() {
return $this->getBasePath() . 'config.ini';
}
public function getBaseUrl() {
return str_replace($_SERVER['DOCUMENT_ROOT'], '', $this->getBasePath());
}
......@@ -47,7 +52,8 @@ class CosmoPaths {
public function getSite() {
return array_pop(array_filter(explode('/', $this->getBasePath())));
$parts = array_filter(explode('/', $this->getBasePath()));
return array_pop($parts);
}
......
......@@ -46,10 +46,7 @@ require_once "Zend/Loader.php";
require_once "startup.php";
Zend_Loader::registerAutoload();
$base_dir = $_SERVER['DOCUMENT_ROOT'].'/'.explode('/', $_SERVER['SCRIPT_NAME'])[1];
if (!file_exists($cfg_file = $base_dir.'/config.ini')) {
$cfg_file = file_exists('../config.ini') ? '../config.ini' : OPAC_PATH.'/config.ini';
}
$cfg_file = (new CosmoPaths())->getBokehConfigPath();
setupConstants();
$cfg = loadConfig($cfg_file);
......
......@@ -50,6 +50,12 @@ class CosmoPathsTest extends PHPUnit_Framework_TestCase {
}
/** @test */
public function bokehConfigPathShouldEndWithBokehSlashConfigDotIni() {
$this->assertEquals('bokeh.fr/config.ini', substr($this->_cosmo_paths->getBokehConfigPath(), -19));
}
/** @test */
public function baseUrlShouldBeBokehDotFr() {
$this->assertEquals('/bokeh.fr/', $this->_cosmo_paths->getBaseUrl());
......
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