diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-03-24 10:02:48 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-03-26 17:07:02 +0100 |
commit | 3ed6ed3c3674bfc60bcd2fc64edea1820f1be9d0 (patch) | |
tree | e451079d4bc4c276582d55f9666e8803ee2bb222 /tests | |
parent | 7ec8f12ad4f8d05f540c02145eab641f69f8dc04 (diff) | |
download | nextcloud-server-3ed6ed3c3674bfc60bcd2fc64edea1820f1be9d0.tar.gz nextcloud-server-3ed6ed3c3674bfc60bcd2fc64edea1820f1be9d0.zip |
Force test cases using background commands to handle setting up the filesystem
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/testcase.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php index 2b4540120d2..f4bb8479559 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,7 +35,7 @@ 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; }); } @@ -190,6 +191,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); + } } } |