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:
Morris Jobke 2017-10-26 13:26:00 +02:00 committed by GitHub
commit 06f46bd256
42 changed files with 159 additions and 113 deletions

View File

@ -46,8 +46,8 @@ class ConverterTest extends TestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->databaseConnection = $this->getMockBuilder('OCP\IDBConnection')->getMock(); $this->databaseConnection = $this->getMockBuilder(IDBConnection::class)->getMock();
$this->eventDispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') $this->eventDispatcher = $this->getMockBuilder(EventDispatcher::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->accountManager = $this->getMockBuilder(AccountManager::class) $this->accountManager = $this->getMockBuilder(AccountManager::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();

View File

@ -47,7 +47,7 @@ class PluginTest extends TestCase {
parent::setUp(); parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */ /** @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); $authBackend->method('isDavAuthenticated')->willReturn(true);
/** @var IRequest $request */ /** @var IRequest $request */
@ -57,7 +57,7 @@ class PluginTest extends TestCase {
$root = new SimpleCollection('root'); $root = new SimpleCollection('root');
$this->server = new \Sabre\DAV\Server($root); $this->server = new \Sabre\DAV\Server($root);
/** @var SimpleCollection $node */ /** @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'); $this->book->method('getName')->willReturn('addressbook1.vcf');
$root->addChild($this->book); $root->addChild($this->book);
$this->plugin->initialize($this->server); $this->plugin->initialize($this->server);

View File

@ -33,6 +33,7 @@ use OCP\ILogger;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IUserSession; use OCP\IUserSession;
use Sabre\DAV\PropPatch;
class CommentsNodeTest extends \Test\TestCase { class CommentsNodeTest extends \Test\TestCase {
@ -361,7 +362,7 @@ class CommentsNodeTest extends \Test\TestCase {
} }
public function testPropPatch() { public function testPropPatch() {
$propPatch = $this->getMockBuilder('Sabre\DAV\PropPatch') $propPatch = $this->getMockBuilder(PropPatch::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -28,6 +28,7 @@ use OCP\IRequest;
use OCP\ISession; use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager; use OCP\Share\IManager;
use OCP\Share\IShare;
/** /**
* Class PublicAuthTest * Class PublicAuthTest
@ -94,7 +95,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testShareNoPassword() { public function testShareNoPassword() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn(null); $share->method('getPassword')->willReturn(null);
@ -109,7 +110,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testSharePasswordFancyShareType() { public function testSharePasswordFancyShareType() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -126,7 +127,7 @@ class PublicAuthTest extends \Test\TestCase {
public function testSharePasswordRemote() { public function testSharePasswordRemote() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -142,7 +143,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testSharePasswordLinkValidPassword() { public function testSharePasswordLinkValidPassword() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -164,7 +165,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testSharePasswordMailValidPassword() { public function testSharePasswordMailValidPassword() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -186,7 +187,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testSharePasswordLinkValidSession() { public function testSharePasswordLinkValidSession() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -212,7 +213,7 @@ class PublicAuthTest extends \Test\TestCase {
} }
public function testSharePasswordLinkInvalidSession() { public function testSharePasswordLinkInvalidSession() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
@ -239,7 +240,7 @@ class PublicAuthTest extends \Test\TestCase {
public function testSharePasswordMailInvalidSession() { public function testSharePasswordMailInvalidSession() {
$share = $this->getMockBuilder('OCP\Share\IShare') $share = $this->getMockBuilder(IShare::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');

View File

@ -29,6 +29,7 @@ use OCA\DAV\Connector\Sabre\File;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use Sabre\DAV\PropFind;
class CommentsPropertiesPluginTest extends \Test\TestCase { class CommentsPropertiesPluginTest extends \Test\TestCase {
@ -77,7 +78,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
* @param $expectedSuccessful * @param $expectedSuccessful
*/ */
public function testHandleGetProperties($node, $expectedSuccessful) { public function testHandleGetProperties($node, $expectedSuccessful) {
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind') $propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -24,7 +24,9 @@
namespace OCA\DAV\Tests\unit\Connector\Sabre; namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin; use OCA\DAV\Connector\Sabre\CopyEtagHeaderPlugin;
use OCA\DAV\Connector\Sabre\File;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Sabre\DAV\Tree;
use Test\TestCase; use Test\TestCase;
/** /**
@ -68,13 +70,13 @@ class CopyEtagHeaderPluginTest extends TestCase {
} }
public function testAfterMove() { public function testAfterMove() {
$node = $this->getMockBuilder('OCA\DAV\Connector\Sabre\File') $node = $this->getMockBuilder(File::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->once()) $node->expects($this->once())
->method('getETag') ->method('getETag')
->willReturn('123456'); ->willReturn('123456');
$tree = $this->getMockBuilder('Sabre\DAV\Tree') $tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tree->expects($this->once()) $tree->expects($this->once())

View File

@ -31,8 +31,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
* See the COPYING-README file. * See the COPYING-README file.
*/ */
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File;
use OCP\IUser; use OCP\IUser;
use Sabre\DAV\File;
use Sabre\DAV\Tree; use Sabre\DAV\Tree;
/** /**
@ -179,7 +180,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test setting/getting properties * Test setting/getting properties
*/ */
public function testSetGetPropertiesForFile() { public function testSetGetPropertiesForFile() {
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $node = $this->createTestNode(File::class);
$this->tree->expects($this->any()) $this->tree->expects($this->any())
->method('getNodeForPath') ->method('getNodeForPath')
->with('/dummypath') ->with('/dummypath')
@ -211,7 +212,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test getting properties from directory * Test getting properties from directory
*/ */
public function testGetPropertiesForDirectory() { public function testGetPropertiesForDirectory() {
$rootNode = $this->createTestNode('\OCA\DAV\Connector\Sabre\Directory'); $rootNode = $this->createTestNode(Directory::class);
$nodeSub = $this->getMockBuilder(File::class) $nodeSub = $this->getMockBuilder(File::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -295,7 +296,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
* Test delete property * Test delete property
*/ */
public function testDeleteProperty() { public function testDeleteProperty() {
$node = $this->createTestNode('\OCA\DAV\Connector\Sabre\File'); $node = $this->createTestNode(File::class);
$this->tree->expects($this->any()) $this->tree->expects($this->any())
->method('getNodeForPath') ->method('getNodeForPath')
->with('/dummypath') ->with('/dummypath')

View File

@ -26,6 +26,7 @@
namespace OCA\DAV\Tests\Unit\Connector\Sabre; namespace OCA\DAV\Tests\Unit\Connector\Sabre;
use OC\Files\Storage\Wrapper\Quota;
use OCP\Files\ForbiddenException; use OCP\Files\ForbiddenException;
use OC\Files\FileInfo; use OC\Files\FileInfo;
use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Directory;
@ -179,10 +180,10 @@ class DirectoryTest extends \Test\TestCase {
} }
public function testGetChildren() { public function testGetChildren() {
$info1 = $this->getMockBuilder('OC\Files\FileInfo') $info1 = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$info2 = $this->getMockBuilder('OC\Files\FileInfo') $info2 = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$info1->expects($this->any()) $info1->expects($this->any())
@ -269,7 +270,7 @@ class DirectoryTest extends \Test\TestCase {
} }
public function testGetQuotaInfoUnlimited() { public function testGetQuotaInfoUnlimited() {
$storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota') $storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -300,7 +301,7 @@ class DirectoryTest extends \Test\TestCase {
} }
public function testGetQuotaInfoSpecific() { public function testGetQuotaInfoSpecific() {
$storage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Quota') $storage = $this->getMockBuilder(Quota::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -27,6 +27,8 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin; use OCA\DAV\Connector\Sabre\DummyGetResponsePlugin;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase; use Test\TestCase;
/** /**
@ -60,11 +62,11 @@ class DummyGetResponsePluginTest extends TestCase {
public function testHttpGet() { public function testHttpGet() {
/** @var \Sabre\HTTP\RequestInterface $request */ /** @var \Sabre\HTTP\RequestInterface $request */
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
/** @var \Sabre\HTTP\ResponseInterface $response */ /** @var \Sabre\HTTP\ResponseInterface $response */
$response = $server = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface') $response = $server = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$response $response

View File

@ -26,8 +26,11 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\FakeLockerPlugin; use OCA\DAV\Connector\Sabre\FakeLockerPlugin;
use Sabre\DAV\INode; use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\Response; use Sabre\HTTP\Response;
use Sabre\HTTP\ResponseInterface;
use Test\TestCase; use Test\TestCase;
/** /**
@ -85,7 +88,7 @@ class FakeLockerPluginTest extends TestCase {
} }
public function testPropFind() { public function testPropFind() {
$propFind = $this->getMockBuilder('\Sabre\DAV\PropFind') $propFind = $this->getMockBuilder(PropFind::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node = $this->getMockBuilder(INode::class) $node = $this->getMockBuilder(INode::class)
@ -145,7 +148,7 @@ class FakeLockerPluginTest extends TestCase {
* @param array $expected * @param array $expected
*/ */
public function testValidateTokens(array $input, array $expected) { public function testValidateTokens(array $input, array $expected) {
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->fakeLockerPlugin->validateTokens($request, $input); $this->fakeLockerPlugin->validateTokens($request, $input);
@ -153,7 +156,7 @@ class FakeLockerPluginTest extends TestCase {
} }
public function testFakeLockProvider() { public function testFakeLockProvider() {
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$response = new Response(); $response = new Response();
@ -173,10 +176,10 @@ class FakeLockerPluginTest extends TestCase {
} }
public function testFakeUnlockProvider() { public function testFakeUnlockProvider() {
$request = $this->getMockBuilder('\Sabre\HTTP\RequestInterface') $request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$response = $this->getMockBuilder('\Sabre\HTTP\ResponseInterface') $response = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -882,7 +882,7 @@ class FileTest extends \Test\TestCase {
$wasLockedPre = false; $wasLockedPre = false;
$wasLockedPost = false; $wasLockedPost = false;
$eventHandler = $this->getMockBuilder('\stdclass') $eventHandler = $this->getMockBuilder(\stdclass::class)
->setMethods(['writeCallback', 'postWriteCallback']) ->setMethods(['writeCallback', 'postWriteCallback'])
->getMock(); ->getMock();

View File

@ -25,8 +25,10 @@
*/ */
namespace OCA\DAV\Tests\unit\Connector\Sabre; namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\User\User;
use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\FilesPlugin; use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCA\DAV\Connector\Sabre\Node;
use OCP\Files\StorageNotAvailableException; use OCP\Files\StorageNotAvailableException;
use OCP\IConfig; use OCP\IConfig;
use OCP\IPreview; use OCP\IPreview;
@ -188,7 +190,7 @@ class FilesPluginTest extends TestCase {
0 0
); );
$user = $this->getMockBuilder('\OC\User\User') $user = $this->getMockBuilder(User::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$user $user
->expects($this->once()) ->expects($this->once())
@ -457,14 +459,14 @@ class FilesPluginTest extends TestCase {
* @expectedExceptionMessage FolderA/test.txt cannot be deleted * @expectedExceptionMessage FolderA/test.txt cannot be deleted
*/ */
public function testMoveSrcNotDeletable() { public function testMoveSrcNotDeletable() {
$fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo') $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$fileInfoFolderATestTXT->expects($this->once()) $fileInfoFolderATestTXT->expects($this->once())
->method('isDeletable') ->method('isDeletable')
->willReturn(false); ->willReturn(false);
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->once()) $node->expects($this->once())
@ -478,14 +480,14 @@ class FilesPluginTest extends TestCase {
} }
public function testMoveSrcDeletable() { public function testMoveSrcDeletable() {
$fileInfoFolderATestTXT = $this->getMockBuilder('\OCP\Files\FileInfo') $fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$fileInfoFolderATestTXT->expects($this->once()) $fileInfoFolderATestTXT->expects($this->once())
->method('isDeletable') ->method('isDeletable')
->willReturn(true); ->willReturn(true);
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->once()) $node->expects($this->once())
@ -503,7 +505,7 @@ class FilesPluginTest extends TestCase {
* @expectedExceptionMessage FolderA/test.txt does not exist * @expectedExceptionMessage FolderA/test.txt does not exist
*/ */
public function testMoveSrcNotExist() { public function testMoveSrcNotExist() {
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->once()) $node->expects($this->once())

View File

@ -33,6 +33,7 @@ use OCP\IRequest;
use OCP\ITagManager; use OCP\ITagManager;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagObjectMapper; use OCP\SystemTag\ISystemTagObjectMapper;
use OC\Files\View; use OC\Files\View;
use OCP\Files\Folder; use OCP\Files\Folder;
@ -550,7 +551,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin') ->method('isAdmin')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag1->expects($this->any()) $tag1->expects($this->any())
@ -560,7 +561,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible') ->method('isUserVisible')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag2->expects($this->any()) $tag2->expects($this->any())
@ -599,7 +600,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin') ->method('isAdmin')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag1->expects($this->any()) $tag1->expects($this->any())
@ -609,7 +610,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible') ->method('isUserVisible')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag2->expects($this->any()) $tag2->expects($this->any())
@ -637,7 +638,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isAdmin') ->method('isAdmin')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$tag1 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag1 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag1->expects($this->any()) $tag1->expects($this->any())
@ -647,7 +648,7 @@ class FilesReportPluginTest extends \Test\TestCase {
->method('isUserVisible') ->method('isUserVisible')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$tag2 = $this->getMockBuilder('\OCP\SystemTag\ISystemTag') $tag2 = $this->getMockBuilder(ISystemTag::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$tag2->expects($this->any()) $tag2->expects($this->any())

View File

@ -25,8 +25,12 @@
*/ */
namespace OCA\DAV\Tests\unit\Connector\Sabre; namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\FileInfo;
use OC\Files\View; use OC\Files\View;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage; use OCP\Files\Storage;
use OCP\Share\IManager;
use OCP\Share\IShare;
/** /**
* Class NodeTest * Class NodeTest
@ -53,7 +57,7 @@ class NodeTest extends \Test\TestCase {
* @dataProvider davPermissionsProvider * @dataProvider davPermissionsProvider
*/ */
public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) { public function testDavPermissions($permissions, $type, $shared, $mounted, $expected) {
$info = $this->getMockBuilder('\OC\Files\FileInfo') $info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType')) ->setMethods(array('getPermissions', 'isShared', 'isMounted', 'getType'))
->getMock(); ->getMock();
@ -126,12 +130,12 @@ class NodeTest extends \Test\TestCase {
->getMock(); ->getMock();
$storage->method('getPermissions')->willReturn($permissions); $storage->method('getPermissions')->willReturn($permissions);
$mountpoint = $this->getMockBuilder('\OCP\Files\Mount\IMountPoint') $mountpoint = $this->getMockBuilder(IMountPoint::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mountpoint->method('getMountPoint')->willReturn('myPath'); $mountpoint->method('getMountPoint')->willReturn('myPath');
$shareManager = $this->getMockBuilder('OCP\Share\IManager')->disableOriginalConstructor()->getMock(); $shareManager = $this->getMockBuilder(IManager::class)->disableOriginalConstructor()->getMock();
$share = $this->getMockBuilder('OCP\Share\IShare')->disableOriginalConstructor()->getMock(); $share = $this->getMockBuilder(IShare::class)->disableOriginalConstructor()->getMock();
if ($user === null) { if ($user === null) {
$shareManager->expects($this->never())->method('getShareByToken'); $shareManager->expects($this->never())->method('getShareByToken');
@ -142,7 +146,7 @@ class NodeTest extends \Test\TestCase {
$share->expects($this->once())->method('getPermissions')->willReturn($permissions); $share->expects($this->once())->method('getPermissions')->willReturn($permissions);
} }
$info = $this->getMockBuilder('\OC\Files\FileInfo') $info = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['getStorage', 'getType', 'getMountPoint']) ->setMethods(['getStorage', 'getType', 'getMountPoint'])
->getMock(); ->getMock();

View File

@ -31,6 +31,7 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OC\Files\FileInfo; use OC\Files\FileInfo;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OC\Files\Mount\Manager;
use OC\Files\Storage\Temporary; use OC\Files\Storage\Temporary;
use OC\Files\View; use OC\Files\View;
use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Directory;
@ -159,13 +160,13 @@ class ObjectTreeTest extends \Test\TestCase {
$rootNode = $this->getMockBuilder(Directory::class) $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') $mountManager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$view = $this->getMockBuilder(View::class) $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$fileInfo = $this->getMockBuilder('\OCP\Files\FileInfo') $fileInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$fileInfo->expects($this->once()) $fileInfo->expects($this->once())
@ -287,7 +288,7 @@ class ObjectTreeTest extends \Test\TestCase {
$rootNode = $this->getMockBuilder(Directory::class) $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') $mountManager = $this->getMockBuilder(Manager::class)
->getMock(); ->getMock();
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();
@ -314,7 +315,7 @@ class ObjectTreeTest extends \Test\TestCase {
$rootNode = $this->getMockBuilder(Directory::class) $rootNode = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') $mountManager = $this->getMockBuilder(Manager::class)
->getMock(); ->getMock();
$tree = new \OCA\DAV\Connector\Sabre\ObjectTree(); $tree = new \OCA\DAV\Connector\Sabre\ObjectTree();

View File

@ -176,7 +176,7 @@ class QuotaPluginTest extends TestCase {
public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) { public function testCheckQuotaChunkedOk($quota, $chunkTotalSize, $headers) {
$this->init($quota, 'sub/test.txt'); $this->init($quota, 'sub/test.txt');
$mockChunking = $this->getMockBuilder('\OC_FileChunking') $mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockChunking->expects($this->once()) $mockChunking->expects($this->once())
@ -212,7 +212,7 @@ class QuotaPluginTest extends TestCase {
public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) { public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
$this->init($quota, 'sub/test.txt'); $this->init($quota, 'sub/test.txt');
$mockChunking = $this->getMockBuilder('\OC_FileChunking') $mockChunking = $this->getMockBuilder(\OC_FileChunking::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockChunking->expects($this->once()) $mockChunking->expects($this->once())

View File

@ -25,10 +25,12 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\Node;
use OCP\Files\Folder; use OCP\Files\Folder;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\Share\IManager; use OCP\Share\IManager;
use OCP\Share\IShare;
use Sabre\DAV\Tree; use Sabre\DAV\Tree;
class SharesPluginTest extends \Test\TestCase { class SharesPluginTest extends \Test\TestCase {
@ -99,7 +101,7 @@ class SharesPluginTest extends \Test\TestCase {
* @dataProvider sharesGetPropertiesDataProvider * @dataProvider sharesGetPropertiesDataProvider
*/ */
public function testGetProperties($shareTypes) { public function testGetProperties($shareTypes) {
$sabreNode = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $sabreNode = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$sabreNode->expects($this->any()) $sabreNode->expects($this->any())
@ -214,7 +216,7 @@ class SharesPluginTest extends \Test\TestCase {
->will($this->returnValue($node)); ->will($this->returnValue($node));
$dummyShares = array_map(function($type) { $dummyShares = array_map(function($type) {
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any()) $share->expects($this->any())
->method('getShareType') ->method('getShareType')
->will($this->returnValue($type)); ->will($this->returnValue($type));

View File

@ -26,6 +26,9 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre;
use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File; use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\Node;
use OCP\ITagManager;
use OCP\ITags;
use Sabre\DAV\Tree; use Sabre\DAV\Tree;
/** /**
@ -71,10 +74,10 @@ class TagsPluginTest extends \Test\TestCase {
$this->tree = $this->getMockBuilder(Tree::class) $this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagger = $this->getMockBuilder('\OCP\ITags') $this->tagger = $this->getMockBuilder(ITags::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagManager = $this->getMockBuilder('\OCP\ITagManager') $this->tagManager = $this->getMockBuilder(ITagManager::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagManager->expects($this->any()) $this->tagManager->expects($this->any())
@ -89,7 +92,7 @@ class TagsPluginTest extends \Test\TestCase {
* @dataProvider tagsGetPropertiesDataProvider * @dataProvider tagsGetPropertiesDataProvider
*/ */
public function testGetProperties($tags, $requestedProperties, $expectedProperties) { public function testGetProperties($tags, $requestedProperties, $expectedProperties) {
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -264,7 +267,7 @@ class TagsPluginTest extends \Test\TestCase {
public function testUpdateTags() { public function testUpdateTags() {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2" // this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep" // and keep "tagkeep"
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -315,7 +318,7 @@ class TagsPluginTest extends \Test\TestCase {
} }
public function testUpdateTagsFromScratch() { public function testUpdateTagsFromScratch() {
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -363,7 +366,7 @@ class TagsPluginTest extends \Test\TestCase {
public function testUpdateFav() { public function testUpdateFav() {
// this test will replace the existing tags "tagremove" with "tag1" and "tag2" // this test will replace the existing tags "tagremove" with "tag1" and "tag2"
// and keep "tagkeep" // and keep "tagkeep"
$node = $this->getMockBuilder('\OCA\DAV\Connector\Sabre\Node') $node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())

View File

@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\DAV;
use OCA\DAV\Files\BrowserErrorPagePlugin; use OCA\DAV\Files\BrowserErrorPagePlugin;
use PHPUnit_Framework_MockObject_MockObject; use PHPUnit_Framework_MockObject_MockObject;
use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\NotFound;
use Sabre\HTTP\Response;
class BrowserErrorPagePluginTest extends \Test\TestCase { class BrowserErrorPagePluginTest extends \Test\TestCase {
@ -36,13 +37,13 @@ class BrowserErrorPagePluginTest extends \Test\TestCase {
*/ */
public function test($expectedCode, $exception) { public function test($expectedCode, $exception) {
/** @var BrowserErrorPagePlugin | PHPUnit_Framework_MockObject_MockObject $plugin */ /** @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('generateBody')->willReturn(':boom:');
$plugin->expects($this->once())->method('sendResponse'); $plugin->expects($this->once())->method('sendResponse');
/** @var \Sabre\DAV\Server | PHPUnit_Framework_MockObject_MockObject $server */ /** @var \Sabre\DAV\Server | PHPUnit_Framework_MockObject_MockObject $server */
$server = $this->getMockBuilder('Sabre\DAV\Server')->disableOriginalConstructor()->getMock(); $server = $this->getMockBuilder('Sabre\DAV\Server')->disableOriginalConstructor()->getMock();
$server->expects($this->once())->method('on'); $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('addHeaders');
$httpResponse->expects($this->once())->method('setStatus')->with($expectedCode); $httpResponse->expects($this->once())->method('setStatus')->with($expectedCode);
$httpResponse->expects($this->once())->method('setBody')->with(':boom:'); $httpResponse->expects($this->once())->method('setBody')->with(':boom:');

View File

@ -42,7 +42,7 @@ class HookManagerTest extends TestCase {
public function setUp() { public function setUp() {
parent::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 = $this->createMock(IL10N::class);
$this->l10n $this->l10n
->expects($this->any()) ->expects($this->any())

View File

@ -47,7 +47,7 @@ class PluginTest extends TestCase {
parent::setUp(); parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */ /** @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); $authBackend->method('isDavAuthenticated')->willReturn(true);
/** @var IRequest $request */ /** @var IRequest $request */
@ -57,7 +57,7 @@ class PluginTest extends TestCase {
$root = new SimpleCollection('root'); $root = new SimpleCollection('root');
$this->server = new \Sabre\DAV\Server($root); $this->server = new \Sabre\DAV\Server($root);
/** @var SimpleCollection $node */ /** @var SimpleCollection $node */
$this->book = $this->getMockBuilder('OCA\DAV\DAV\Sharing\IShareable')-> $this->book = $this->getMockBuilder(IShareable::class)->
disableOriginalConstructor()-> disableOriginalConstructor()->
getMock(); getMock();
$this->book->method('getName')->willReturn('addressbook1.vcf'); $this->book->method('getName')->willReturn('addressbook1.vcf');

View File

@ -26,6 +26,8 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag; use OC\SystemTag\SystemTag;
use OCP\IUser; use OCP\IUser;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTag;
@ -49,9 +51,9 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper') $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->getMock(); ->getMock();
$this->user = $this->getMockBuilder(IUser::class) $this->user = $this->getMockBuilder(IUser::class)
->getMock(); ->getMock();

View File

@ -27,6 +27,7 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag; use OC\SystemTag\SystemTag;
use OCP\IUser; use OCP\IUser;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagNotFoundException;
use OCP\SystemTag\TagAlreadyExistsException; use OCP\SystemTag\TagAlreadyExistsException;
use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTag;
@ -47,7 +48,7 @@ class SystemTagNodeTest extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
$this->user = $this->getMockBuilder(IUser::class) $this->user = $this->getMockBuilder(IUser::class)
->getMock(); ->getMock();

View File

@ -27,8 +27,12 @@
namespace OCA\DAV\Tests\unit\SystemTag; namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\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\IGroupManager;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\TagAlreadyExistsException; use OCP\SystemTag\TagAlreadyExistsException;
use OCP\IUser; use OCP\IUser;
use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTag;
@ -88,7 +92,7 @@ class SystemTagPluginTest extends \Test\TestCase {
$this->server = new \Sabre\DAV\Server($this->tree); $this->server = new \Sabre\DAV\Server($this->tree);
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
$this->groupManager = $this->getMockBuilder(IGroupManager::class) $this->groupManager = $this->getMockBuilder(IGroupManager::class)
->getMock(); ->getMock();
@ -192,7 +196,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin') ->with('admin')
->willReturn(true); ->willReturn(true);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -247,7 +251,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin') ->with('admin')
->willReturn(false); ->willReturn(false);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -282,7 +286,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin') ->with('admin')
->willReturn(true); ->willReturn(true);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -340,7 +344,7 @@ class SystemTagPluginTest extends \Test\TestCase {
->with('admin') ->with('admin')
->willReturn(false); ->willReturn(false);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') $node = $this->getMockBuilder(SystemTagNode::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$node->expects($this->any()) $node->expects($this->any())
@ -403,7 +407,7 @@ class SystemTagPluginTest extends \Test\TestCase {
} }
$requestData = json_encode($requestData); $requestData = json_encode($requestData);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagManager->expects($this->never()) $this->tagManager->expects($this->never())
@ -448,7 +452,7 @@ class SystemTagPluginTest extends \Test\TestCase {
'userAssignable' => true, 'userAssignable' => true,
]); ]);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagManager->expects($this->once()) $this->tagManager->expects($this->once())
@ -525,7 +529,7 @@ class SystemTagPluginTest extends \Test\TestCase {
} }
$requestData = json_encode($requestData); $requestData = json_encode($requestData);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') $node = $this->getMockBuilder(SystemTagsByIdCollection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->tagManager->expects($this->once()) $this->tagManager->expects($this->once())
@ -604,7 +608,7 @@ class SystemTagPluginTest extends \Test\TestCase {
'userAssignable' => false, 'userAssignable' => false,
]); ]);
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection') $node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
@ -657,7 +661,7 @@ class SystemTagPluginTest extends \Test\TestCase {
* @expectedException \Sabre\DAV\Exception\NotFound * @expectedException \Sabre\DAV\Exception\NotFound
*/ */
public function testCreateTagToUnknownNode() { public function testCreateTagToUnknownNode() {
$node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection') $node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();

View File

@ -29,6 +29,7 @@ use OC\SystemTag\SystemTag;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagNotFoundException;
class SystemTagsByIdCollectionTest extends \Test\TestCase { class SystemTagsByIdCollectionTest extends \Test\TestCase {
@ -46,7 +47,7 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
} }

View File

@ -27,6 +27,8 @@ namespace OCA\DAV\Tests\unit\SystemTag;
use OC\SystemTag\SystemTag; use OC\SystemTag\SystemTag;
use OCP\IUser; use OCP\IUser;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagNotFoundException;
class SystemTagsObjectMappingCollectionTest extends \Test\TestCase { class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
@ -49,9 +51,9 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper') $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->getMock(); ->getMock();
$this->user = $this->getMockBuilder(IUser::class) $this->user = $this->getMockBuilder(IUser::class)

View File

@ -28,6 +28,8 @@ use OCP\Files\Folder;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
class SystemTagsObjectTypeCollectionTest extends \Test\TestCase { class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
@ -54,9 +56,9 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->tagManager = $this->getMockBuilder('\OCP\SystemTag\ISystemTagManager') $this->tagManager = $this->getMockBuilder(ISystemTagManager::class)
->getMock(); ->getMock();
$this->tagMapper = $this->getMockBuilder('\OCP\SystemTag\ISystemTagObjectMapper') $this->tagMapper = $this->getMockBuilder(ISystemTagObjectMapper::class)
->getMock(); ->getMock();
$user = $this->getMockBuilder(IUser::class) $user = $this->getMockBuilder(IUser::class)

View File

@ -23,6 +23,8 @@
*/ */
namespace OCA\DAV\Tests\unit\Upload; namespace OCA\DAV\Tests\unit\Upload;
use Sabre\DAV\File;
class AssemblyStreamTest extends \Test\TestCase { class AssemblyStreamTest extends \Test\TestCase {
/** /**
@ -120,7 +122,7 @@ class AssemblyStreamTest extends \Test\TestCase {
} }
private function buildNode($name, $data) { private function buildNode($name, $data) {
$node = $this->getMockBuilder('\Sabre\DAV\File') $node = $this->getMockBuilder(File::class)
->setMethods(['getName', 'get', 'getSize']) ->setMethods(['getName', 'get', 'getSize'])
->getMockForAbstractClass(); ->getMockForAbstractClass();

View File

@ -23,6 +23,8 @@
*/ */
namespace OCA\DAV\Tests\unit\Upload; namespace OCA\DAV\Tests\unit\Upload;
use OCA\DAV\Connector\Sabre\Directory;
class FutureFileTest extends \Test\TestCase { class FutureFileTest extends \Test\TestCase {
public function testGetContentType() { public function testGetContentType() {
@ -57,7 +59,7 @@ class FutureFileTest extends \Test\TestCase {
} }
public function testDelete() { public function testDelete() {
$d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory') $d = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['delete']) ->setMethods(['delete'])
->getMock(); ->getMock();
@ -89,7 +91,7 @@ class FutureFileTest extends \Test\TestCase {
* @return \OCA\DAV\Upload\FutureFile * @return \OCA\DAV\Upload\FutureFile
*/ */
private function mockFutureFile() { private function mockFutureFile() {
$d = $this->getMockBuilder('OCA\DAV\Connector\Sabre\Directory') $d = $this->getMockBuilder(Directory::class)
->disableOriginalConstructor() ->disableOriginalConstructor()
->setMethods(['getETag', 'getLastModified', 'getChildren']) ->setMethods(['getETag', 'getLastModified', 'getChildren'])
->getMock(); ->getMock();

View File

@ -89,7 +89,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase {
$this->request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock(); $this->request = $this->getMockBuilder(IRequest::class)->disableOriginalConstructor()->getMock();
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock(); ->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') $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock(); $this->rootFolder = $this->getMockBuilder('OCP\Files\IRootFolder')->disableOriginalConstructor()->getMock();

View File

@ -90,7 +90,7 @@ class RequestHandlerControllerTest extends TestCase {
->setConstructorArgs([$config, $clientService]) ->setConstructorArgs([$config, $clientService])
->getMock(); ->getMock();
$httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true)); $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') $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->federatedShareProvider->expects($this->any()) $this->federatedShareProvider->expects($this->any())

View File

@ -230,7 +230,7 @@ class ShareAPIControllerTest extends TestCase {
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions, public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
$shareTime, $expiration, $parent, $target, $mail_send, $token=null, $shareTime, $expiration, $parent, $target, $mail_send, $token=null,
$password=null) { $password=null) {
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->method('getId')->willReturn($id); $share->method('getId')->willReturn($id);
$share->method('getShareType')->willReturn($shareType); $share->method('getShareType')->willReturn($shareType);
$share->method('getSharedWith')->willReturn($sharedWith); $share->method('getSharedWith')->willReturn($sharedWith);
@ -513,25 +513,25 @@ class ShareAPIControllerTest extends TestCase {
} }
public function testCanAccessShare() { public function testCanAccessShare() {
$share = $this->getMockBuilder('OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->method('getShareOwner')->willReturn($this->currentUser); $share->method('getShareOwner')->willReturn($this->currentUser);
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $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); $share->method('getSharedBy')->willReturn($this->currentUser);
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $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('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
$share->method('getSharedWith')->willReturn($this->currentUser); $share->method('getSharedWith')->willReturn($this->currentUser);
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $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('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_USER);
$share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock()); $share->method('getSharedWith')->willReturn($this->getMockBuilder(IUser::class)->getMock());
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share])); $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('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
$share->method('getSharedWith')->willReturn('group'); $share->method('getSharedWith')->willReturn('group');

View File

@ -49,6 +49,7 @@ use OCP\ISession;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Security\ISecureRandom; use OCP\Security\ISecureRandom;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/** /**
@ -463,7 +464,7 @@ class ShareControllerTest extends \Test\TestCase {
} }
public function testDownloadShare() { public function testDownloadShare() {
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
$share $share
->expects($this->once()) ->expects($this->once())
@ -488,7 +489,7 @@ class ShareControllerTest extends \Test\TestCase {
} }
public function testDownloadShareWithCreateOnlyShare() { public function testDownloadShareWithCreateOnlyShare() {
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->method('getPassword')->willReturn('password'); $share->method('getPassword')->willReturn('password');
$share $share
->expects($this->once()) ->expects($this->once())

View File

@ -682,7 +682,7 @@ class VersioningTest extends \Test\TestCase {
return; return;
} }
$eventHandler = $this->getMockBuilder('\stdclass') $eventHandler = $this->getMockBuilder(\stdclass::class)
->setMethods(['callback']) ->setMethods(['callback'])
->getMock(); ->getMock();

View File

@ -114,7 +114,7 @@ class ShareByMailProviderTest extends TestCase {
$this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(); $this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock();
$this->mailer = $this->getMockBuilder('\OCP\Mail\IMailer')->getMock(); $this->mailer = $this->getMockBuilder('\OCP\Mail\IMailer')->getMock();
$this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->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->activityManager = $this->getMockBuilder('OCP\Activity\IManager')->getMock();
$this->settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock(); $this->settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock();
$this->defaults = $this->createMock(Defaults::class); $this->defaults = $this->createMock(Defaults::class);
@ -181,7 +181,7 @@ class ShareByMailProviderTest extends TestCase {
} }
public function testCreate() { public function testCreate() {
$share = $this->getMockBuilder('\OCP\Share\IShare')->getMock(); $share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())->method('getSharedWith')->willReturn('user1'); $share->expects($this->any())->method('getSharedWith')->willReturn('user1');
$node = $this->getMockBuilder(File::class)->getMock(); $node = $this->getMockBuilder(File::class)->getMock();

View File

@ -13,6 +13,7 @@ namespace Tests\Settings\Controller;
use OC\Group\Group; use OC\Group\Group;
use OC\Group\MetaData; use OC\Group\MetaData;
use OC\Settings\Controller\GroupsController; use OC\Settings\Controller\GroupsController;
use OC\User\User;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IGroupManager; use OCP\IGroupManager;
@ -99,7 +100,7 @@ class GroupsControllerTest extends \Test\TestCase {
$groups[] = $thirdGroup; $groups[] = $thirdGroup;
$groups[] = $fourthGroup; $groups[] = $fourthGroup;
$user = $this->getMockBuilder('\OC\User\User') $user = $this->getMockBuilder(User::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->userSession $this->userSession
->expects($this->once()) ->expects($this->once())
@ -191,7 +192,7 @@ class GroupsControllerTest extends \Test\TestCase {
$groups[] = $thirdGroup; $groups[] = $thirdGroup;
$groups[] = $fourthGroup; $groups[] = $fourthGroup;
$user = $this->getMockBuilder('\OC\User\User') $user = $this->getMockBuilder(User::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->userSession $this->userSession
->expects($this->once()) ->expects($this->once())

View File

@ -24,6 +24,7 @@ namespace Test\Encryption;
use OC\Encryption\Update; use OC\Encryption\Update;
use OC\Files\Mount\Manager;
use OC\Files\View; use OC\Files\View;
use Test\TestCase; use Test\TestCase;
@ -60,7 +61,7 @@ class UpdateTest extends TestCase {
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\OC\Encryption\Util') $this->util = $this->getMockBuilder('\OC\Encryption\Util')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->mountManager = $this->getMockBuilder('\OC\Files\Mount\Manager') $this->mountManager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager') $this->encryptionManager = $this->getMockBuilder('\OC\Encryption\Manager')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();

View File

@ -47,7 +47,7 @@ class FileChunkingTest extends \Test\TestCase {
* @param $expected * @param $expected
*/ */
public function testIsComplete($total, array $present, $expected) { public function testIsComplete($total, array $present, $expected) {
$fileChunking = $this->getMockBuilder('\OC_FileChunking') $fileChunking = $this->getMockBuilder(\OC_FileChunking::class)
->setMethods(['getCache']) ->setMethods(['getCache'])
->setConstructorArgs([[ ->setConstructorArgs([[
'name' => 'file', 'name' => 'file',

View File

@ -786,7 +786,7 @@ class FolderTest extends NodeTest {
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager]) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock(); ->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$baseTime = 1000; $baseTime = 1000;
@ -847,7 +847,7 @@ class FolderTest extends NodeTest {
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager]) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock(); ->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$baseTime = 1000; $baseTime = 1000;
@ -906,7 +906,7 @@ class FolderTest extends NodeTest {
->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager]) ->setConstructorArgs([$manager, $view, $this->user, $this->userMountCache, $this->logger, $this->userManager])
->getMock(); ->getMock();
/** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */ /** @var \PHPUnit_Framework_MockObject_MockObject|\OC\Files\FileInfo $folderInfo */
$folderInfo = $this->getMockBuilder('\OC\Files\FileInfo') $folderInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$baseTime = 1000; $baseTime = 1000;

View File

@ -9,6 +9,7 @@
namespace Test\Files\Node; namespace Test\Files\Node;
use OC\Files\FileInfo; use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
use OC\Files\View; use OC\Files\View;
use OCP\Files\Config\IUserMountCache; use OCP\Files\Config\IUserMountCache;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
@ -52,7 +53,7 @@ abstract class NodeTest extends \Test\TestCase {
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator); $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() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->view = $this->getMockBuilder(View::class) $this->view = $this->getMockBuilder(View::class)

View File

@ -47,7 +47,7 @@ class RootTest extends \Test\TestCase {
->getMock(); ->getMock();
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlgenerator); $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() ->disableOriginalConstructor()
->getMock(); ->getMock();
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache') $this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')

View File

@ -2350,7 +2350,7 @@ class ViewTest extends \Test\TestCase {
return; return;
} }
$eventHandler = $this->getMockBuilder('\stdclass') $eventHandler = $this->getMockBuilder(\stdclass::class)
->setMethods(['preCallback', 'postCallback']) ->setMethods(['preCallback', 'postCallback'])
->getMock(); ->getMock();
@ -2425,7 +2425,7 @@ class ViewTest extends \Test\TestCase {
Filesystem::getMountManager()->addMount($mount); Filesystem::getMountManager()->addMount($mount);
// Listen for events // Listen for events
$eventHandler = $this->getMockBuilder('\stdclass') $eventHandler = $this->getMockBuilder(\stdclass::class)
->setMethods(['umount', 'post_umount']) ->setMethods(['umount', 'post_umount'])
->getMock(); ->getMock();
$eventHandler->expects($this->once()) $eventHandler->expects($this->once())