separated patched and addtional Zend Framework 1 classes
authorLars Kneschke <l.kneschke@metaways.de>
Thu, 9 Jul 2015 14:56:03 +0000 (16:56 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 6 Aug 2015 11:40:17 +0000 (13:40 +0200)
... and improves/fixes unittest bootstrapping / autoloading

Change-Id: I4ed49a464d3a4857b252c5115164fb27efcd6b97
Reviewed-on: https://gerrit.tine20.org/tine20/3144
Tested-by: jenkins user
Reviewed-by: Lars Kneschke <l.kneschke@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
47 files changed:
tests/tine20/ServerTestCase.php
tests/tine20/ServerTestHelper.php [deleted file]
tests/tine20/TestCase.php
tests/tine20/TestHelper.php
tests/tine20/bootstrap.php [new file with mode: 0644]
tests/tine20/phpunit.xml
tine20/bootstrap.php
tine20/build.xml
tine20/composer.json
tine20/library/zf1ext/Zend/Auth/Adapter/Http/Abstract.php [moved from tine20/Zend/Auth/Adapter/Http/Abstract.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Http/Ntlm.php [moved from tine20/Zend/Auth/Adapter/Http/Ntlm.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Http/Ntlm/Identity.php [moved from tine20/Zend/Auth/Adapter/Http/Ntlm/Identity.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Http/Ntlm/Resolver/Interface.php [moved from tine20/Zend/Auth/Adapter/Http/Ntlm/Resolver/Interface.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Http/Ntlm/Resolver/Mock.php [moved from tine20/Zend/Auth/Adapter/Http/Ntlm/Resolver/Mock.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Http/NtlmTests.php [moved from tine20/Zend/Auth/Adapter/Http/NtlmTests.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/Imap.php [moved from tine20/Zend/Auth/Adapter/Imap.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl.php [moved from tine20/Zend/Auth/Adapter/ModSsl.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/Abstract.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/Abstract.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/Apache.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/Apache.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/Factory.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/Factory.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/ICPBrasil.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/ICPBrasil.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/Interface.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/Interface.php with 100% similarity]
tine20/library/zf1ext/Zend/Auth/Adapter/ModSsl/Certificate/X509.php [moved from tine20/Zend/Auth/Adapter/ModSsl/Certificate/X509.php with 100% similarity]
tine20/library/zf1ext/Zend/Cache/Backend/Redis.php [moved from tine20/Zend/Cache/Backend/Redis.php with 100% similarity]
tine20/library/zf1ext/Zend/Filter/Empty.php [moved from tine20/Zend/Filter/Empty.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client.php [moved from tine20/Zend/Json/Client.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/Exception.php [moved from tine20/Zend/Json/Client/Exception.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/FaultException.php [moved from tine20/Zend/Json/Client/FaultException.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/HttpException.php [moved from tine20/Zend/Json/Client/HttpException.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/IntrospectException.php [moved from tine20/Zend/Json/Client/IntrospectException.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/Response.php [moved from tine20/Zend/Json/Client/Response.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/SMD.php [moved from tine20/Zend/Json/Client/SMD.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/ServerIntrospection.php [moved from tine20/Zend/Json/Client/ServerIntrospection.php with 100% similarity]
tine20/library/zf1ext/Zend/Json/Client/ServerProxy.php [moved from tine20/Zend/Json/Client/ServerProxy.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler.php [moved from tine20/Zend/Scheduler.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Backend/Abstract.php [moved from tine20/Zend/Scheduler/Backend/Abstract.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Backend/Db.php [moved from tine20/Zend/Scheduler/Backend/Db.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Backend/File.php [moved from tine20/Zend/Scheduler/Backend/File.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Exception.php [moved from tine20/Zend/Scheduler/Exception.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Task.php [moved from tine20/Zend/Scheduler/Task.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Task/Interface.php [moved from tine20/Zend/Scheduler/Task/Interface.php with 100% similarity]
tine20/library/zf1ext/Zend/Scheduler/Task/Rule.php [moved from tine20/Zend/Scheduler/Task/Rule.php with 100% similarity]
tine20/library/zf1ext/Zend/Service/Nominatim.php [moved from tine20/Zend/Service/Nominatim.php with 100% similarity]
tine20/library/zf1ext/Zend/Service/Nominatim/Result.php [moved from tine20/Zend/Service/Nominatim/Result.php with 100% similarity]
tine20/library/zf1ext/Zend/Service/Nominatim/ResultSet.php [moved from tine20/Zend/Service/Nominatim/ResultSet.php with 100% similarity]
tine20/library/zf1ext/Zend/Service/Tine20.php [moved from tine20/Zend/Service/Tine20.php with 100% similarity]
tine20/library/zf1ext/Zend/Session/Validator/IpAddress.php [moved from tine20/Zend/Session/Validator/IpAddress.php with 100% similarity]

index faf673a..b9c1876 100644 (file)
@@ -63,6 +63,20 @@ abstract class ServerTestCase extends PHPUnit_Framework_TestCase
     }
     
     /**
+     * Performs custom preparations on the process isolation template.
+     *
+     * @param Text_Template $template
+     * @since Method available since Release 3.4.0
+     */
+    protected function prepareTemplate(Text_Template $template)
+    {
+        // needed to get bootstrap file included in separate process again
+        $template->setVar(array(
+            'globals' => sprintf("\$GLOBALS['__PHPUNIT_BOOTSTRAP'] = '%s/bootstrap.php';", __DIR__)
+        ));
+    }
+    
+    /**
      * fetch test user credentials
      * 
      * @return array
diff --git a/tests/tine20/ServerTestHelper.php b/tests/tine20/ServerTestHelper.php
deleted file mode 100644 (file)
index ef697e5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Tine 2.0
- * 
- * @package     tests
- * @subpackage  test root
- * @license     http://www.gnu.org/licenses/agpl.html AGPL3
- * @copyright   Copyright (c) 2008 Metaways Infosystems GmbH (http://www.metaways.de)
- * @author      Matthias Greiling <m.greiling@metaways.de>
- */
-
-/*
- * Set error reporting 
- * 
- * @todo put that in config.inc as well?
- */
-error_reporting( E_ALL | E_STRICT );
-
-/*
- * Set include path
- */
-define('PATH_TO_REAL_DIR', dirname(__FILE__). '/../../tine20');
-define('PATH_TO_TINE_LIBRARY', dirname(__FILE__). '/../../tine20/library');
-define('PATH_TO_TEST_DIR', dirname(__FILE__));
-
-$path = array(
-    PATH_TO_REAL_DIR,
-    PATH_TO_TEST_DIR,
-    PATH_TO_TEST_DIR . PATH_SEPARATOR . 'library',
-    PATH_TO_TINE_LIBRARY,
-    get_include_path(),
-);
-
-set_include_path(implode(PATH_SEPARATOR, $path));
-
-require_once 'bootstrap.php';
-
-// phpunit wants to handle the errors / report all errors + restore the default error handler
-error_reporting(E_ALL | E_STRICT);
-restore_error_handler();
-
-// disable sending cookies
-Zend_Session::setOptions(array(
-    'use_cookies'      => 0,
-    'use_only_cookies' => 0
-));
index cfaa915..0e7c4fb 100644 (file)
@@ -11,7 +11,7 @@
 /**
  * Test helper
  */
-require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'TestHelper.php';
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'TestHelper.php';
 
 /**
  * Test class for Calendar_Backend_Sql
index 9708a89..37c9c2a 100644 (file)
@@ -9,40 +9,6 @@
  * @author      Matthias Greiling <m.greiling@metaways.de>
  */
 
-/*
- * Set include path
- */
-define('PATH_TO_REAL_DIR', dirname(__FILE__). '/../../tine20');
-define('PATH_TO_TINE_LIBRARY', dirname(__FILE__). '/../../tine20/library');
-define('PATH_TO_TEST_DIR', dirname(__FILE__));
-
-$path = array(
-    PATH_TO_REAL_DIR,
-    PATH_TO_TEST_DIR,
-    PATH_TO_TEST_DIR . PATH_SEPARATOR . 'library',
-    PATH_TO_TINE_LIBRARY,
-    get_include_path(),
-);
-
-set_include_path(implode(PATH_SEPARATOR, $path));
-
-require_once 'bootstrap.php';
-
-// add test paths to autoloader
-$autoloader = require 'vendor/autoload.php';
-$autoloader->set('', $path);
-
-// phpunit wants to handle the errors / report all errors + restore the default error handler
-error_reporting(E_ALL | E_STRICT);
-restore_error_handler();
-
-// disable sending cookies
-Zend_Session::setOptions(array(
-    'use_cookies'      => 0,
-    'use_only_cookies' => 0
-));
-
 Tinebase_Session_Abstract::setSessionEnabled('TINE20SESSID');
 
 TestServer::getInstance()->initFramework();
diff --git a/tests/tine20/bootstrap.php b/tests/tine20/bootstrap.php
new file mode 100644 (file)
index 0000000..51968a6
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+require_once '../../tine20/bootstrap.php';
+
+// add path the local directory
+$autoloader->add('', array(__DIR__));
+
+define('PATH_TO_REAL_DIR', dirname(__FILE__). '/../../tine20');
+define('PATH_TO_TINE_LIBRARY', dirname(__FILE__). '/../../tine20/library');
+define('PATH_TO_TEST_DIR', dirname(__FILE__));
+
+// phpunit wants to handle the errors / report all errors + restore the default error handler
+error_reporting(E_ALL | E_STRICT);
+restore_error_handler();
+
+// disable sending cookies
+Zend_Session::setOptions(array(
+    'use_cookies'      => 0,
+    'use_only_cookies' => 0
+));
index d00f7d1..e3707f1 100644 (file)
@@ -5,7 +5,8 @@
          convertWarningsToExceptions="true"
          processIsolation="false"
          stopOnFailure="false"
-         syntaxCheck="false">
+         syntaxCheck="false"
+         bootstrap="bootstrap.php">
     <listeners>
         <listener class="LogListener" file="LogListener.php" />
     </listeners>
index 9260c79..641e308 100644 (file)
@@ -32,7 +32,7 @@ if (PHP_VERSION_ID > 50600) {
 }
 
 // intialize composers autoloader
-require 'vendor/autoload.php';
+$autoloader = require __DIR__ . '/vendor/autoload.php';
 
 // initialize plugins
 require 'init_plugins.php';
index f7a6bbe..597cf6e 100644 (file)
     <!-- ============================================      -->
     <target name="phpunit-exec" depends="clean, phpunit-prepare">
         <property name="testinclude" value="AllTests.php" override="true" />
-        <property name="includepath" value=".:/usr/share/php/:${configdir}:${project.basedir}" override="true" />
+        <property name="includepath" value=".:/usr/share/php/:${configdir}:${project.basedir}:${project.basedir}/library:${project.basedir}/library/zf1ext" override="true" />
         <property name="testadditionalparams" value="" override="true" />
         
         <echo msg="Starting Tests..." />
              -d include_path=${includepath}
              --configuration ${testconfigdir}/phpunit.xml
              --log-junit ${builddir}/reports/junit.xml
-             --bootstrap ServerTestHelper.php
              ${testadditionalparams}
              ${testinclude} " />
         </exec>
index 7f07865..f388a8f 100644 (file)
@@ -39,7 +39,7 @@
         "psr-0": {
             "": ["", "library"],
             "TimeZoneConvert": "library/TimeZoneConvert/lib/",
-            "Zend": ["", "library"],
+            "Zend": ["", "library", "library/zf1ext"],
             "qCal": "library/qCal/lib"
         },
         "classmap": [
@@ -47,5 +47,5 @@
         ]
     },
     "include-path-desc": "ZF1 still needs include path as it does not consequently use autoloading internally",
-    "include-path": ["", "library"]
+    "include-path": ["", "library", "library/zf1ext"]
 }