diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml index 1a2ab35491b88bbc10c8d8482376b0e336044fbc..872ff2c2596891ffc53e52876054031c0f8e7ffa 100644 --- a/tests/phpunit-autotest.xml +++ b/tests/phpunit-autotest.xml @@ -36,6 +36,7 @@ </whitelist> </filter> <listeners> + <listener class="StartSessionListener" file="startsessionlistener.php" /> <listener class="TestCleanupListener" file="testcleanuplistener.php"> <arguments> <string>detail</string> diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist index 71a4ff2762c1737778cfa1d4b30a3eb15b19086f..21c63ea0469aeaa29a102ecf8fe5d543d3a3a423 100644 --- a/tests/phpunit.xml.dist +++ b/tests/phpunit.xml.dist @@ -29,4 +29,7 @@ </exclude> </whitelist> </filter> + <listeners> + <listener class="StartSessionListener" file="startsessionlistener.php" /> + </listeners> </phpunit> diff --git a/tests/startsessionlistener.php b/tests/startsessionlistener.php new file mode 100644 index 0000000000000000000000000000000000000000..fb7fa83e090d2b77356fb7462f06197a19efb81d --- /dev/null +++ b/tests/startsessionlistener.php @@ -0,0 +1,45 @@ +<?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. + */ + +/** + * Starts a new session before each test execution + */ +class StartSessionListener implements PHPUnit_Framework_TestListener { + + public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) { + } + + public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) { + } + + public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) { + } + + public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) { + } + + public function startTest(PHPUnit_Framework_Test $test) { + + // new session + \OC::$session = new \OC\Session\Memory(''); + + // load the version + OC_Util::getVersion(); + + } + + public function endTest(PHPUnit_Framework_Test $test, $time) { + } + + public function startTestSuite(PHPUnit_Framework_TestSuite $suite) { + } + + public function endTestSuite(PHPUnit_Framework_TestSuite $suite) { + } + +}