Prechádzať zdrojové kódy

ZF-10830
Altered TestHelper in tests/ to utiliize PHPUnit's PHPUnit_Runner_Version file for versioning


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23618 44c647ce-9c0f-0410-b52a-842ac1e357ba

ralph 15 rokov pred
rodič
commit
a4b814cb48
1 zmenil súbory, kde vykonal 12 pridanie a 6 odobranie
  1. 12 6
      tests/TestHelper.php

+ 12 - 6
tests/TestHelper.php

@@ -20,20 +20,26 @@
  * @version    $Id$
  */
 
-/*
+/**
  * Include PHPUnit dependencies
  */
-@require_once 'PHPUnit/Framework.php';
-if (!@fopen('PHPUnit/Autoload.php', 'r', true)) {
-    require_once 'PHPUnit/Framework.php'; // < PHPUnit 3.5.5
+require_once 'PHPUnit/Runner/Version.php';
+
+$phpunitVersion = PHPUnit_Runner_Version::id();
+if ($phpunitVersion == '@package_version@' || version_compare($phpunitVersion, '3.5.5', '>=')) {
+    if (version_compare($phpunitVersion, '3.6.0', '>=')) {
+        echo 'This verison of PHPUnit is not supported in Zend Framework 1.x unit tests.';
+        exit(1);
+    }
+    require_once 'PHPUnit/Autoload.php'; // >= PHPUnit 3.5.5
 } else {
-    require_once 'PHPUnit/Autoload.php'; // >= of PHPUnit 3.5.5
+    require_once 'PHPUnit/Framework.php'; // < PHPUnit 3.5.5
 }
 
 /*
  * Set error reporting to the level to which Zend Framework code must comply.
  */
-error_reporting( E_ALL | E_STRICT );
+error_reporting(E_ALL | E_STRICT);
 
 /*
  * Determine the root, library, and tests directories of the framework