Welcome to mirror list, hosted at ThFree Co, Russian Federation.

startsessionlistener.php « tests - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 24a72db0065d0e440ad21e69e5c8ee0fe54bcff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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.
 */

use OC\Session\Memory;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestListenerDefaultImplementation;

/**
 * Starts a new session before each test execution
 */
class StartSessionListener implements TestListener {

	use TestListenerDefaultImplementation;

	public function endTest(Test $test, $time) {
		// reopen the session - only allowed for memory session
		if (\OC::$server->getSession() instanceof Memory) {
			/** @var $session Memory */
			$session = \OC::$server->getSession();
			$session->reopen();
		}
	}

}