summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-02-23 15:26:12 +0100
committerRobin Appelman <icewind@owncloud.com>2015-02-25 15:09:41 +0100
commita39c7bf4643fdaa17e62ea503fede1c2f4a30d35 (patch)
tree15408c60659e1d866d66a9b4f07774897437ee19 /tests/lib
parent8213f8d67d5a73b43b871d305e911e22b4144f79 (diff)
downloadnextcloud-server-a39c7bf4643fdaa17e62ea503fede1c2f4a30d35.tar.gz
nextcloud-server-a39c7bf4643fdaa17e62ea503fede1c2f4a30d35.zip
Add FileAccess trait for commands
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/command/asyncbus.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/command/asyncbus.php b/tests/lib/command/asyncbus.php
index 030c416953d..d22ce34d839 100644
--- a/tests/lib/command/asyncbus.php
+++ b/tests/lib/command/asyncbus.php
@@ -9,6 +9,7 @@
namespace Test\Command;
+use OC\Command\FileAccess;
use OCP\Command\ICommand;
use Test\BackgroundJob\DummyJobList;
use Test\TestCase;
@@ -31,6 +32,14 @@ class StateFullCommand implements ICommand {
}
}
+class FilesystemCommand implements ICommand {
+ use FileAccess;
+
+ public function handle() {
+ AsyncBus::$lastCommand = 'FileAccess';
+ }
+}
+
function basicFunction() {
AsyncBus::$lastCommand = 'function';
}
@@ -133,6 +142,22 @@ class AsyncBus extends TestCase {
$this->assertEquals('closure-bar', self::$lastCommand);
}
+ public function testFileFileAccessCommand() {
+ $this->bus->push(new FilesystemCommand());
+ $this->assertEquals('', self::$lastCommand);
+ $this->runJobs();
+ $this->assertEquals('FileAccess', self::$lastCommand);
+ }
+
+ public function testFileFileAccessCommandSync() {
+ $this->bus->requireSync('\OC\Command\FileAccess');
+ $this->bus->push(new FilesystemCommand());
+ $this->assertEquals('FileAccess', self::$lastCommand);
+ self::$lastCommand = '';
+ $this->runJobs();
+ $this->assertEquals('', self::$lastCommand);
+ }
+
private function runJobs() {
$jobs = $this->jobList->getAll();