Merge pull request #23863 from owncloud/fix_unit_tests
Fix unit tests warnings
This commit is contained in:
commit
f9683aaf3d
|
@ -449,16 +449,6 @@ class CommentsPlugin extends \Test\TestCase {
|
||||||
->with('users', 'alice', 'files', '42')
|
->with('users', 'alice', 'files', '42')
|
||||||
->will($this->returnValue($comment));
|
->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())
|
$this->userSession->expects($this->once())
|
||||||
->method('getUser')
|
->method('getUser')
|
||||||
->will($this->returnValue($user));
|
->will($this->returnValue($user));
|
||||||
|
|
|
@ -84,6 +84,7 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
$node = $this->getMockBuilder($class)
|
$node = $this->getMockBuilder($class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$node->expects($this->any())
|
$node->expects($this->any())
|
||||||
->method('getId')
|
->method('getId')
|
||||||
->will($this->returnValue(123));
|
->will($this->returnValue(123));
|
||||||
|
@ -164,7 +165,9 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPropertiesForFileHome() {
|
public function testGetPropertiesForFileHome() {
|
||||||
$node = $this->createTestNode('\OCA\DAV\Files\FilesHome');
|
$node = $this->getMockBuilder('\OCA\DAV\Files\FilesHome')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
|
||||||
$propFind = new \Sabre\DAV\PropFind(
|
$propFind = new \Sabre\DAV\PropFind(
|
||||||
'/dummyPath',
|
'/dummyPath',
|
||||||
|
@ -185,9 +188,6 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
->disableOriginalConstructor()->getMock();
|
->disableOriginalConstructor()->getMock();
|
||||||
$user->expects($this->never())->method('getUID');
|
$user->expects($this->never())->method('getUID');
|
||||||
$user->expects($this->never())->method('getDisplayName');
|
$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(
|
$this->plugin->handleGetProperties(
|
||||||
$propFind,
|
$propFind,
|
||||||
|
@ -276,8 +276,6 @@ class FilesPlugin extends \Test\TestCase {
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
$node->expects($this->never())
|
|
||||||
->method('getDirectDownload');
|
|
||||||
$node->expects($this->once())
|
$node->expects($this->once())
|
||||||
->method('getSize')
|
->method('getSize')
|
||||||
->will($this->returnValue(1025));
|
->will($this->returnValue(1025));
|
||||||
|
|
|
@ -512,13 +512,9 @@ class MigrationTest extends \Test\TestCase {
|
||||||
*/
|
*/
|
||||||
public function testGetTargetDir($user, $keyPath, $filename, $trash, $systemMounts, $expected) {
|
public function testGetTargetDir($user, $keyPath, $filename, $trash, $systemMounts, $expected) {
|
||||||
|
|
||||||
$updater = $this->getMockBuilder('\OC\Files\Cache\Updater')
|
|
||||||
->disableOriginalConstructor()->getMock();
|
|
||||||
$view = $this->getMockBuilder('\OC\Files\View')
|
$view = $this->getMockBuilder('\OC\Files\View')
|
||||||
->disableOriginalConstructor()->getMock();
|
->disableOriginalConstructor()->getMock();
|
||||||
$view->expects($this->any())->method('file_exists')->willReturn(true);
|
$view->expects($this->any())->method('file_exists')->willReturn(true);
|
||||||
$view->expects($this->any())->method('getUpdater')->willReturn($updater);
|
|
||||||
|
|
||||||
|
|
||||||
$m = $this->getMockBuilder('OCA\Encryption\Migration')
|
$m = $this->getMockBuilder('OCA\Encryption\Migration')
|
||||||
->setConstructorArgs(
|
->setConstructorArgs(
|
||||||
|
|
|
@ -142,9 +142,6 @@ class EncryptionTest extends TestCase {
|
||||||
$this->cryptMock->expects($this->any())
|
$this->cryptMock->expects($this->any())
|
||||||
->method('multiKeyEncrypt')
|
->method('multiKeyEncrypt')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
$this->cryptMock->expects($this->any())
|
|
||||||
->method('setAllFileKeys')
|
|
||||||
->willReturn(true);
|
|
||||||
|
|
||||||
$this->instance->end('/foo/bar');
|
$this->instance->end('/foo/bar');
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,10 +661,9 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
->with('valid-path')
|
->with('valid-path')
|
||||||
->willReturn($path);
|
->willReturn($path);
|
||||||
|
|
||||||
$user = $this->getMock('\OCP\IUser');
|
|
||||||
$this->userManager->method('userExists')->with('validUser')->willReturn(true);
|
$this->userManager->method('userExists')->with('validUser')->willReturn(true);
|
||||||
|
|
||||||
$share->method('setPath')->with($path);
|
$share->method('setNode')->with($path);
|
||||||
$share->method('setPermissions')
|
$share->method('setPermissions')
|
||||||
->with(
|
->with(
|
||||||
\OCP\Constants::PERMISSION_ALL &
|
\OCP\Constants::PERMISSION_ALL &
|
||||||
|
@ -769,7 +768,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
->method('allowGroupSharing')
|
->method('allowGroupSharing')
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$share->method('setPath')->with($path);
|
$share->method('setNode')->with($path);
|
||||||
$share->method('setPermissions')->with(\OCP\Constants::PERMISSION_ALL);
|
$share->method('setPermissions')->with(\OCP\Constants::PERMISSION_ALL);
|
||||||
$share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_GROUP);
|
$share->method('setShareType')->with(\OCP\Share::SHARE_TYPE_GROUP);
|
||||||
$share->method('setSharedWith')->with('validGroup');
|
$share->method('setSharedWith')->with('validGroup');
|
||||||
|
@ -818,7 +817,7 @@ class Share20OCSTest extends \Test\TestCase {
|
||||||
->method('allowGroupSharing')
|
->method('allowGroupSharing')
|
||||||
->willReturn(false);
|
->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');
|
$expected = new \OC_OCS_Result(null, 404, 'group sharing is disabled by the administrator');
|
||||||
$result = $this->ocs->createShare();
|
$result = $this->ocs->createShare();
|
||||||
|
|
|
@ -93,7 +93,7 @@ class AvatarControllerTest extends \Test\TestCase {
|
||||||
$this->container['UserSession']->method('getUser')->willReturn($this->userMock);
|
$this->container['UserSession']->method('getUser')->willReturn($this->userMock);
|
||||||
|
|
||||||
$this->avatarFile = $this->getMock('OCP\Files\File');
|
$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('getMimeType')->willReturn('image type');
|
||||||
$this->avatarFile->method('getEtag')->willReturn('my etag');
|
$this->avatarFile->method('getEtag')->willReturn('my etag');
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace OCP\AppFramework\Db;
|
namespace Test\AppFramework\Db;
|
||||||
|
|
||||||
use \OCP\IDBConnection;
|
use \OCP\IDBConnection;
|
||||||
use Test\AppFramework\Db\MapperTestUtility;
|
use \OCP\AppFramework\Db\Entity;
|
||||||
|
use \OCP\AppFramework\Db\Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method integer getId()
|
* @method integer getId()
|
||||||
|
@ -236,7 +237,7 @@ class MapperTest extends MapperTestUtility {
|
||||||
$entity->resetUpdatedFields();
|
$entity->resetUpdatedFields();
|
||||||
|
|
||||||
$this->db->expects($this->never())
|
$this->db->expects($this->never())
|
||||||
->method('prepareQuery');
|
->method('prepare');
|
||||||
|
|
||||||
$this->mapper->update($entity);
|
$this->mapper->update($entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,6 +517,7 @@ class NotificationTest extends TestCase {
|
||||||
->setMethods([
|
->setMethods([
|
||||||
'isValidCommon',
|
'isValidCommon',
|
||||||
'getSubject',
|
'getSubject',
|
||||||
|
'getParsedSubject',
|
||||||
])
|
])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
@ -548,6 +549,7 @@ class NotificationTest extends TestCase {
|
||||||
->setMethods([
|
->setMethods([
|
||||||
'isValidCommon',
|
'isValidCommon',
|
||||||
'getParsedSubject',
|
'getParsedSubject',
|
||||||
|
'getSubject',
|
||||||
])
|
])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
|
|
@ -579,7 +579,7 @@ class ManagerTest extends \Test\TestCase {
|
||||||
$share->method('getShareType')->willReturn($type);
|
$share->method('getShareType')->willReturn($type);
|
||||||
$share->method('getSharedWith')->willReturn($sharedWith);
|
$share->method('getSharedWith')->willReturn($sharedWith);
|
||||||
$share->method('getSharedBy')->willReturn($sharedBy);
|
$share->method('getSharedBy')->willReturn($sharedBy);
|
||||||
$share->method('getSharedOwner')->willReturn($shareOwner);
|
$share->method('getShareOwner')->willReturn($shareOwner);
|
||||||
$share->method('getNode')->willReturn($path);
|
$share->method('getNode')->willReturn($path);
|
||||||
$share->method('getPermissions')->willReturn($permissions);
|
$share->method('getPermissions')->willReturn($permissions);
|
||||||
$share->method('getExpirationDate')->willReturn($expireDate);
|
$share->method('getExpirationDate')->willReturn($expireDate);
|
||||||
|
|
Loading…
Reference in New Issue