2014-03-13 15:19:17 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2018-01-24 16:23:59 +00:00
|
|
|
use OC\Session\Memory;
|
|
|
|
use PHPUnit\Framework\Test;
|
|
|
|
use PHPUnit\Framework\TestListener;
|
|
|
|
use PHPUnit\Framework\TestListenerDefaultImplementation;
|
|
|
|
|
2014-03-13 15:19:17 +00:00
|
|
|
/**
|
|
|
|
* Starts a new session before each test execution
|
|
|
|
*/
|
2018-01-24 16:23:59 +00:00
|
|
|
class StartSessionListener implements TestListener {
|
2014-04-24 13:16:57 +00:00
|
|
|
|
2018-01-24 16:23:59 +00:00
|
|
|
use TestListenerDefaultImplementation;
|
2014-03-13 15:19:17 +00:00
|
|
|
|
2019-11-21 15:40:38 +00:00
|
|
|
public function endTest(Test $test, float $time): void {
|
2014-03-17 20:57:10 +00:00
|
|
|
// reopen the session - only allowed for memory session
|
2018-01-24 16:23:59 +00:00
|
|
|
if (\OC::$server->getSession() instanceof Memory) {
|
|
|
|
/** @var $session Memory */
|
2014-07-16 17:40:22 +00:00
|
|
|
$session = \OC::$server->getSession();
|
2014-03-17 20:57:10 +00:00
|
|
|
$session->reopen();
|
|
|
|
}
|
2014-03-13 15:19:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|