summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-05-29 13:45:50 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-04 14:17:52 +0200
commit79b953a9200f653bc2dcdd395dbb14e1df79ad75 (patch)
tree5283e15ecaa6e3a62fe38aa9547d35ec11011b73 /tests
parentd3445d9668461d0cfd2ce9873908f7e23c32ba72 (diff)
downloadnextcloud-server-79b953a9200f653bc2dcdd395dbb14e1df79ad75.tar.gz
nextcloud-server-79b953a9200f653bc2dcdd395dbb14e1df79ad75.zip
Add ->instanceOfStorage to handle instanceof for storage wrappers
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/files/storage/storage.php6
-rw-r--r--tests/lib/files/storage/wrapper/quota.php6
-rw-r--r--tests/lib/files/storage/wrapper/wrapper.php5
3 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 182c014d999..196cd017aaf 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -279,4 +279,10 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->assertFalse($this->instance->file_exists('folder/bar'));
$this->assertFalse($this->instance->file_exists('folder'));
}
+
+ public function testInstanceOfStorage() {
+ $this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage'));
+ $this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance)));
+ $this->assertFalse($this->instance->instanceOfStorage('\OC'));
+ }
}
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index ccf2a8cb74d..2c87800ee94 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -133,4 +133,10 @@ class Quota extends \Test\Files\Storage\Storage {
$this->assertEquals('user-space', $meta['wrapper_type']);
fclose($stream);
}
+
+ public function testInstanceOfStorageWrapper() {
+ $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local'));
+ $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper'));
+ $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota'));
+ }
}
diff --git a/tests/lib/files/storage/wrapper/wrapper.php b/tests/lib/files/storage/wrapper/wrapper.php
index e31abfc7324..8bcf42035d4 100644
--- a/tests/lib/files/storage/wrapper/wrapper.php
+++ b/tests/lib/files/storage/wrapper/wrapper.php
@@ -23,4 +23,9 @@ class Wrapper extends \Test\Files\Storage\Storage {
public function tearDown() {
\OC_Helper::rmdirr($this->tmpDir);
}
+
+ public function testInstanceOfStorageWrapper() {
+ $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local'));
+ $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper'));
+ }
}