nextcloud/tests/startsessionlistener.php
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00

29 lines
770 B
PHP

<?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, float $time): void {
// reopen the session - only allowed for memory session
if (\OC::$server->getSession() instanceof Memory) {
/** @var $session Memory */
$session = \OC::$server->getSession();
$session->reopen();
}
}
}