/
bootstrap.php
46 lines (38 loc) · 1.59 KB
/
bootstrap.php
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
<?php
/**
* Configuration and required files that are shared across testing groups.
*
* @copyright Roy Rosenzweig Center for History and New Media, 2009
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @package Omeka_Testing
*/
define('APPLICATION_ENV', 'testing');
ini_set('max_execution_time', 900);
ini_set('memory_limit', '256M');
// Set the include path and all the constants.
$_SERVER['HTTP_HOST'] = 'www.example.com';
$_SERVER['SERVER_PORT'] = '80';
require_once (dirname(dirname(dirname(__FILE__))) . '/paths.php');
require_once 'globals.php';
error_reporting(E_ALL);
ini_set('display_errors', '1');
define('TEST_DIR', dirname(__FILE__));
// Append the testing class library.
define('TEST_LIB_DIR', TEST_DIR . '/libraries');
set_include_path(get_include_path() . PATH_SEPARATOR . TEST_LIB_DIR);
// THEME_DIR is the only constant defined by the bootstrap(s).
// Redefine it here in order to prevent test errors that stem from not defining
// this constant.
// Warning: tests for code that uses THEME_DIR will only use the admin theme dir,
// not the public one. This could potentially cause subtle breakage in tests.
define('THEME_DIR', join('/', array(BASE_DIR, 'admin', 'themes')));
// Make sure the autoloader is initialized.
$autoloader = new Omeka_Application_Resource_Autoloader;
$autoloader->init();
// Clean out the test database before running any tests.
$config = new Omeka_Test_Resource_Config;
$config->init();
$dbIni = Zend_Registry::get('test_config')->db;
$helper = Omeka_Test_Helper_Db::factory($dbIni);
$helper->dropTables($dbIni->prefix);
$helper->getAdapter()->closeConnection();