diff options
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/FileTest.php')
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/FileTest.php | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php index e2666d0de27..3a2075941ae 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -27,7 +27,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; use OC\Files\Storage\Local; +use OC\Files\View; use OCP\Files\ForbiddenException; +use OCP\Files\Storage; use Test\HookHelper; use OC\Files\Filesystem; use OCP\Lock\ILockingProvider; @@ -70,7 +72,7 @@ class FileTest extends \Test\TestCase { } private function getMockStorage() { - $storage = $this->getMockBuilder('\OCP\Files\Storage') + $storage = $this->getMockBuilder(Storage::class) ->disableOriginalConstructor() ->getMock(); $storage->expects($this->any()) @@ -151,12 +153,12 @@ class FileTest extends \Test\TestCase { */ public function testSimplePutFails($thrownException, $expectedException, $checkPreviousClass = true) { // setup - $storage = $this->getMockBuilder('\OC\Files\Storage\Local') + $storage = $this->getMockBuilder(Local::class) ->setMethods(['fopen']) ->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]) ->getMock(); \OC\Files\Filesystem::mount($storage, [], $this->user . '/'); - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['getRelativePath', 'resolvePath']) ->getMock(); $view->expects($this->atLeastOnce()) @@ -210,12 +212,12 @@ class FileTest extends \Test\TestCase { */ public function testChunkedPutFails($thrownException, $expectedException, $checkPreviousClass = false) { // setup - $storage = $this->getMockBuilder('\OC\Files\Storage\Local') + $storage = $this->getMockBuilder(Local::class) ->setMethods(['fopen']) ->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]) ->getMock(); \OC\Files\Filesystem::mount($storage, [], $this->user . '/'); - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['getRelativePath', 'resolvePath']) ->getMock(); $view->expects($this->atLeastOnce()) @@ -535,7 +537,7 @@ class FileTest extends \Test\TestCase { */ public function testSimplePutFailsSizeCheck() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['rename', 'getRelativePath', 'filesize']) ->getMock(); $view->expects($this->any()) @@ -653,7 +655,7 @@ class FileTest extends \Test\TestCase { */ public function testSimplePutInvalidChars() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['getRelativePath']) ->getMock(); $view->expects($this->any()) @@ -690,7 +692,7 @@ class FileTest extends \Test\TestCase { */ public function testSetNameInvalidChars() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['getRelativePath']) ->getMock(); @@ -709,7 +711,7 @@ class FileTest extends \Test\TestCase { */ public function testUploadAbort() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['rename', 'getRelativePath', 'filesize']) ->getMock(); $view->expects($this->any()) @@ -755,7 +757,7 @@ class FileTest extends \Test\TestCase { */ public function testDeleteWhenAllowed() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->getMock(); $view->expects($this->once()) @@ -777,7 +779,7 @@ class FileTest extends \Test\TestCase { */ public function testDeleteThrowsWhenDeletionNotAllowed() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->getMock(); $info = new \OC\Files\FileInfo('/test.txt', $this->getMockStorage(), null, array( @@ -795,7 +797,7 @@ class FileTest extends \Test\TestCase { */ public function testDeleteThrowsWhenDeletionFailed() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->getMock(); // but fails @@ -818,7 +820,7 @@ class FileTest extends \Test\TestCase { */ public function testDeleteThrowsWhenDeletionThrows() { // setup - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->getMock(); // but fails @@ -968,7 +970,7 @@ class FileTest extends \Test\TestCase { * @expectedException \Sabre\DAV\Exception\ServiceUnavailable */ public function testGetFopenFails() { - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['fopen']) ->getMock(); $view->expects($this->atLeastOnce()) @@ -988,7 +990,7 @@ class FileTest extends \Test\TestCase { * @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden */ public function testGetFopenThrows() { - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['fopen']) ->getMock(); $view->expects($this->atLeastOnce()) @@ -1008,7 +1010,7 @@ class FileTest extends \Test\TestCase { * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetThrowsIfNoPermission() { - $view = $this->getMockBuilder('\OC\Files\View') + $view = $this->getMockBuilder(View::class) ->setMethods(['fopen']) ->getMock(); $view->expects($this->never()) |