introduce reopen() method to be used for unit test execution only - right after a unit test has been executed the session will be reopened

This commit is contained in:
Thomas Müller 2014-03-17 21:57:10 +01:00
parent bbbbb033f3
commit 6bbbf8536f
2 changed files with 13 additions and 5 deletions

View 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
*

View 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) {