forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrap.php
95 lines (84 loc) · 2.93 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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/*
* Set error reporting to the level to which Zend Framework code must comply.
*/
error_reporting( E_ALL | E_STRICT );
/*
* Determine the root, library, and tests directories of the framework
* distribution.
*/
$zfRoot = realpath(dirname(__DIR__));
$zfCoreLibrary = "$zfRoot/library";
$zfCoreTests = "$zfRoot/tests";
/*
* Prepend the Zend Framework library/ and tests/ directories to the
* include_path. This allows the tests to run out of the box and helps prevent
* loading other copies of the framework code and tests that would supersede
* this copy.
*/
$path = array(
$zfCoreLibrary,
$zfCoreTests,
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $path));
/**
* Setup autoloading
*/
include __DIR__ . '/_autoload.php';
/*
* Load the user-defined test configuration file, if it exists; otherwise, load
* the default configuration.
*/
if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true &&
version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
/*
* Add Zend Framework library/ directory to the PHPUnit code coverage
* whitelist. This has the effect that only production code source files
* appear in the code coverage report and that all production code source
* files, even those that are not covered by a test yet, are processed.
*/
PHPUnit_Util_Filter::addDirectoryToWhitelist($zfCoreLibrary);
/*
* Omit from code coverage reports the contents of the tests directory
*/
foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, $suffix);
}
PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
}
/**
* Start output buffering, if enabled
*/
if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
ob_start();
}
/*
* Unset global variables that are no longer needed.
*/
unset($zfRoot, $zfCoreLibrary, $zfCoreTests, $path);