]> source.dussan.org Git - nextcloud-server.git/commitdiff
introduce reopen() method to be used for unit test execution only - right after a...
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 17 Mar 2014 20:57:10 +0000 (21:57 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 17 Mar 2014 20:57:10 +0000 (21:57 +0100)
lib/private/session/memory.php
tests/startsessionlistener.php

index 8434b6000e579952982d5f1e0d5f1e7468be4353..1497c0f89281256b41c4d569f142101785371204 100644 (file)
@@ -63,6 +63,13 @@ class Memory extends Session {
                $this->data = array();
        }
 
+       /**
+        * Helper function for PHPUnit execution - don't use in non-test code
+        */
+       public function reopen() {
+               $this->sessionClosed = false;
+       }
+
        /**
         * In case the session has already been locked an exception will be thrown
         *
index 7559b8cff65cc28452ebcf11e5df489b6b1d558d..808a2a2226fe095a942552893225d53188a233cd 100644 (file)
@@ -27,11 +27,12 @@ class StartSessionListener implements PHPUnit_Framework_TestListener {
        }
 
        public function endTest(PHPUnit_Framework_Test $test, $time) {
-               // new session
-               \OC::$session = new \OC\Session\Memory('');
-
-               // load the version
-               OC_Util::getVersion();
+               // reopen the session - only allowed for memory session
+               if (\OC::$session instanceof \OC\Session\Memory) {
+                       /** @var $session \OC\Session\Memory */
+                       $session = \OC::$session;
+                       $session->reopen();
+               }
        }
 
        public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {