startsessionlistener.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. /**
  9. * Starts a new session before each test execution
  10. */
  11. class StartSessionListener implements PHPUnit_Framework_TestListener {
  12. public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
  13. }
  14. public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
  15. }
  16. public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
  17. }
  18. public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
  19. }
  20. public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
  21. }
  22. public function startTest(PHPUnit_Framework_Test $test) {
  23. }
  24. public function endTest(PHPUnit_Framework_Test $test, $time) {
  25. // reopen the session - only allowed for memory session
  26. if (\OC::$server->getSession() instanceof \OC\Session\Memory) {
  27. /** @var $session \OC\Session\Memory */
  28. $session = \OC::$server->getSession();
  29. $session->reopen();
  30. }
  31. }
  32. public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
  33. }
  34. public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
  35. }
  36. }