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:
parent
bbbbb033f3
commit
6bbbf8536f
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue