namespace Test\Files\Mount;
+use OC\Files\Storage\StorageFactory;
+use OCP\Files\Storage;
+
class MountPointTest extends \Test\TestCase {
public function testGetStorage() {
- $storage = $this->getMock('\OCP\Files\Storage');
+ $storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
->will($this->returnValue(123));
- $loader = $this->getMock('\OC\Files\Storage\StorageFactory');
+ $loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
->will($this->returnValue($storage));
}
public function testInvalidStorage() {
- $loader = $this->getMock('\OC\Files\Storage\StorageFactory');
+ $loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
->will($this->throwException(new \Exception('Test storage init exception')));
public function setUp() {
parent::setUp();
- $this->config = $this->getMock('OCP\IConfig');
- $this->user = $this->getMock('OCP\IUser');
- $this->loader = $this->getMock('OCP\Files\Storage\IStorageFactory');
+ $this->config = $this->createMock(IConfig::class);
+ $this->user = $this->createMock(IUser::class);
+ $this->loader = $this->createMock(IStorageFactory::class);
$this->provider = new ObjectHomeMountProvider($this->config);
}
public function getArguments() {
return $this->arguments;
}
-}
\ No newline at end of file
+}
use OC\Files\ObjectStore\Mapper;
+use OCP\IUser;
class MapperTest extends \Test\TestCase {
* @param string $expectedBucket
*/
public function testGetBucket($username, $expectedBucket) {
- $user = $this->getMock('OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn($username);
$this->assertSame($expectedBucket, $mapper->getBucket());
}
-}
\ No newline at end of file
+}
use OC\Encryption\Util;
use OC\Files\Storage\Temporary;
use OC\Files\View;
+use OC\Log;
+use OC\Memcache\ArrayCache;
use OC\User\Manager;
+use OCP\Files\Cache\ICache;
use Test\Files\Storage\Storage;
class EncryptionTest extends Storage {
->method('getEncryptionModule')
->willReturn($mockModule);
- $this->arrayCache = $this->getMock('OC\Memcache\ArrayCache');
+ $this->arrayCache = $this->createMock(ArrayCache::class);
$this->config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock();
->disableOriginalConstructor()
->getMock();
- $this->util = $this->getMock(
- '\OC\Encryption\Util',
- ['getUidAndFilename', 'isFile', 'isExcluded'],
- [new View(), new Manager(), $this->groupManager, $this->config, $this->arrayCache]);
+ $this->util = $this->getMockBuilder('\OC\Encryption\Util')
+ ->setMethods(['getUidAndFilename', 'isFile', 'isExcluded'])
+ ->setConstructorArgs([new View(), new Manager(), $this->groupManager, $this->config, $this->arrayCache])
+ ->getMock();
$this->util->expects($this->any())
->method('getUidAndFilename')
->willReturnCallback(function ($path) {
->getMock();
$this->file->expects($this->any())->method('getAccessList')->willReturn([]);
- $this->logger = $this->getMock('\OC\Log');
+ $this->logger = $this->createMock(Log::class);
$this->sourceStorage = new Temporary(array());
$temp = \OC::$server->getTempManager();
return fopen($temp->getTemporaryFile(), $mode);
});
- $cache = $this->getMock('\OCP\Files\Cache\ICache');
+ $cache = $this->createMock(ICache::class);
$cache->expects($this->once())
->method('get')
->with($sourceInternalPath)
return fopen($temp->getTemporaryFile(), $mode);
});
if($expectedEncrypted) {
- $cache = $this->getMock('\OCP\Files\Cache\ICache');
+ $cache = $this->createMock(ICache::class);
$cache->expects($this->once())
->method('get')
->with($sourceInternalPath)
namespace Test\Files\Stream;
use OC\Files\View;
+use OC\Memcache\ArrayCache;
class EncryptionTest extends \Test\TestCase {
$config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()
->getMock();
- $arrayCache = $this->getMock('OC\Memcache\ArrayCache');
+ $arrayCache = $this->createMock(ArrayCache::class);
$groupManager = $this->getMockBuilder('\OC\Group\Manager')
->disableOriginalConstructor()
->getMock();
->setMethods(['getAccessList'])
->getMock();
$file->expects($this->any())->method('getAccessList')->willReturn([]);
- $util = $this->getMock(
- '\OC\Encryption\Util',
- ['getUidAndFilename'],
- [new View(), new \OC\User\Manager(), $groupManager, $config, $arrayCache]
- );
+ $util = $this->getMockBuilder('\OC\Encryption\Util')
+ ->setMethods(['getUidAndFilename'])
+ ->setConstructorArgs([new View(), new \OC\User\Manager(), $groupManager, $config, $arrayCache])
+ ->getMock();
$util->expects($this->any())
->method('getUidAndFilename')
->willReturn(['user1', $internalPath]);