|
|
@@ -13,18 +13,14 @@
|
|
|
* to license@zend.com so we can send you a copy immediately.
|
|
|
*
|
|
|
* @category Zend
|
|
|
- * @package UnitTests
|
|
|
- * @version $Id$
|
|
|
+ * @package Zend
|
|
|
+ * @subpackage UnitTests
|
|
|
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
|
+ * @version $Id$
|
|
|
*/
|
|
|
|
|
|
/*
|
|
|
- * Start output buffering
|
|
|
- */
|
|
|
-ob_start();
|
|
|
-
|
|
|
-/*
|
|
|
* Include PHPUnit dependencies
|
|
|
*/
|
|
|
require_once 'PHPUnit/Framework.php';
|
|
|
@@ -36,7 +32,7 @@ require_once 'PHPUnit/TextUI/TestRunner.php';
|
|
|
require_once 'PHPUnit/Util/Filter.php';
|
|
|
|
|
|
/*
|
|
|
- * Set error reporting to the highest level.
|
|
|
+ * Set error reporting to the level to which Zend Framework code must comply.
|
|
|
*/
|
|
|
error_reporting( E_ALL | E_STRICT );
|
|
|
|
|
|
@@ -44,20 +40,13 @@ error_reporting( E_ALL | E_STRICT );
|
|
|
* Determine the root, library, and tests directories of the framework
|
|
|
* distribution.
|
|
|
*/
|
|
|
-$zfRoot = dirname(__FILE__) . '/..';
|
|
|
+$zfRoot = realpath(dirname(dirname(__FILE__)));
|
|
|
$zfCoreLibrary = "$zfRoot/library";
|
|
|
$zfCoreTests = "$zfRoot/tests";
|
|
|
|
|
|
/*
|
|
|
- * Omit from code coverage reports the contents of the tests directory
|
|
|
- */
|
|
|
-foreach (array('php', 'phtml', 'csv') as $suffix) {
|
|
|
- PHPUnit_Util_Filter::addDirectoryToFilter($zfCoreTests, ".$suffix");
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
- * Prepend the library/ and tests/ directories to the include_path.
|
|
|
- * This allows the tests to run out of the box and helps prevent
|
|
|
+ * 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.
|
|
|
*/
|
|
|
@@ -78,15 +67,33 @@ if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
|
|
|
require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
- * Add 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.
|
|
|
- */
|
|
|
-if (defined('TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT') && TESTS_ZEND_SERVICE_WINDOWSAZURE_GENERATE_REPORT === true &&
|
|
|
+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();
|
|
|
}
|
|
|
|
|
|
/*
|