diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-10 21:59:39 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-10 21:59:39 +0200 |
commit | f9683aaf3d23d02cccdd65843bfd6c01f2e2bdad (patch) | |
tree | 9dc12bec6e1266029a096e2aa8c34b3ab7e40af9 | |
parent | 4d09e2453e20e451e1cec9c6a91eeed40543d3cc (diff) | |
parent | 2c77bfa0d087cfdd6512264301b457ca9e9745c1 (diff) | |
download | nextcloud-server-f9683aaf3d23d02cccdd65843bfd6c01f2e2bdad.tar.gz nextcloud-server-f9683aaf3d23d02cccdd65843bfd6c01f2e2bdad.zip |
Merge pull request #23863 from owncloud/fix_unit_tests
Fix unit tests warnings
-rw-r--r-- | apps/dav/tests/unit/comments/commentsplugin.php | 10 | ||||
-rw-r--r-- | apps/dav/tests/unit/connector/sabre/filesplugin.php | 10 | ||||
-rw-r--r-- | apps/encryption/tests/lib/MigrationTest.php | 4 | ||||
-rw-r--r-- | apps/encryption/tests/lib/crypto/encryptionTest.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/tests/api/share20ocstest.php | 7 | ||||
-rw-r--r-- | tests/core/controller/avatarcontrollertest.php | 2 | ||||
-rw-r--r-- | tests/lib/appframework/db/mappertest.php | 7 | ||||
-rw-r--r-- | tests/lib/notification/notificationtest.php | 2 | ||||
-rw-r--r-- | tests/lib/share20/managertest.php | 2 |
9 files changed, 15 insertions, 32 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)); 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)); 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'); } 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(); 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'); } 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); } 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(); 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); |