From db0c3bd53506b2233deebdc35aa8e6f005654962 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 14:29:27 +0200 Subject: [PATCH 1/8] Fix Share20OCSTest --- apps/files_sharing/tests/api/share20ocstest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php index 42a23b43ce1..9a30b8720ed 100644 --- a/apps/files_sharing/tests/api/share20ocstest.php +++ b/apps/files_sharing/tests/api/share20ocstest.php @@ -661,10 +661,9 @@ class Share20OCSTest extends \Test\TestCase { ->with('valid-path') ->willReturn($path); - $user = $this->getMock('\OCP\IUser'); $this->userManager->method('userExists')->with('validUser')->willReturn(true); - $share->method('setPath')->with($path); + $share->method('setNode')->with($path); $share->method('setPermissions') ->with( \OCP\Constants::PERMISSION_ALL & @@ -769,7 +768,7 @@ class Share20OCSTest extends \Test\TestCase { ->method('allowGroupSharing') ->willReturn(true); - $share->method('setPath')->with($path); + $share->method('setNode')->with($path); $share->method('setPermissions')->with(\OCP\Constants::PERMISSION_ALL); $share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_GROUP); $share->method('setSharedWith')->with('validGroup'); @@ -818,7 +817,7 @@ class Share20OCSTest extends \Test\TestCase { ->method('allowGroupSharing') ->willReturn(false); - $share->method('setPath')->with($path); + $share->method('setNode')->with($path); $expected = new \OC_OCS_Result(null, 404, 'group sharing is disabled by the administrator'); $result = $this->ocs->createShare(); From e65e7a5ad72c26226dc9023083677631ed6542b5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 14:31:06 +0200 Subject: [PATCH 2/8] Fix ShareManager tests --- tests/lib/share20/managertest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index d8eb3e0a31e..d173f86f091 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -579,7 +579,7 @@ class ManagerTest extends \Test\TestCase { $share->method('getShareType')->willReturn($type); $share->method('getSharedWith')->willReturn($sharedWith); $share->method('getSharedBy')->willReturn($sharedBy); - $share->method('getSharedOwner')->willReturn($shareOwner); + $share->method('getShareOwner')->willReturn($shareOwner); $share->method('getNode')->willReturn($path); $share->method('getPermissions')->willReturn($permissions); $share->method('getExpirationDate')->willReturn($expireDate); From b9b19cef41b5125a5b3e303ffef2187903ee5c1a Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 14:32:15 +0200 Subject: [PATCH 3/8] Fix avatar controller tests --- tests/core/controller/avatarcontrollertest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/controller/avatarcontrollertest.php b/tests/core/controller/avatarcontrollertest.php index 8e5e58904a7..c99b69228b1 100644 --- a/tests/core/controller/avatarcontrollertest.php +++ b/tests/core/controller/avatarcontrollertest.php @@ -93,7 +93,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->container['UserSession']->method('getUser')->willReturn($this->userMock); $this->avatarFile = $this->getMock('OCP\Files\File'); - $this->avatarFile->method('getContnet')->willReturn('image data'); + $this->avatarFile->method('getContent')->willReturn('image data'); $this->avatarFile->method('getMimeType')->willReturn('image type'); $this->avatarFile->method('getEtag')->willReturn('my etag'); } From f9ade49c7e22ce1ae06ec92aea871622673826f5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 14:41:30 +0200 Subject: [PATCH 4/8] Fix notification tests --- tests/lib/notification/notificationtest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/notification/notificationtest.php index ee9454c77a0..c6ededf0142 100644 --- a/tests/lib/notification/notificationtest.php +++ b/tests/lib/notification/notificationtest.php @@ -517,6 +517,7 @@ class NotificationTest extends TestCase { ->setMethods([ 'isValidCommon', 'getSubject', + 'getParsedSubject', ]) ->getMock(); @@ -548,6 +549,7 @@ class NotificationTest extends TestCase { ->setMethods([ 'isValidCommon', 'getParsedSubject', + 'getSubject', ]) ->getMock(); From 2a0244df270f20aa38f4685daf7327926ff6fa98 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 14:47:23 +0200 Subject: [PATCH 5/8] Fix mappertest --- tests/lib/appframework/db/mappertest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/lib/appframework/db/mappertest.php b/tests/lib/appframework/db/mappertest.php index c8b999ad62c..108e4eee28e 100644 --- a/tests/lib/appframework/db/mappertest.php +++ b/tests/lib/appframework/db/mappertest.php @@ -22,10 +22,11 @@ */ -namespace OCP\AppFramework\Db; +namespace Test\AppFramework\Db; use \OCP\IDBConnection; -use Test\AppFramework\Db\MapperTestUtility; +use \OCP\AppFramework\Db\Entity; +use \OCP\AppFramework\Db\Mapper; /** * @method integer getId() @@ -236,7 +237,7 @@ class MapperTest extends MapperTestUtility { $entity->resetUpdatedFields(); $this->db->expects($this->never()) - ->method('prepareQuery'); + ->method('prepare'); $this->mapper->update($entity); } From 4c9e257b27cd69fdb68abe3ac6559b56468224d3 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 15:03:17 +0200 Subject: [PATCH 6/8] Fix filesplugin --- apps/dav/tests/unit/connector/sabre/filesplugin.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/dav/tests/unit/connector/sabre/filesplugin.php b/apps/dav/tests/unit/connector/sabre/filesplugin.php index e88066a12da..fb08ee170c4 100644 --- a/apps/dav/tests/unit/connector/sabre/filesplugin.php +++ b/apps/dav/tests/unit/connector/sabre/filesplugin.php @@ -84,6 +84,7 @@ class FilesPlugin extends \Test\TestCase { $node = $this->getMockBuilder($class) ->disableOriginalConstructor() ->getMock(); + $node->expects($this->any()) ->method('getId') ->will($this->returnValue(123)); @@ -164,7 +165,9 @@ class FilesPlugin extends \Test\TestCase { } public function testGetPropertiesForFileHome() { - $node = $this->createTestNode('\OCA\DAV\Files\FilesHome'); + $node = $this->getMockBuilder('\OCA\DAV\Files\FilesHome') + ->disableOriginalConstructor() + ->getMock(); $propFind = new \Sabre\DAV\PropFind( '/dummyPath', @@ -185,9 +188,6 @@ class FilesPlugin extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $user->expects($this->never())->method('getUID'); $user->expects($this->never())->method('getDisplayName'); - $node->expects($this->never())->method('getDirectDownload'); - $node->expects($this->never())->method('getOwner'); - $node->expects($this->never())->method('getSize'); $this->plugin->handleGetProperties( $propFind, @@ -276,8 +276,6 @@ class FilesPlugin extends \Test\TestCase { 0 ); - $node->expects($this->never()) - ->method('getDirectDownload'); $node->expects($this->once()) ->method('getSize') ->will($this->returnValue(1025)); From 7f4f0b20ad1ed7dc0386dcc3e97e84ad7ff7c067 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 15:14:37 +0200 Subject: [PATCH 7/8] Fix encryption tests --- apps/encryption/tests/lib/MigrationTest.php | 4 ---- apps/encryption/tests/lib/crypto/encryptionTest.php | 3 --- 2 files changed, 7 deletions(-) diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php index 6edb8624e70..18f7c8b35d5 100644 --- a/apps/encryption/tests/lib/MigrationTest.php +++ b/apps/encryption/tests/lib/MigrationTest.php @@ -512,13 +512,9 @@ class MigrationTest extends \Test\TestCase { */ public function testGetTargetDir($user, $keyPath, $filename, $trash, $systemMounts, $expected) { - $updater = $this->getMockBuilder('\OC\Files\Cache\Updater') - ->disableOriginalConstructor()->getMock(); $view = $this->getMockBuilder('\OC\Files\View') ->disableOriginalConstructor()->getMock(); $view->expects($this->any())->method('file_exists')->willReturn(true); - $view->expects($this->any())->method('getUpdater')->willReturn($updater); - $m = $this->getMockBuilder('OCA\Encryption\Migration') ->setConstructorArgs( diff --git a/apps/encryption/tests/lib/crypto/encryptionTest.php b/apps/encryption/tests/lib/crypto/encryptionTest.php index 8a228c2c215..ad20efb4451 100644 --- a/apps/encryption/tests/lib/crypto/encryptionTest.php +++ b/apps/encryption/tests/lib/crypto/encryptionTest.php @@ -142,9 +142,6 @@ class EncryptionTest extends TestCase { $this->cryptMock->expects($this->any()) ->method('multiKeyEncrypt') ->willReturn(true); - $this->cryptMock->expects($this->any()) - ->method('setAllFileKeys') - ->willReturn(true); $this->instance->end('/foo/bar'); } From 2c77bfa0d087cfdd6512264301b457ca9e9745c1 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 8 Apr 2016 15:18:24 +0200 Subject: [PATCH 8/8] Fix dav comments --- apps/dav/tests/unit/comments/commentsplugin.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/apps/dav/tests/unit/comments/commentsplugin.php b/apps/dav/tests/unit/comments/commentsplugin.php index c7d073d1491..c909f6a61ab 100644 --- a/apps/dav/tests/unit/comments/commentsplugin.php +++ b/apps/dav/tests/unit/comments/commentsplugin.php @@ -449,16 +449,6 @@ class CommentsPlugin extends \Test\TestCase { ->with('users', 'alice', 'files', '42') ->will($this->returnValue($comment)); - $this->commentsManager->expects($this->any()) - ->method('setMessage') - ->with('') - ->will($this->throwException(new \InvalidArgumentException())); - - $this->commentsManager->expects($this->any()) - ->method('setVerb') - ->with('') - ->will($this->throwException(new \InvalidArgumentException())); - $this->userSession->expects($this->once()) ->method('getUser') ->will($this->returnValue($user));