2014-03-13 19:19:17 +04: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 19:23:59 +03:00
|
|
|
use OC\Session\Memory;
|
|
|
|
use PHPUnit\Framework\Test;
|
|
|
|
use PHPUnit\Framework\TestListener;
|
|
|
|
use PHPUnit\Framework\TestListenerDefaultImplementation;
|
|
|
|
|
2014-03-13 19:19:17 +04:00
|
|
|
/**
|
|
|
|
* Starts a new session before each test execution
|
|
|
|
*/
|
2018-01-24 19:23:59 +03:00
|
|
|
class StartSessionListener implements TestListener {
|
2014-04-24 17:16:57 +04:00
|
|
|
|
2018-01-24 19:23:59 +03:00
|
|
|
use TestListenerDefaultImplementation;
|
2014-03-13 19:19:17 +04:00
|
|
|
|
2019-11-21 18:40:38 +03:00
|
|
|
public function endTest(Test $test, float $time): void {
|
2014-03-18 00:57:10 +04:00
|
|
|
// reopen the session - only allowed for memory session
|
2018-01-24 19:23:59 +03:00
|
|
|
if (\OC::$server->getSession() instanceof Memory) {
|
|
|
|
/** @var $session Memory */
|
2014-07-16 21:40:22 +04:00
|
|
|
$session = \OC::$server->getSession();
|
2014-03-18 00:57:10 +04:00
|
|
|
$session->reopen();
|
|
|
|
}
|
2014-03-13 19:19:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|