Adding enclosures now treats type and length parameters as optional for Atom, but...
[zend.git] / tests / TestHelper.php
blob38e9ae477a91873135fff41a3e7b3c02e9f49a73
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend
17 * @subpackage UnitTests
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id$
24 * Include PHPUnit dependencies
26 require_once 'PHPUnit/Framework.php';
27 require_once 'PHPUnit/Framework/IncompleteTestError.php';
28 require_once 'PHPUnit/Framework/TestCase.php';
29 require_once 'PHPUnit/Framework/TestSuite.php';
30 require_once 'PHPUnit/Runner/Version.php';
31 require_once 'PHPUnit/TextUI/TestRunner.php';
32 require_once 'PHPUnit/Util/Filter.php';
35 * Set error reporting to the level to which Zend Framework code must comply.
37 error_reporting( E_ALL | E_STRICT );
40 * Determine the root, library, and tests directories of the framework
41 * distribution.
43 $zfRoot = realpath(dirname(dirname(__FILE__)));
44 $zfCoreLibrary = "$zfRoot/library";
45 $zfCoreTests = "$zfRoot/tests";
48 * Prepend the Zend Framework library/ and tests/ directories to the
49 * include_path. This allows the tests to run out of the box and helps prevent
50 * loading other copies of the framework code and tests that would supersede
51 * this copy.
53 $path = array(
54 $zfCoreLibrary,
55 $zfCoreTests,
56 get_include_path()
58 set_include_path(implode(PATH_SEPARATOR, $path));
61 * Load the user-defined test configuration file, if it exists; otherwise, load
62 * the default configuration.
64 if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
65 require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
66 } else {
67 require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
70 if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true &&
71 version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
74 * Add Zend Framework library/ directory to the PHPUnit code coverage
75 * whitelist. This has the effect that only production code source files
76 * appear in the code coverage report and that all production code source
77 * files, even those that are not covered by a test yet, are processed.
79 PHPUnit_Util_Filter::addDirectoryToWhitelist($zfCoreLibrary);
82 * Omit from code coverage reports the contents of the tests directory
84 foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
85 PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, $suffix);
87 PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
88 PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
92 /**
93 * Start output buffering, if enabled
95 if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
96 ob_start();
100 * Unset global variables that are no longer needed.
102 unset($zfRoot, $zfCoreLibrary, $zfCoreTests, $path);