diff options
author | icewind1991 <robin@icewind.nl> | 2014-05-30 14:58:59 +0200 |
---|---|---|
committer | icewind1991 <robin@icewind.nl> | 2014-05-30 14:58:59 +0200 |
commit | 2ba5701b1af3ba37061fa0e5fa85aac7abaabea4 (patch) | |
tree | 880ca8c8cfbf48a103b42571645668eb918898c1 /tests | |
parent | 517501ffbf369b24191d8b9a9f2ce44a9891fb97 (diff) | |
parent | 998fa2d9be4a876cec00073b0706a793276ddd8f (diff) | |
download | nextcloud-server-2ba5701b1af3ba37061fa0e5fa85aac7abaabea4.tar.gz nextcloud-server-2ba5701b1af3ba37061fa0e5fa85aac7abaabea4.zip |
Merge pull request #8778 from owncloud/storage-instanceof
Add storage->instanceOfStorage() to handle instanceof with storage wrappers
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/storage.php | 6 | ||||
-rw-r--r-- | tests/lib/files/storage/wrapper/quota.php | 6 | ||||
-rw-r--r-- | tests/lib/files/storage/wrapper/wrapper.php | 5 |
3 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index 24390f05367..dd73491d7ee 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -464,4 +464,10 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt')); } + + 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 777529fd85e..954fe199cc8 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -155,4 +155,10 @@ class Quota extends \Test\Files\Storage\Storage { $this->assertEquals(1024 - 50, $instance->free_space('')); } + + 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')); + } } |