summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-03-26 19:55:13 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-26 19:55:13 +0100
commitc8c722bc6de3a58e10ba42a55a178d3ba9308bae (patch)
tree6d62aa73cc72596b1bf385cca20e4d8bd9563525 /tests
parent3e57e9d3e557100ba0b51f08a3de7a7e8f79f4bd (diff)
parent6447962f2a3bd845be9ee494f400958371f6e2f9 (diff)
downloadnextcloud-server-c8c722bc6de3a58e10ba42a55a178d3ba9308bae.tar.gz
nextcloud-server-c8c722bc6de3a58e10ba42a55a178d3ba9308bae.zip
Merge pull request #15129 from owncloud/version-command-bus
expire versions in a background command
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/testcase.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php
index 2b4540120d2..d532a3b01c0 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/testcase.php
@@ -23,6 +23,7 @@
namespace Test;
use OC\Command\QueueBus;
+use OC\Files\Filesystem;
use OCP\Security\ISecureRandom;
abstract class TestCase extends \PHPUnit_Framework_TestCase {
@@ -34,11 +35,19 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
protected function setUp() {
// overwrite the command bus with one we can run ourselves
$this->commandBus = new QueueBus();
- \OC::$server->registerService('AsyncCommandBus', function(){
+ \OC::$server->registerService('AsyncCommandBus', function () {
return $this->commandBus;
});
}
+ protected function tearDown() {
+ $hookExceptions = \OC_Hook::$thrownExceptions;
+ \OC_Hook::$thrownExceptions = [];
+ if(!empty($hookExceptions)) {
+ throw $hookExceptions[0];
+ }
+ }
+
/**
* Returns a unique identifier as uniqid() is not reliable sometimes
*
@@ -190,6 +199,20 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
* Run all commands pushed to the bus
*/
protected function runCommands() {
+ // get the user for which the fs is setup
+ $view = Filesystem::getView();
+ if ($view) {
+ list(, $user) = explode('/', $view->getRoot());
+ } else {
+ $user = null;
+ }
+
+ \OC_Util::tearDownFS(); // command cant reply on the fs being setup
$this->commandBus->run();
+ \OC_Util::tearDownFS();
+
+ if ($user) {
+ \OC_Util::setupFS($user);
+ }
}
}