Merge pull request #6939 from nextcloud/class-usage-in-mocks-dav-app
Use ::class in test mocks of dav app
This commit is contained in:
commit
06f46bd256
|
@ -46,8 +46,8 @@ class ConverterTest extends TestCase {
|
|||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->databaseConnection = $this->getMockBuilder('OCP\IDBConnection')->getMock();
|
||||
$this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')
|
||||
$this->databaseConnection = $this->getMockBuilder(IDBConnection::class)->getMock();
|
||||
$this->eventDispatcher = $this->getMockBuilder(EventDispatcher::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->accountManager = $this->getMockBuilder(AccountManager::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
|
@ -47,7 +47,7 @@ class PluginTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
|
||||
$authBackend = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Auth')->disableOriginalConstructor()->getMock();
|
||||
$authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
|
||||
$authBackend->method('isDavAuthenticated')->willReturn(true);
|
||||
|
||||
/** @var IRequest $request */
|
||||
|
@ -57,7 +57,7 @@ class PluginTest extends TestCase {
|
|||
$root = new SimpleCollection('root');
|
||||
$this->server = new \Sabre\DAV\Server($root);
|
||||
/** @var SimpleCollection $node */
|
||||
$this->book = $this->getMockBuilder('OCA\DAV\DAV\Sharing\IShareable')->disableOriginalConstructor()->getMock();
|
||||
$this->book = $this->getMockBuilder(IShareable::class)->disableOriginalConstructor()->getMock();
|
||||
$this->book->method('getName')->willReturn('addressbook1.vcf');
|
||||
$root->addChild($this->book);
|
||||
$this->plugin->initialize($this->server);
|
||||
|
|
|
@ -33,6 +33,7 @@ use OCP\ILogger;
|
|||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
use Sabre\DAV\PropPatch;
|
||||
|
||||
class CommentsNodeTest extends \Test\TestCase {
|
||||
|
||||
|
@ -361,7 +362,7 @@ class CommentsNodeTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testPropPatch() {
|
||||
$propPatch = $this->getMockBuilder('Sabre\DAV\PropPatch')
|
||||
$propPatch = $this->getMockBuilder(PropPatch::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ use OCP\IRequest;
|
|||
use OCP\ISession;
|
||||
use OCP\Share\Exceptions\ShareNotFound;
|
||||
use OCP\Share\IManager;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
/**
|
||||
* Class PublicAuthTest
|
||||
|
@ -94,7 +95,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testShareNoPassword() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn(null);
|
||||
|
@ -109,7 +110,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSharePasswordFancyShareType() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -126,7 +127,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testSharePasswordRemote() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -142,7 +143,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSharePasswordLinkValidPassword() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -164,7 +165,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSharePasswordMailValidPassword() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -186,7 +187,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSharePasswordLinkValidSession() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -212,7 +213,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testSharePasswordLinkInvalidSession() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
@ -239,7 +240,7 @@ class PublicAuthTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testSharePasswordMailInvalidSession() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')
|
||||
$share = $this->getMockBuilder(IShare::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
|
|
|
@ -29,6 +29,7 @@ use OCA\DAV\Connector\Sabre\File;
|
|||
use OCP\Comments\ICommentsManager;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use Sabre\DAV\PropFind;
|
||||
|
||||
class CommentsPropertiesPluginTest extends \Test\TestCase {
|
||||
|
||||
|
@ -77,7 +78,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
|
|||
* @param $expectedSuccessful
|
||||
*/
|
||||
public function testHandleGetProperties($node, $expectedSuccessful) {
|
||||
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
|
||||
$propFind = $this->getMockBuilder(PropFind::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
||||
|
||||
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\DAV\Tree;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
@ -68,13 +70,13 @@ class CopyEtagHeaderPluginTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testAfterMove() {
|
||||
$node = $this->getMockBuilder('OCA\DAV\Connector\Sabre\File')
|
||||
$node = $this->getMockBuilder(File::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->once())
|
||||
->method('getETag')
|
||||
->willReturn('123456');
|
||||
$tree = $this->getMockBuilder('Sabre\DAV\Tree')
|
||||
$tree = $this->getMockBuilder(Tree::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tree->expects($this->once())
|
||||
|
|
|
@ -31,8 +31,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use OCP\IUser;
|
||||
use Sabre\DAV\File;
|
||||
use Sabre\DAV\Tree;
|
||||
|
||||
/**
|
||||
|
@ -179,7 +180,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
|
|||
* Test setting/getting properties
|
||||
*/
|
||||
public function testSetGetPropertiesForFile() {
|
||||
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||
$node = $this->createTestNode(File::class);
|
||||
$this->tree->expects($this->any())
|
||||
->method('getNodeForPath')
|
||||
->with('/dummypath')
|
||||
|
@ -211,7 +212,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
|
|||
* Test getting properties from directory
|
||||
*/
|
||||
public function testGetPropertiesForDirectory() {
|
||||
$rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory');
|
||||
$rootNode = $this->createTestNode(Directory::class);
|
||||
|
||||
$nodeSub = $this->getMockBuilder(File::class)
|
||||
->disableOriginalConstructor()
|
||||
|
@ -295,7 +296,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
|
|||
* Test delete property
|
||||
*/
|
||||
public function testDeleteProperty() {
|
||||
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File');
|
||||
$node = $this->createTestNode(File::class);
|
||||
$this->tree->expects($this->any())
|
||||
->method('getNodeForPath')
|
||||
->with('/dummypath')
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
namespace OCA\DAV\Tests\Unit\Connector\Sabre;
|
||||
|
||||
use OC\Files\Storage\Wrapper\Quota;
|
||||
use OCP\Files\ForbiddenException;
|
||||
use OC\Files\FileInfo;
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
|
@ -179,10 +180,10 @@ class DirectoryTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetChildren() {
|
||||
$info1 = $this->getMockBuilder('OC\Files\FileInfo')
|
||||
$info1 = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$info2 = $this->getMockBuilder('OC\Files\FileInfo')
|
||||
$info2 = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$info1->expects($this->any())
|
||||
|
@ -269,7 +270,7 @@ class DirectoryTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetQuotaInfoUnlimited() {
|
||||
$storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
|
||||
$storage = $this->getMockBuilder(Quota::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -300,7 +301,7 @@ class DirectoryTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetQuotaInfoSpecific() {
|
||||
$storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota')
|
||||
$storage = $this->getMockBuilder(Quota::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
|
||||
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\HTTP\RequestInterface;
|
||||
use Sabre\HTTP\ResponseInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
@ -60,11 +62,11 @@ class DummyGetResponsePluginTest extends TestCase {
|
|||
|
||||
public function testHttpGet() {
|
||||
/** @var \Sabre\HTTP\RequestInterface $request */
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
$request = $this->getMockBuilder(RequestInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
/** @var \Sabre\HTTP\ResponseInterface $response */
|
||||
$response = $server = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface')
|
||||
$response = $server = $this->getMockBuilder(ResponseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$response
|
||||
|
|
|
@ -26,8 +26,11 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
|
||||
use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
|
||||
use Sabre\DAV\INode;
|
||||
use Sabre\DAV\PropFind;
|
||||
use Sabre\DAV\Server;
|
||||
use Sabre\HTTP\RequestInterface;
|
||||
use Sabre\HTTP\Response;
|
||||
use Sabre\HTTP\ResponseInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +88,7 @@ class FakeLockerPluginTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testPropFind() {
|
||||
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind')
|
||||
$propFind = $this->getMockBuilder(PropFind::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node = $this->getMockBuilder(INode::class)
|
||||
|
@ -145,7 +148,7 @@ class FakeLockerPluginTest extends TestCase {
|
|||
* @param array $expected
|
||||
*/
|
||||
public function testValidateTokens(array $input, array $expected) {
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
$request = $this->getMockBuilder(RequestInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->fakeLockerPlugin->validateTokens($request, $input);
|
||||
|
@ -153,7 +156,7 @@ class FakeLockerPluginTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testFakeLockProvider() {
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
$request = $this->getMockBuilder(RequestInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$response = new Response();
|
||||
|
@ -173,10 +176,10 @@ class FakeLockerPluginTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testFakeUnlockProvider() {
|
||||
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface')
|
||||
$request = $this->getMockBuilder(RequestInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$response = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface')
|
||||
$response = $this->getMockBuilder(ResponseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -882,7 +882,7 @@ class FileTest extends \Test\TestCase {
|
|||
|
||||
$wasLockedPre = false;
|
||||
$wasLockedPost = false;
|
||||
$eventHandler = $this->getMockBuilder('\stdclass')
|
||||
$eventHandler = $this->getMockBuilder(\stdclass::class)
|
||||
->setMethods(['writeCallback', 'postWriteCallback'])
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
*/
|
||||
namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
||||
|
||||
use OC\User\User;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use OCA\DAV\Connector\Sabre\FilesPlugin;
|
||||
use OCA\DAV\Connector\Sabre\Node;
|
||||
use OCP\Files\StorageNotAvailableException;
|
||||
use OCP\IConfig;
|
||||
use OCP\IPreview;
|
||||
|
@ -188,7 +190,7 @@ class FilesPluginTest extends TestCase {
|
|||
0
|
||||
);
|
||||
|
||||
$user = $this->getMockBuilder('\OC\User\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$user
|
||||
->expects($this->once())
|
||||
|
@ -457,14 +459,14 @@ class FilesPluginTest extends TestCase {
|
|||
* @expectedExceptionMessage FolderA/test.txt cannot be deleted
|
||||
*/
|
||||
public function testMoveSrcNotDeletable() {
|
||||
$fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo')
|
||||
$fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$fileInfoFolderATestTXT->expects($this->once())
|
||||
->method('isDeletable')
|
||||
->willReturn(false);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->once())
|
||||
|
@ -478,14 +480,14 @@ class FilesPluginTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testMoveSrcDeletable() {
|
||||
$fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo')
|
||||
$fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$fileInfoFolderATestTXT->expects($this->once())
|
||||
->method('isDeletable')
|
||||
->willReturn(true);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->once())
|
||||
|
@ -503,7 +505,7 @@ class FilesPluginTest extends TestCase {
|
|||
* @expectedExceptionMessage FolderA/test.txt does not exist
|
||||
*/
|
||||
public function testMoveSrcNotExist() {
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->once())
|
||||
|
|
|
@ -33,6 +33,7 @@ use OCP\IRequest;
|
|||
use OCP\ITagManager;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\SystemTag\ISystemTag;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
use OC\Files\View;
|
||||
use OCP\Files\Folder;
|
||||
|
@ -550,7 +551,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isAdmin')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag1->expects($this->any())
|
||||
|
@ -560,7 +561,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isUserVisible')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag2->expects($this->any())
|
||||
|
@ -599,7 +600,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isAdmin')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag1->expects($this->any())
|
||||
|
@ -609,7 +610,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isUserVisible')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag2->expects($this->any())
|
||||
|
@ -637,7 +638,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isAdmin')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag1 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag1->expects($this->any())
|
||||
|
@ -647,7 +648,7 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
->method('isUserVisible')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag')
|
||||
$tag2 = $this->getMockBuilder(ISystemTag::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$tag2->expects($this->any())
|
||||
|
|
|
@ -25,8 +25,12 @@
|
|||
*/
|
||||
|
||||
namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
||||
use OC\Files\FileInfo;
|
||||
use OC\Files\View;
|
||||
use OCP\Files\Mount\IMountPoint;
|
||||
use OCP\Files\Storage;
|
||||
use OCP\Share\IManager;
|
||||
use OCP\Share\IShare;
|
||||
|
||||
/**
|
||||
* Class NodeTest
|
||||
|
@ -53,7 +57,7 @@ class NodeTest extends \Test\TestCase {
|
|||
* @dataProvider davPermissionsProvider
|
||||
*/
|
||||
public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) {
|
||||
$info = $this->getMockBuilder('\OC\Files\FileInfo')
|
||||
$info = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType'))
|
||||
->getMock();
|
||||
|
@ -126,12 +130,12 @@ class NodeTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
$storage->method('getPermissions')->willReturn($permissions);
|
||||
|
||||
$mountpoint = $this->getMockBuilder('\OCP\Files\Mount\IMountPoint')
|
||||
$mountpoint = $this->getMockBuilder(IMountPoint::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mountpoint->method('getMountPoint')->willReturn('myPath');
|
||||
$shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock();
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->disableOriginalConstructor()->getMock();
|
||||
$shareManager = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->disableOriginalConstructor()->getMock();
|
||||
|
||||
if ($user === null) {
|
||||
$shareManager->expects($this->never())->method('getShareByToken');
|
||||
|
@ -142,7 +146,7 @@ class NodeTest extends \Test\TestCase {
|
|||
$share->expects($this->once())->method('getPermissions')->willReturn($permissions);
|
||||
}
|
||||
|
||||
$info = $this->getMockBuilder('\OC\Files\FileInfo')
|
||||
$info = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['getStorage', 'getType', 'getMountPoint'])
|
||||
->getMock();
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
|
||||
use OC\Files\FileInfo;
|
||||
use OC\Files\Filesystem;
|
||||
use OC\Files\Mount\Manager;
|
||||
use OC\Files\Storage\Temporary;
|
||||
use OC\Files\View;
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
|
@ -159,13 +160,13 @@ class ObjectTreeTest extends \Test\TestCase {
|
|||
$rootNode = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$mountManager = $this->getMockBuilder(Manager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$view = $this->getMockBuilder(View::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo')
|
||||
$fileInfo = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$fileInfo->expects($this->once())
|
||||
|
@ -287,7 +288,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
|||
$rootNode = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$mountManager = $this->getMockBuilder(Manager::class)
|
||||
->getMock();
|
||||
|
||||
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
|
||||
|
@ -314,7 +315,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
|||
$rootNode = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$mountManager = $this->getMockBuilder(Manager::class)
|
||||
->getMock();
|
||||
|
||||
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
|
||||
|
|
|
@ -176,7 +176,7 @@ class QuotaPluginTest extends TestCase {
|
|||
public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) {
|
||||
$this->init($quota, 'sub/test.txt');
|
||||
|
||||
$mockChunking = $this->getMockBuilder('\OC_FileChunking')
|
||||
$mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mockChunking->expects($this->once())
|
||||
|
@ -212,7 +212,7 @@ class QuotaPluginTest extends TestCase {
|
|||
public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
|
||||
$this->init($quota, 'sub/test.txt');
|
||||
|
||||
$mockChunking = $this->getMockBuilder('\OC_FileChunking')
|
||||
$mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mockChunking->expects($this->once())
|
||||
|
|
|
@ -25,10 +25,12 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use OCA\DAV\Connector\Sabre\Node;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\Share\IManager;
|
||||
use OCP\Share\IShare;
|
||||
use Sabre\DAV\Tree;
|
||||
|
||||
class SharesPluginTest extends \Test\TestCase {
|
||||
|
@ -99,7 +101,7 @@ class SharesPluginTest extends \Test\TestCase {
|
|||
* @dataProvider sharesGetPropertiesDataProvider
|
||||
*/
|
||||
public function testGetProperties($shareTypes) {
|
||||
$sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$sabreNode = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$sabreNode->expects($this->any())
|
||||
|
@ -214,7 +216,7 @@ class SharesPluginTest extends \Test\TestCase {
|
|||
->will($this->returnValue($node));
|
||||
|
||||
$dummyShares = array_map(function($type) {
|
||||
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->expects($this->any())
|
||||
->method('getShareType')
|
||||
->will($this->returnValue($type));
|
||||
|
|
|
@ -26,6 +26,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
|
|||
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use OCA\DAV\Connector\Sabre\Node;
|
||||
use OCP\ITagManager;
|
||||
use OCP\ITags;
|
||||
use Sabre\DAV\Tree;
|
||||
|
||||
/**
|
||||
|
@ -71,10 +74,10 @@ class TagsPluginTest extends \Test\TestCase {
|
|||
$this->tree = $this->getMockBuilder(Tree::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagger = $this->getMockBuilder('\OCP\ITags')
|
||||
$this->tagger = $this->getMockBuilder(ITags::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\ITagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ITagManager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagManager->expects($this->any())
|
||||
|
@ -89,7 +92,7 @@ class TagsPluginTest extends \Test\TestCase {
|
|||
* @dataProvider tagsGetPropertiesDataProvider
|
||||
*/
|
||||
public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -264,7 +267,7 @@ class TagsPluginTest extends \Test\TestCase {
|
|||
public function testUpdateTags() {
|
||||
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
||||
// and keep "tagkeep"
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -315,7 +318,7 @@ class TagsPluginTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testUpdateTagsFromScratch() {
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -363,7 +366,7 @@ class TagsPluginTest extends \Test\TestCase {
|
|||
public function testUpdateFav() {
|
||||
// this test will replace the existing tags "tagremove" with "tag1" and "tag2"
|
||||
// and keep "tagkeep"
|
||||
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node')
|
||||
$node = $this->getMockBuilder(Node::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\DAV;
|
|||
use OCA\DAV\Files\BrowserErrorPagePlugin;
|
||||
use PHPUnit_Framework_MockObject_MockObject;
|
||||
use Sabre\DAV\Exception\NotFound;
|
||||
use Sabre\HTTP\Response;
|
||||
|
||||
class BrowserErrorPagePluginTest extends \Test\TestCase {
|
||||
|
||||
|
@ -36,13 +37,13 @@ class BrowserErrorPagePluginTest extends \Test\TestCase {
|
|||
*/
|
||||
public function test($expectedCode, $exception) {
|
||||
/** @var BrowserErrorPagePlugin | PHPUnit_Framework_MockObject_MockObject $plugin */
|
||||
$plugin = $this->getMockBuilder('OCA\DAV\Files\BrowserErrorPagePlugin')->setMethods(['sendResponse', 'generateBody'])->getMock();
|
||||
$plugin = $this->getMockBuilder(BrowserErrorPagePlugin::class)->setMethods(['sendResponse', 'generateBody'])->getMock();
|
||||
$plugin->expects($this->once())->method('generateBody')->willReturn(':boom:');
|
||||
$plugin->expects($this->once())->method('sendResponse');
|
||||
/** @var \Sabre\DAV\Server | PHPUnit_Framework_MockObject_MockObject $server */
|
||||
$server = $this->getMockBuilder('Sabre\DAV\Server')->disableOriginalConstructor()->getMock();
|
||||
$server->expects($this->once())->method('on');
|
||||
$httpResponse = $this->getMockBuilder('Sabre\HTTP\Response')->disableOriginalConstructor()->getMock();
|
||||
$httpResponse = $this->getMockBuilder(Response::class)->disableOriginalConstructor()->getMock();
|
||||
$httpResponse->expects($this->once())->method('addHeaders');
|
||||
$httpResponse->expects($this->once())->method('setStatus')->with($expectedCode);
|
||||
$httpResponse->expects($this->once())->method('setBody')->with(':boom:');
|
||||
|
|
|
@ -42,7 +42,7 @@ class HookManagerTest extends TestCase {
|
|||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock();
|
||||
$this->eventDispatcher = $this->getMockBuilder(EventDispatcher::class)->disableOriginalConstructor()->getMock();
|
||||
$this->l10n = $this->createMock(IL10N::class);
|
||||
$this->l10n
|
||||
->expects($this->any())
|
||||
|
|
|
@ -47,7 +47,7 @@ class PluginTest extends TestCase {
|
|||
parent::setUp();
|
||||
|
||||
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */
|
||||
$authBackend = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Auth')->disableOriginalConstructor()->getMock();
|
||||
$authBackend = $this->getMockBuilder(Auth::class)->disableOriginalConstructor()->getMock();
|
||||
$authBackend->method('isDavAuthenticated')->willReturn(true);
|
||||
|
||||
/** @var IRequest $request */
|
||||
|
@ -57,7 +57,7 @@ class PluginTest extends TestCase {
|
|||
$root = new SimpleCollection('root');
|
||||
$this->server = new \Sabre\DAV\Server($root);
|
||||
/** @var SimpleCollection $node */
|
||||
$this->book = $this->getMockBuilder('OCA\DAV\DAV\Sharing\IShareable')->
|
||||
$this->book = $this->getMockBuilder(IShareable::class)->
|
||||
disableOriginalConstructor()->
|
||||
getMock();
|
||||
$this->book->method('getName')->willReturn('addressbook1.vcf');
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace OCA\DAV\Tests\unit\SystemTag;
|
|||
|
||||
use OC\SystemTag\SystemTag;
|
||||
use OCP\IUser;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
use OCP\SystemTag\TagNotFoundException;
|
||||
use OCP\SystemTag\ISystemTag;
|
||||
|
||||
|
@ -49,9 +51,9 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
|
||||
$this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
|
||||
->getMock();
|
||||
$this->user = $this->getMockBuilder(IUser::class)
|
||||
->getMock();
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
|
|||
|
||||
use OC\SystemTag\SystemTag;
|
||||
use OCP\IUser;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\TagNotFoundException;
|
||||
use OCP\SystemTag\TagAlreadyExistsException;
|
||||
use OCP\SystemTag\ISystemTag;
|
||||
|
@ -47,7 +48,7 @@ class SystemTagNodeTest extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
$this->user = $this->getMockBuilder(IUser::class)
|
||||
->getMock();
|
||||
|
|
|
@ -27,8 +27,12 @@
|
|||
namespace OCA\DAV\Tests\unit\SystemTag;
|
||||
|
||||
use OC\SystemTag\SystemTag;
|
||||
use OCA\DAV\SystemTag\SystemTagNode;
|
||||
use OCA\DAV\SystemTag\SystemTagsByIdCollection;
|
||||
use OCA\DAV\SystemTag\SystemTagsObjectMappingCollection;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\IUserSession;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\TagAlreadyExistsException;
|
||||
use OCP\IUser;
|
||||
use OCP\SystemTag\ISystemTag;
|
||||
|
@ -88,7 +92,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
|
||||
$this->server = new \Sabre\DAV\Server($this->tree);
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
$this->groupManager = $this->getMockBuilder(IGroupManager::class)
|
||||
->getMock();
|
||||
|
@ -192,7 +196,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
->with('admin')
|
||||
->willReturn(true);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
|
||||
$node = $this->getMockBuilder(SystemTagNode::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -247,7 +251,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
->with('admin')
|
||||
->willReturn(false);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
|
||||
$node = $this->getMockBuilder(SystemTagNode::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -282,7 +286,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
->with('admin')
|
||||
->willReturn(true);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
|
||||
$node = $this->getMockBuilder(SystemTagNode::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -340,7 +344,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
->with('admin')
|
||||
->willReturn(false);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode')
|
||||
$node = $this->getMockBuilder(SystemTagNode::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$node->expects($this->any())
|
||||
|
@ -403,7 +407,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
}
|
||||
$requestData = json_encode($requestData);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
|
||||
$node = $this->getMockBuilder(SystemTagsByIdCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagManager->expects($this->never())
|
||||
|
@ -448,7 +452,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
'userAssignable' => true,
|
||||
]);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
|
||||
$node = $this->getMockBuilder(SystemTagsByIdCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagManager->expects($this->once())
|
||||
|
@ -525,7 +529,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
}
|
||||
$requestData = json_encode($requestData);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection')
|
||||
$node = $this->getMockBuilder(SystemTagsByIdCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->tagManager->expects($this->once())
|
||||
|
@ -604,7 +608,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
'userAssignable' => false,
|
||||
]);
|
||||
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection')
|
||||
$node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
@ -657,7 +661,7 @@ class SystemTagPluginTest extends \Test\TestCase {
|
|||
* @expectedException \Sabre\DAV\Exception\NotFound
|
||||
*/
|
||||
public function testCreateTagToUnknownNode() {
|
||||
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection')
|
||||
$node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ use OC\SystemTag\SystemTag;
|
|||
use OCP\IGroupManager;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\TagNotFoundException;
|
||||
|
||||
class SystemTagsByIdCollectionTest extends \Test\TestCase {
|
||||
|
@ -46,7 +47,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace OCA\DAV\Tests\unit\SystemTag;
|
|||
|
||||
use OC\SystemTag\SystemTag;
|
||||
use OCP\IUser;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
use OCP\SystemTag\TagNotFoundException;
|
||||
|
||||
class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
|
||||
|
@ -49,9 +51,9 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
|
||||
$this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
|
||||
->getMock();
|
||||
|
||||
$this->user = $this->getMockBuilder(IUser::class)
|
||||
|
|
|
@ -28,6 +28,8 @@ use OCP\Files\Folder;
|
|||
use OCP\IGroupManager;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserSession;
|
||||
use OCP\SystemTag\ISystemTagManager;
|
||||
use OCP\SystemTag\ISystemTagObjectMapper;
|
||||
|
||||
class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
|
||||
|
||||
|
@ -54,9 +56,9 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager')
|
||||
$this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
|
||||
->getMock();
|
||||
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper')
|
||||
$this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
|
||||
->getMock();
|
||||
|
||||
$user = $this->getMockBuilder(IUser::class)
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
namespace OCA\DAV\Tests\unit\Upload;
|
||||
|
||||
use Sabre\DAV\File;
|
||||
|
||||
class AssemblyStreamTest extends \Test\TestCase {
|
||||
|
||||
/**
|
||||
|
@ -120,7 +122,7 @@ class AssemblyStreamTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
private function buildNode($name, $data) {
|
||||
$node = $this->getMockBuilder('\Sabre\DAV\File')
|
||||
$node = $this->getMockBuilder(File::class)
|
||||
->setMethods(['getName', 'get', 'getSize'])
|
||||
->getMockForAbstractClass();
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
namespace OCA\DAV\Tests\unit\Upload;
|
||||
|
||||
use OCA\DAV\Connector\Sabre\Directory;
|
||||
|
||||
class FutureFileTest extends \Test\TestCase {
|
||||
|
||||
public function testGetContentType() {
|
||||
|
@ -57,7 +59,7 @@ class FutureFileTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testDelete() {
|
||||
$d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory')
|
||||
$d = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['delete'])
|
||||
->getMock();
|
||||
|
@ -89,7 +91,7 @@ class FutureFileTest extends \Test\TestCase {
|
|||
* @return \OCA\DAV\Upload\FutureFile
|
||||
*/
|
||||
private function mockFutureFile() {
|
||||
$d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory')
|
||||
$d = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['getETag', 'getLastModified', 'getChildren'])
|
||||
->getMock();
|
||||
|
|
|
@ -89,7 +89,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
|
|||
$this->request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock();
|
||||
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock();
|
||||
$this->shareManager = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
|
||||
$this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock();
|
||||
|
|
|
@ -90,7 +90,7 @@ class RequestHandlerControllerTest extends TestCase {
|
|||
->setConstructorArgs([$config, $clientService])
|
||||
->getMock();
|
||||
$httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
|
||||
$this->share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$this->share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->federatedShareProvider->expects($this->any())
|
||||
|
|
|
@ -230,7 +230,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
|
||||
$shareTime, $expiration, $parent, $target, $mail_send, $token=null,
|
||||
$password=null) {
|
||||
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getId')->willReturn($id);
|
||||
$share->method('getShareType')->willReturn($shareType);
|
||||
$share->method('getSharedWith')->willReturn($sharedWith);
|
||||
|
@ -513,25 +513,25 @@ class ShareAPIControllerTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testCanAccessShare() {
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getShareOwner')->willReturn($this->currentUser);
|
||||
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
|
||||
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getSharedBy')->willReturn($this->currentUser);
|
||||
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
|
||||
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
|
||||
$share->method('getSharedWith')->willReturn($this->currentUser);
|
||||
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
|
||||
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
|
||||
$share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock());
|
||||
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
|
||||
|
||||
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
|
||||
$share->method('getSharedWith')->willReturn('group');
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ use OCP\ISession;
|
|||
use OCP\IUserManager;
|
||||
use OCP\Security\ISecureRandom;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\Share\IShare;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
|
@ -463,7 +464,7 @@ class ShareControllerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testDownloadShare() {
|
||||
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
$share
|
||||
->expects($this->once())
|
||||
|
@ -488,7 +489,7 @@ class ShareControllerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testDownloadShareWithCreateOnlyShare() {
|
||||
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->method('getPassword')->willReturn('password');
|
||||
$share
|
||||
->expects($this->once())
|
||||
|
|
|
@ -682,7 +682,7 @@ class VersioningTest extends \Test\TestCase {
|
|||
return;
|
||||
}
|
||||
|
||||
$eventHandler = $this->getMockBuilder('\stdclass')
|
||||
$eventHandler = $this->getMockBuilder(\stdclass::class)
|
||||
->setMethods(['callback'])
|
||||
->getMock();
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
$this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock();
|
||||
$this->mailer = $this->getMockBuilder('\OCP\Mail\IMailer')->getMock();
|
||||
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
|
||||
$this->share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$this->share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$this->activityManager = $this->getMockBuilder('OCP\Activity\IManager')->getMock();
|
||||
$this->settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock();
|
||||
$this->defaults = $this->createMock(Defaults::class);
|
||||
|
@ -181,7 +181,7 @@ class ShareByMailProviderTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testCreate() {
|
||||
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock();
|
||||
$share = $this->getMockBuilder(IShare::class)->getMock();
|
||||
$share->expects($this->any())->method('getSharedWith')->willReturn('user1');
|
||||
|
||||
$node = $this->getMockBuilder(File::class)->getMock();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Tests\Settings\Controller;
|
|||
use OC\Group\Group;
|
||||
use OC\Group\MetaData;
|
||||
use OC\Settings\Controller\GroupsController;
|
||||
use OC\User\User;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\IGroupManager;
|
||||
|
@ -99,7 +100,7 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$groups[] = $thirdGroup;
|
||||
$groups[] = $fourthGroup;
|
||||
|
||||
$user = $this->getMockBuilder('\OC\User\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->userSession
|
||||
->expects($this->once())
|
||||
|
@ -191,7 +192,7 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
$groups[] = $thirdGroup;
|
||||
$groups[] = $fourthGroup;
|
||||
|
||||
$user = $this->getMockBuilder('\OC\User\User')
|
||||
$user = $this->getMockBuilder(User::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->userSession
|
||||
->expects($this->once())
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace Test\Encryption;
|
|||
|
||||
|
||||
use OC\Encryption\Update;
|
||||
use OC\Files\Mount\Manager;
|
||||
use OC\Files\View;
|
||||
use Test\TestCase;
|
||||
|
||||
|
@ -60,7 +61,7 @@ class UpdateTest extends TestCase {
|
|||
->disableOriginalConstructor()->getMock();
|
||||
$this->util = $this->getMockBuilder('\OC\Encryption\Util')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$this->mountManager = $this->getMockBuilder(Manager::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager')
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
|
|
@ -47,7 +47,7 @@ class FileChunkingTest extends \Test\TestCase {
|
|||
* @param $expected
|
||||
*/
|
||||
public function testIsComplete($total, array $present, $expected) {
|
||||
$fileChunking = $this->getMockBuilder('\OC_FileChunking')
|
||||
$fileChunking = $this->getMockBuilder(\OC_FileChunking::class)
|
||||
->setMethods(['getCache'])
|
||||
->setConstructorArgs([[
|
||||
'name' => 'file',
|
||||
|
|
|
@ -786,7 +786,7 @@ class FolderTest extends NodeTest {
|
|||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
|
||||
->getMock();
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
|
||||
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
|
||||
$folderInfo = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
||||
$baseTime = 1000;
|
||||
|
@ -847,7 +847,7 @@ class FolderTest extends NodeTest {
|
|||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
|
||||
->getMock();
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
|
||||
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
|
||||
$folderInfo = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
||||
$baseTime = 1000;
|
||||
|
@ -906,7 +906,7 @@ class FolderTest extends NodeTest {
|
|||
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
|
||||
->getMock();
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
|
||||
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo')
|
||||
$folderInfo = $this->getMockBuilder(FileInfo::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
||||
$baseTime = 1000;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
namespace Test\Files\Node;
|
||||
|
||||
use OC\Files\FileInfo;
|
||||
use OC\Files\Mount\Manager;
|
||||
use OC\Files\View;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use OCP\Files\IRootFolder;
|
||||
|
@ -52,7 +53,7 @@ abstract class NodeTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator);
|
||||
$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$this->manager = $this->getMockBuilder(Manager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->view = $this->getMockBuilder(View::class)
|
||||
|
|
|
@ -47,7 +47,7 @@ class RootTest extends \Test\TestCase {
|
|||
->getMock();
|
||||
|
||||
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlgenerator);
|
||||
$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
|
||||
$this->manager = $this->getMockBuilder(Manager::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
|
||||
|
|
|
@ -2350,7 +2350,7 @@ class ViewTest extends \Test\TestCase {
|
|||
return;
|
||||
}
|
||||
|
||||
$eventHandler = $this->getMockBuilder('\stdclass')
|
||||
$eventHandler = $this->getMockBuilder(\stdclass::class)
|
||||
->setMethods(['preCallback', 'postCallback'])
|
||||
->getMock();
|
||||
|
||||
|
@ -2425,7 +2425,7 @@ class ViewTest extends \Test\TestCase {
|
|||
Filesystem::getMountManager()->addMount($mount);
|
||||
|
||||
// Listen for events
|
||||
$eventHandler = $this->getMockBuilder('\stdclass')
|
||||
$eventHandler = $this->getMockBuilder(\stdclass::class)
|
||||
->setMethods(['umount', 'post_umount'])
|
||||
->getMock();
|
||||
$eventHandler->expects($this->once())
|
||||
|
|
Loading…
Reference in New Issue