From fc697c729811e5644e2c7bc884bd54d3ff092ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 13 Mar 2014 16:19:17 +0100 Subject: [PATCH] adding StartSessionListener which initializes the session before each test case execution --- tests/phpunit-autotest.xml | 1 + tests/phpunit.xml.dist | 3 +++ tests/startsessionlistener.php | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/startsessionlistener.php diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml index 1a2ab35491..872ff2c259 100644 --- a/tests/phpunit-autotest.xml +++ b/tests/phpunit-autotest.xml @@ -36,6 +36,7 @@ + detail diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist index 71a4ff2762..21c63ea046 100644 --- a/tests/phpunit.xml.dist +++ b/tests/phpunit.xml.dist @@ -29,4 +29,7 @@ + + + diff --git a/tests/startsessionlistener.php b/tests/startsessionlistener.php new file mode 100644 index 0000000000..fb7fa83e09 --- /dev/null +++ b/tests/startsessionlistener.php @@ -0,0 +1,45 @@ + + * 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) { + } + +}