-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
73 lines (62 loc) · 2.48 KB
/
bootstrap.php
File metadata and controls
73 lines (62 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
// Set flag that we're in test mode
define('VUFIND_PHPUNIT_RUNNING', 1);
// Set path to this module
define('VUFIND_PHPUNIT_MODULE_PATH', __DIR__);
// Define path to application directory
defined('APPLICATION_PATH')
|| define(
'APPLICATION_PATH',
(getenv('VUFIND_APPLICATION_PATH') ? getenv('VUFIND_APPLICATION_PATH')
: dirname(__DIR__) . '/..')
);
// Define application environment
defined('APPLICATION_ENV')
|| define(
'APPLICATION_ENV',
(getenv('VUFIND_ENV') ? getenv('VUFIND_ENV') : 'testing')
);
// Define default search backend identifier
defined('DEFAULT_SEARCH_BACKEND') || define('DEFAULT_SEARCH_BACKEND', 'Solr');
// Define path to local override directory
defined('LOCAL_OVERRIDE_DIR')
|| define(
'LOCAL_OVERRIDE_DIR',
(getenv('VUFIND_LOCAL_DIR') ? getenv('VUFIND_LOCAL_DIR') : '/usr/local/vufind/local_thulb/')
);
// Define path to cache directory
defined('LOCAL_CACHE_DIR')
|| define(
'LOCAL_CACHE_DIR',
(getenv('VUFIND_CACHE_DIR')
? getenv('VUFIND_CACHE_DIR')
: (strlen(LOCAL_OVERRIDE_DIR) > 0 ? LOCAL_OVERRIDE_DIR . '/cache' : ''))
);
chdir(APPLICATION_PATH);
// Ensure vendor/ is on include_path; some PEAR components may not load correctly
// otherwise (i.e. File_MARC may cause a "Cannot redeclare class" error by pulling
// from the shared PEAR directory instead of the local copy):
$pathParts = [];
$pathParts[] = APPLICATION_PATH . '/vendor';
$pathParts[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $pathParts));
// Composer autoloading
if (file_exists(__DIR__ . '/../../vendor/autoload.php')) {
$loader = include __DIR__ . '/../../vendor/autoload.php';
$loader = new Composer\Autoload\ClassLoader();
$loader->add('ThULBTest', __DIR__ . '/tests/unit-tests/src');
$loader->add('ThULB', __DIR__ . '/src');
// Dynamically discover all module src directories:
$modules = opendir(__DIR__ . '/..');
while ($mod = readdir($modules)) {
$mod = trim($mod, '.'); // ignore . and ..
$dir = empty($mod) ? false : realpath(__DIR__ . "/../{$mod}/src");
if (!empty($dir) && is_dir($dir . '/' . $mod)) {
$loader->add($mod, $dir);
}
}
$loader->register();
}
define('PHPUNIT_FIXTURES_THULB', realpath(__DIR__ . '/tests/fixtures'));
define('FINDEX_TEST_HOST', 'http://findex.thulb.uni-jena.de');
define('THULB_CONFIG_FILE', realpath(__DIR__ . '/../../local_thulb/config/vufind/config.ini'));