Browse Source

Migrate from ILogger to LoggerInterface where needed in the tests

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v24.0.0beta2
Côme Chilliet 2 years ago
parent
commit
61f7f13bd8
No account linked to committer's email address
39 changed files with 131 additions and 137 deletions
  1. 3
    3
      tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
  2. 7
    7
      tests/lib/AppFramework/Routing/RoutingTest.php
  3. 16
    16
      tests/lib/DB/QueryBuilder/QueryBuilderTest.php
  4. 3
    4
      tests/lib/Encryption/EncryptionWrapperTest.php
  5. 3
    3
      tests/lib/Encryption/ManagerTest.php
  6. 3
    3
      tests/lib/EventDispatcher/SymfonyAdapterTest.php
  7. 2
    2
      tests/lib/Files/Config/UserMountCacheTest.php
  8. 2
    1
      tests/lib/Files/EtagTest.php
  9. 3
    3
      tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
  10. 2
    2
      tests/lib/Files/Node/HookConnectorTest.php
  11. 2
    2
      tests/lib/Files/Node/IntegrationTest.php
  12. 3
    3
      tests/lib/Files/Node/NodeTest.php
  13. 3
    3
      tests/lib/Files/Node/RootTest.php
  14. 6
    7
      tests/lib/Files/Storage/Wrapper/EncryptionTest.php
  15. 4
    4
      tests/lib/Files/Type/DetectionTest.php
  16. 7
    6
      tests/lib/Files/Utils/ScannerTest.php
  17. 3
    3
      tests/lib/Group/ManagerTest.php
  18. 0
    4
      tests/lib/Http/Client/ClientServiceTest.php
  19. 3
    8
      tests/lib/Http/Client/ClientTest.php
  20. 2
    2
      tests/lib/Http/Client/LocalAddressCheckerTest.php
  21. 2
    1
      tests/lib/Lock/DBLockingProviderTest.php
  22. 2
    1
      tests/lib/Lock/NonCachingDBLockingProviderTest.php
  23. 3
    3
      tests/lib/Mail/MailerTest.php
  24. 3
    3
      tests/lib/Memcache/FactoryTest.php
  25. 3
    3
      tests/lib/Route/RouterTest.php
  26. 3
    3
      tests/lib/Security/Bruteforce/ThrottlerTest.php
  27. 3
    3
      tests/lib/Security/CertificateManagerTest.php
  28. 3
    3
      tests/lib/Security/IdentityProof/ManagerTest.php
  29. 3
    3
      tests/lib/Share20/ManagerTest.php
  30. 2
    2
      tests/lib/TempManagerTest.php
  31. 3
    3
      tests/lib/Template/CSSResourceLocatorTest.php
  32. 5
    5
      tests/lib/Template/IconsCacherTest.php
  33. 3
    3
      tests/lib/Template/JSCombinerTest.php
  34. 3
    3
      tests/lib/Template/JSResourceLocatorTest.php
  35. 2
    2
      tests/lib/Template/ResourceLocatorTest.php
  36. 3
    3
      tests/lib/Template/SCSSCacherTest.php
  37. 2
    1
      tests/lib/Traits/EncryptionTrait.php
  38. 3
    3
      tests/lib/Updater/ChangesCheckTest.php
  39. 3
    3
      tests/lib/User/SessionTest.php

+ 3
- 3
tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php View File

@@ -29,15 +29,15 @@ use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\ILogger;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Test\TestCase;

class CleanPreviewsBackgroundJobTest extends TestCase {
/** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject */
private $rootFolder;

/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
/** @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */
private $logger;

/** @var IJobList|\PHPUnit_Framework_MockObject_MockObject */
@@ -56,7 +56,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
parent::setUp();

$this->rootFolder = $this->createMock(IRootFolder::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->jobList = $this->createMock(IJobList::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->userManager = $this->createMock(IUserManager::class);

+ 7
- 7
tests/lib/AppFramework/Routing/RoutingTest.php View File

@@ -6,9 +6,9 @@ use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Routing\RouteConfig;
use OC\Route\Route;
use OC\Route\Router;
use OCP\ILogger;
use OCP\Route\IRouter;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;

class RoutingTest extends \Test\TestCase {
public function testSimpleRoute() {
@@ -133,7 +133,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// load route configuration
@@ -154,7 +154,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// load route configuration
@@ -214,7 +214,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// we expect create to be called once:
@@ -264,7 +264,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// we expect create to be called once:
@@ -291,7 +291,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// route mocks
@@ -351,7 +351,7 @@ class RoutingTest extends \Test\TestCase {
/** @var IRouter|MockObject $router */
$router = $this->getMockBuilder(Router::class)
->onlyMethods(['create'])
->setConstructorArgs([$this->createMock(ILogger::class)])
->setConstructorArgs([$this->createMock(LoggerInterface::class)])
->getMock();

// route mocks

+ 16
- 16
tests/lib/DB/QueryBuilder/QueryBuilderTest.php View File

@@ -30,7 +30,7 @@ use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;

/**
* Class QueryBuilderTest
@@ -49,7 +49,7 @@ class QueryBuilderTest extends \Test\TestCase {
/** @var SystemConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;

/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;

protected function setUp(): void {
@@ -57,7 +57,7 @@ class QueryBuilderTest extends \Test\TestCase {

$this->connection = \OC::$server->getDatabaseConnection();
$this->config = $this->createMock(SystemConfig::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->queryBuilder = new QueryBuilder($this->connection, $this->config, $this->logger);
}

@@ -176,7 +176,7 @@ class QueryBuilderTest extends \Test\TestCase {

public function dataSelect() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
// select('column1')
@@ -244,7 +244,7 @@ class QueryBuilderTest extends \Test\TestCase {

public function dataSelectAlias() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
['configvalue', 'cv', ['cv' => '99']],
@@ -353,7 +353,7 @@ class QueryBuilderTest extends \Test\TestCase {

public function dataAddSelect() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$queryBuilder = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
// addSelect('column1')
@@ -508,7 +508,7 @@ class QueryBuilderTest extends \Test\TestCase {

public function dataFrom() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$qb = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
[$qb->createFunction('(' . $qb->select('*')->from('test')->getSQL() . ')'), 'q', null, null, [
@@ -1212,7 +1212,7 @@ class QueryBuilderTest extends \Test\TestCase {

public function dataGetTableName() {
$config = $this->createMock(SystemConfig::class);
$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$qb = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
['*PREFIX*table', null, '`*PREFIX*table`'],
@@ -1414,12 +1414,12 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn($this->createMock(Result::class));
$this->logger
->expects($this->once())
->method('logException')
->willReturnCallback(function ($e, $parameters) {
$this->assertInstanceOf(QueryException::class, $e);
->method('error')
->willReturnCallback(function ($message, $parameters) {
$this->assertInstanceOf(QueryException::class, $parameters['exception']);
$this->assertSame(
'More than 1000 expressions in a list are not allowed on Oracle.',
$parameters['message']
$message
);
});
$this->config
@@ -1449,12 +1449,12 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn($this->createMock(Result::class));
$this->logger
->expects($this->once())
->method('logException')
->willReturnCallback(function ($e, $parameters) {
$this->assertInstanceOf(QueryException::class, $e);
->method('error')
->willReturnCallback(function ($message, $parameters) {
$this->assertInstanceOf(QueryException::class, $parameters['exception']);
$this->assertSame(
'The number of parameters must not exceed 65535. Restriction by PostgreSQL.',
$parameters['message']
$message
);
});
$this->config

+ 3
- 4
tests/lib/Encryption/EncryptionWrapperTest.php View File

@@ -25,7 +25,7 @@ use OC\Encryption\EncryptionWrapper;
use OC\Encryption\Manager;
use OC\Memcache\ArrayCache;
use OCP\Files\Storage;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;

class EncryptionWrapperTest extends TestCase {
@@ -33,7 +33,7 @@ class EncryptionWrapperTest extends TestCase {
/** @var EncryptionWrapper */
private $instance;

/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\ILogger */
/** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */
private $logger;

/** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */
@@ -47,8 +47,7 @@ class EncryptionWrapperTest extends TestCase {

$this->arrayCache = $this->createMock(ArrayCache::class);
$this->manager = $this->createMock(Manager::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);

$this->instance = new EncryptionWrapper($this->arrayCache, $this->manager, $this->logger);
}

+ 3
- 3
tests/lib/Encryption/ManagerTest.php View File

@@ -9,7 +9,7 @@ use OC\Memcache\ArrayCache;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;

class ManagerTest extends TestCase {
@@ -20,7 +20,7 @@ class ManagerTest extends TestCase {
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;

/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;

/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
@@ -38,7 +38,7 @@ class ManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->l10n = $this->createMock(IL10N::class);
$this->view = $this->createMock(View::class);
$this->util = $this->createMock(Util::class);

+ 3
- 3
tests/lib/EventDispatcher/SymfonyAdapterTest.php View File

@@ -30,8 +30,8 @@ use OC\EventDispatcher\GenericEventWrapper;
use OC\EventDispatcher\SymfonyAdapter;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\GenericEvent;
use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -43,7 +43,7 @@ class SymfonyAdapterTest extends TestCase {
/** @var EventDispatcher|MockObject */
private $eventDispatcher;

/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
private $logger;

/** @var EventDispatcherInterface */
@@ -53,7 +53,7 @@ class SymfonyAdapterTest extends TestCase {
parent::setUp();

$this->eventDispatcher = $this->createMock(EventDispatcher::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);

$this->adapter = new SymfonyAdapter(
$this->eventDispatcher,

+ 2
- 2
tests/lib/Files/Config/UserMountCacheTest.php View File

@@ -11,7 +11,6 @@ namespace Test\Files\Config;
use OC\DB\QueryBuilder\Literal;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Storage;
use OC\Log;
use OC\User\Manager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\ICachedMountInfo;
@@ -19,6 +18,7 @@ use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
use Test\Util\User\Dummy;
@@ -66,7 +66,7 @@ class UserMountCacheTest extends TestCase {
$userBackend->createUser('u2', '');
$userBackend->createUser('u3', '');
$this->userManager->registerBackend($userBackend);
$this->cache = new \OC\Files\Config\UserMountCache($this->connection, $this->userManager, $this->createMock(Log::class));
$this->cache = new \OC\Files\Config\UserMountCache($this->connection, $this->userManager, $this->createMock(LoggerInterface::class));
}

protected function tearDown(): void {

+ 2
- 1
tests/lib/Files/EtagTest.php View File

@@ -11,6 +11,7 @@ namespace Test\Files;
use OC\Files\Filesystem;
use OCP\EventDispatcher\IEventDispatcher;
use OCA\Files_Sharing\AppInfo\Application;
use Psr\Log\LoggerInterface;

/**
* Class EtagTest
@@ -69,7 +70,7 @@ class EtagTest extends \Test\TestCase {
$files = ['/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt'];
$originalEtags = $this->getEtags($files);

$scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->backgroundScan('/');

$newEtags = $this->getEtags($files);

+ 3
- 3
tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php View File

@@ -30,8 +30,8 @@ use OC\Files\ObjectStore\S3;
use OC\Files\Storage\StorageFactory;
use OCP\Files\Storage\IStorageFactory;
use OCP\IConfig;
use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;

/**
* @group DB
@@ -43,7 +43,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
/** @var ObjectStorePreviewCacheMountProvider */
protected $provider;

/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;
/** @var IConfig|MockObject */
protected $config;
@@ -54,7 +54,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
protected function setUp(): void {
parent::setUp();

$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = $this->createMock(IConfig::class);
$this->loader = $this->createMock(StorageFactory::class);


+ 2
- 2
tests/lib/Files/Node/HookConnectorTest.php View File

@@ -30,9 +30,9 @@ use OCP\Files\Events\Node\NodeRenamedEvent;
use OCP\Files\Events\Node\NodeTouchedEvent;
use OCP\Files\Events\Node\NodeWrittenEvent;
use OCP\Files\Node;
use OCP\ILogger;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Test\TestCase;
@@ -77,7 +77,7 @@ class HookConnectorTest extends TestCase {
$this->view,
\OC::$server->getUserManager()->get($this->userId),
\OC::$server->getUserMountCache(),
$this->createMock(ILogger::class),
$this->createMock(LoggerInterface::class),
$this->createMock(IUserManager::class),
$this->createMock(IEventDispatcher::class)
);

+ 2
- 2
tests/lib/Files/Node/IntegrationTest.php View File

@@ -13,8 +13,8 @@ use OC\Files\Storage\Temporary;
use OC\Files\View;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Mount\IMountManager;
use OCP\ILogger;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Test\Traits\UserTrait;

/**
@@ -59,7 +59,7 @@ class IntegrationTest extends \Test\TestCase {
$this->view,
$user,
\OC::$server->getUserMountCache(),
$this->createMock(ILogger::class),
$this->createMock(LoggerInterface::class),
$this->createMock(IUserManager::class),
$this->createMock(IEventDispatcher::class)
);

+ 3
- 3
tests/lib/Files/Node/NodeTest.php View File

@@ -16,9 +16,9 @@ use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\Storage;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;

/**
* Class NodeTest
@@ -36,7 +36,7 @@ abstract class NodeTest extends \Test\TestCase {
protected $root;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
protected $userMountCache;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
@@ -56,7 +56,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->root = $this->getMockBuilder('\OC\Files\Node\Root')

+ 3
- 3
tests/lib/Files/Node/RootTest.php View File

@@ -14,9 +14,9 @@ use OC\Files\Mount\Manager;
use OC\Files\Node\Folder;
use OC\Files\View;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;

/**
* Class RootTest
@@ -30,7 +30,7 @@ class RootTest extends \Test\TestCase {
private $manager;
/** @var \OCP\Files\Config\IUserMountCache|\PHPUnit\Framework\MockObject\MockObject */
private $userMountCache;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
private $userManager;
@@ -47,7 +47,7 @@ class RootTest extends \Test\TestCase {
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
->disableOriginalConstructor()
->getMock();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->userManager = $this->createMock(IUserManager::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
}

+ 6
- 7
tests/lib/Files/Storage/Wrapper/EncryptionTest.php View File

@@ -19,7 +19,7 @@ use OCP\Files\Cache\ICache;
use OCP\Files\Mount\IMountPoint;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\Files\Storage\Storage;

@@ -151,7 +151,7 @@ class EncryptionTest extends Storage {
->getMock();
$this->file->expects($this->any())->method('getAccessList')->willReturn([]);

$this->logger = $this->createMock(Log::class);
$this->logger = $this->createMock(LoggerInterface::class);

$this->sourceStorage = new Temporary([]);

@@ -584,7 +584,7 @@ class EncryptionTest extends Storage {
$this->arrayCache
]
)->getMock();
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
->disableOriginalConstructor()->getMock();
$cache->expects($this->any())
@@ -607,9 +607,9 @@ class EncryptionTest extends Storage {
)
->setMethods(['getCache','readFirstBlock', 'parseRawHeader'])
->getMock();
$instance->expects($this->once())->method('getCache')->willReturn($cache);
$instance->expects($this->once())->method(('parseRawHeader'))
->willReturn([Util::HEADER_ENCRYPTION_MODULE_KEY => 'OC_DEFAULT_MODULE']);

@@ -989,7 +989,6 @@ class EncryptionTest extends Storage {
) {
$encryptionManager = $this->createMock(\OC\Encryption\Manager::class);
$util = $this->createMock(Util::class);
$logger = $this->createMock(ILogger::class);
$fileHelper = $this->createMock(IFile::class);
$uid = null;
$keyStorage = $this->createMock(IStorage::class);
@@ -1007,7 +1006,7 @@ class EncryptionTest extends Storage {
['mountPoint' => '', 'mount' => $mount, 'storage' => ''],
$encryptionManager,
$util,
$logger,
$this->logger,
$fileHelper,
$uid,
$keyStorage,

+ 4
- 4
tests/lib/Files/Type/DetectionTest.php View File

@@ -22,8 +22,8 @@
namespace Test\Files\Type;

use OC\Files\Type\Detection;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class DetectionTest extends \Test\TestCase {
/** @var Detection */
@@ -33,7 +33,7 @@ class DetectionTest extends \Test\TestCase {
parent::setUp();
$this->detection = new Detection(
\OC::$server->getURLGenerator(),
\OC::$server->getLogger(),
\OC::$server->get(LoggerInterface::class),
\OC::$SERVERROOT . '/config/',
\OC::$SERVERROOT . '/resources/config/'
);
@@ -151,8 +151,8 @@ class DetectionTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();

/** @var ILogger $logger */
$logger = $this->createMock(ILogger::class);
/** @var LoggerInterface $logger */
$logger = $this->createMock(LoggerInterface::class);

//Only call the url generator once
$urlGenerator->expects($this->once())

+ 7
- 6
tests/lib/Files/Utils/ScannerTest.php View File

@@ -15,6 +15,7 @@ use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IUser;
use Psr\Log\LoggerInterface;

class TestScanner extends \OC\Files\Utils\Scanner {
/**
@@ -71,7 +72,7 @@ class ScannerTest extends \Test\TestCase {
$storage->file_put_contents('foo.txt', 'qwerty');
$storage->file_put_contents('folder/bar.txt', 'qwerty');

$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->addMount($mount);

$scanner->scan('');
@@ -93,7 +94,7 @@ class ScannerTest extends \Test\TestCase {
$storage->file_put_contents('foo.txt', 'qwerty');
$storage->file_put_contents('folder/bar.txt', 'qwerty');

$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->addMount($mount);

$scanner->scan('');
@@ -131,7 +132,7 @@ class ScannerTest extends \Test\TestCase {
$storage->file_put_contents('foo.txt', 'qwerty');
$storage->file_put_contents('folder/bar.txt', 'qwerty');

$scanner = new \OC\Files\Utils\Scanner($uid, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new \OC\Files\Utils\Scanner($uid, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));

$this->assertFalse($cache->inCache('folder/bar.txt'));
$scanner->scan('/' . $uid . '/files/foo');
@@ -163,7 +164,7 @@ class ScannerTest extends \Test\TestCase {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid path to scan');

$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->scan($invalidPath);
}

@@ -177,7 +178,7 @@ class ScannerTest extends \Test\TestCase {
$storage->file_put_contents('folder/bar.txt', 'qwerty');
$storage->touch('folder/bar.txt', time() - 200);

$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->addMount($mount);

$scanner->scan('');
@@ -203,7 +204,7 @@ class ScannerTest extends \Test\TestCase {
$storage->file_put_contents('folder/bar.txt', 'qwerty');
$storage->file_put_contents('folder/subfolder/foobar.txt', 'qwerty');

$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->getLogger());
$scanner = new TestScanner('', \OC::$server->getDatabaseConnection(), $this->createMock(IEventDispatcher::class), \OC::$server->get(LoggerInterface::class));
$scanner->addMount($mount);

$scanner->scan('', $recusive = false);

+ 3
- 3
tests/lib/Group/ManagerTest.php View File

@@ -26,9 +26,9 @@ namespace Test\Group;
use OC\Group\Database;
use OC\User\Manager;
use OCP\GroupInterface;
use OCP\ILogger;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;

@@ -37,7 +37,7 @@ class ManagerTest extends TestCase {
protected $userManager;
/** @var EventDispatcherInterface|MockObject */
protected $dispatcher;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;

protected function setUp(): void {
@@ -45,7 +45,7 @@ class ManagerTest extends TestCase {

$this->userManager = $this->createMock(Manager::class);
$this->dispatcher = $this->createMock(EventDispatcherInterface::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
}

private function getTestUser($userId) {

+ 0
- 4
tests/lib/Http/Client/ClientServiceTest.php View File

@@ -17,7 +17,6 @@ use OC\Http\Client\DnsPinMiddleware;
use OC\Http\Client\LocalAddressChecker;
use OCP\ICertificateManager;
use OCP\IConfig;
use OCP\ILogger;

/**
* Class ClientServiceTest
@@ -28,7 +27,6 @@ class ClientServiceTest extends \Test\TestCase {
$config = $this->createMock(IConfig::class);
/** @var ICertificateManager $certificateManager */
$certificateManager = $this->createMock(ICertificateManager::class);
$logger = $this->createMock(ILogger::class);
$dnsPinMiddleware = $this->createMock(DnsPinMiddleware::class);
$dnsPinMiddleware
->expects($this->atLeastOnce())
@@ -39,7 +37,6 @@ class ClientServiceTest extends \Test\TestCase {

$clientService = new ClientService(
$config,
$logger,
$certificateManager,
$dnsPinMiddleware,
$localAddressChecker
@@ -53,7 +50,6 @@ class ClientServiceTest extends \Test\TestCase {
$this->assertEquals(
new Client(
$config,
$logger,
$certificateManager,
$guzzleClient,
$localAddressChecker

+ 3
- 8
tests/lib/Http/Client/ClientTest.php View File

@@ -15,7 +15,6 @@ use OC\Security\CertificateManager;
use OCP\Http\Client\LocalServerException;
use OCP\ICertificateManager;
use OCP\IConfig;
use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;

/**
@@ -30,8 +29,6 @@ class ClientTest extends \Test\TestCase {
private $client;
/** @var IConfig|MockObject */
private $config;
/** @var ILogger|MockObject */
private $logger;
/** @var LocalAddressChecker|MockObject */
private $localAddressChecker;
/** @var array */
@@ -40,13 +37,11 @@ class ClientTest extends \Test\TestCase {
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(ILogger::class);
$this->guzzleClient = $this->createMock(\GuzzleHttp\Client::class);
$this->certificateManager = $this->createMock(ICertificateManager::class);
$this->localAddressChecker = $this->createMock(LocalAddressChecker::class);
$this->client = new Client(
$this->config,
$this->logger,
$this->certificateManager,
$this->guzzleClient,
$this->localAddressChecker
@@ -244,7 +239,7 @@ class ClientTest extends \Test\TestCase {
->method('ThrowIfLocalAddress')
->with('http://' . $uri)
->will($this->throwException(new LocalServerException()));
$this->client->post('http://' . $uri);
}

@@ -259,7 +254,7 @@ class ClientTest extends \Test\TestCase {
->method('ThrowIfLocalAddress')
->with('http://' . $uri)
->will($this->throwException(new LocalServerException()));
$this->client->put('http://' . $uri);
}

@@ -292,7 +287,7 @@ class ClientTest extends \Test\TestCase {
->method('getSystemValueBool')
->with('allow_local_remote_servers', false)
->willReturn(true);
$this->certificateManager
->expects($this->once())
->method('getAbsoluteBundlePath')

+ 2
- 2
tests/lib/Http/Client/LocalAddressCheckerTest.php View File

@@ -26,9 +26,9 @@ declare(strict_types=1);

namespace Test\Http\Client;

use OCP\ILogger;
use OCP\Http\Client\LocalServerException;
use OC\Http\Client\LocalAddressChecker;
use Psr\Log\LoggerInterface;

class LocalAddressCheckerTest extends \Test\TestCase {
/** @var LocalAddressChecker */
@@ -37,7 +37,7 @@ class LocalAddressCheckerTest extends \Test\TestCase {
protected function setUp(): void {
parent::setUp();

$logger = $this->createMock(ILogger::class);
$logger = $this->createMock(LoggerInterface::class);
$this->localAddressChecker = new LocalAddressChecker($logger);
}


+ 2
- 1
tests/lib/Lock/DBLockingProviderTest.php View File

@@ -23,6 +23,7 @@ namespace Test\Lock;

use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Lock\ILockingProvider;
use Psr\Log\LoggerInterface;

/**
* Class DBLockingProvider
@@ -65,7 +66,7 @@ class DBLockingProviderTest extends LockingProvider {
*/
protected function getInstance() {
$this->connection = \OC::$server->getDatabaseConnection();
return new \OC\Lock\DBLockingProvider($this->connection, \OC::$server->getLogger(), $this->timeFactory, 3600);
return new \OC\Lock\DBLockingProvider($this->connection, \OC::$server->get(LoggerInterface::class), $this->timeFactory, 3600);
}

protected function tearDown(): void {

+ 2
- 1
tests/lib/Lock/NonCachingDBLockingProviderTest.php View File

@@ -22,6 +22,7 @@
namespace Test\Lock;

use OCP\Lock\ILockingProvider;
use Psr\Log\LoggerInterface;

/**
* @group DB
@@ -34,7 +35,7 @@ class NonCachingDBLockingProviderTest extends DBLockingProviderTest {
*/
protected function getInstance() {
$this->connection = \OC::$server->getDatabaseConnection();
return new \OC\Lock\DBLockingProvider($this->connection, \OC::$server->getLogger(), $this->timeFactory, 3600, false);
return new \OC\Lock\DBLockingProvider($this->connection, \OC::$server->get(LoggerInterface::class), $this->timeFactory, 3600, false);
}

public function testDoubleShared() {

+ 3
- 3
tests/lib/Mail/MailerTest.php View File

@@ -18,10 +18,10 @@ use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Mail\Events\BeforeMessageSent;
use Psr\Log\LoggerInterface;
use Swift_SwiftException;
use Test\TestCase;

@@ -30,7 +30,7 @@ class MailerTest extends TestCase {
private $config;
/** @var Defaults|\PHPUnit\Framework\MockObject\MockObject */
private $defaults;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
private $urlGenerator;
@@ -47,7 +47,7 @@ class MailerTest extends TestCase {

$this->config = $this->createMock(IConfig::class);
$this->defaults = $this->createMock(Defaults::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n = $this->createMock(IL10N::class);
$this->dispatcher = $this->createMock(IEventDispatcher::class);

+ 3
- 3
tests/lib/Memcache/FactoryTest.php View File

@@ -22,7 +22,7 @@
namespace Test\Memcache;

use OC\Memcache\NullCache;
use OCP\ILogger;
use Psr\Log\LoggerInterface;

class Test_Factory_Available_Cache1 extends NullCache {
public function __construct($prefix = '') {
@@ -118,7 +118,7 @@ class FactoryTest extends \Test\TestCase {
*/
public function testCacheAvailability($localCache, $distributedCache, $lockingCache,
$expectedLocalCache, $expectedDistributedCache, $expectedLockingCache) {
$logger = $this->getMockBuilder(ILogger::class)->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$factory = new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache, $lockingCache);
$this->assertTrue(is_a($factory->createLocal(), $expectedLocalCache));
$this->assertTrue(is_a($factory->createDistributed(), $expectedDistributedCache));
@@ -131,7 +131,7 @@ class FactoryTest extends \Test\TestCase {
public function testCacheNotAvailableException($localCache, $distributedCache) {
$this->expectException(\OCP\HintException::class);

$logger = $this->getMockBuilder(ILogger::class)->getMock();
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache);
}
}

+ 3
- 3
tests/lib/Route/RouterTest.php View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace Test\Route;

use OC\Route\Router;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
@@ -34,8 +34,8 @@ use Test\TestCase;
*/
class RouterTest extends TestCase {
public function testGenerateConsecutively(): void {
/** @var ILogger $logger */
$logger = $this->createMock(ILogger::class);
/** @var LoggerInterface $logger */
$logger = $this->createMock(LoggerInterface::class);
$router = new Router($logger);

$this->assertEquals('/index.php/apps/files/', $router->generate('files.view.index'));

+ 3
- 3
tests/lib/Security/Bruteforce/ThrottlerTest.php View File

@@ -28,7 +28,7 @@ use OC\AppFramework\Utility\TimeFactory;
use OC\Security\Bruteforce\Throttler;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
@@ -42,14 +42,14 @@ class ThrottlerTest extends TestCase {
private $throttler;
/** @var IDBConnection */
private $dbConnection;
/** @var ILogger */
/** @var LoggerInterface */
private $logger;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;

protected function setUp(): void {
$this->dbConnection = $this->createMock(IDBConnection::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = $this->createMock(IConfig::class);

$this->throttler = new Throttler(

+ 3
- 3
tests/lib/Security/CertificateManagerTest.php View File

@@ -14,8 +14,8 @@ namespace Test\Security;
use OC\Files\View;
use OC\Security\CertificateManager;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;

/**
* Class CertificateManagerTest
@@ -58,7 +58,7 @@ class CertificateManagerTest extends \Test\TestCase {
$this->certificateManager = new CertificateManager(
new \OC\Files\View(),
$config,
$this->createMock(ILogger::class),
$this->createMock(LoggerInterface::class),
$this->random
);
}
@@ -156,7 +156,7 @@ class CertificateManagerTest extends \Test\TestCase {

/** @var CertificateManager | \PHPUnit\Framework\MockObject\MockObject $certificateManager */
$certificateManager = $this->getMockBuilder('OC\Security\CertificateManager')
->setConstructorArgs([$view, $config, $this->createMock(ILogger::class), $this->random])
->setConstructorArgs([$view, $config, $this->createMock(LoggerInterface::class), $this->random])
->setMethods(['getFilemtimeOfCaBundle', 'getCertificateBundle'])
->getMock();


+ 3
- 3
tests/lib/Security/IdentityProof/ManagerTest.php View File

@@ -32,10 +32,10 @@ use OCP\Files\IAppData;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUser;
use OCP\Security\ICrypto;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

class ManagerTest extends TestCase {
@@ -49,7 +49,7 @@ class ManagerTest extends TestCase {
private $manager;
/** @var IConfig|MockObject */
private $config;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
private $logger;

protected function setUp(): void {
@@ -63,7 +63,7 @@ class ManagerTest extends TestCase {
->method('get')
->with('identityproof')
->willReturn($this->appData);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);

$this->crypto = $this->createMock(ICrypto::class);
$this->manager = $this->getManager(['generateKeyPair']);

+ 3
- 3
tests/lib/Share20/ManagerTest.php View File

@@ -41,7 +41,6 @@ use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\IUser;
@@ -60,6 +59,7 @@ use OCP\Share\IShare;
use OCP\Share\IShareProvider;
use PHPUnit\Framework\MockObject\MockBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

@@ -73,7 +73,7 @@ class ManagerTest extends \Test\TestCase {

/** @var Manager */
protected $manager;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
protected $logger;
/** @var IConfig|MockObject */
protected $config;
@@ -113,7 +113,7 @@ class ManagerTest extends \Test\TestCase {
protected $knownUserService;

protected function setUp(): void {
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = $this->createMock(IConfig::class);
$this->secureRandom = $this->createMock(ISecureRandom::class);
$this->hasher = $this->createMock(IHasher::class);

+ 2
- 2
tests/lib/TempManagerTest.php View File

@@ -34,8 +34,8 @@ class TempManagerTest extends \Test\TestCase {
}

/**
* @param \OCP\ILogger $logger
* @param \OCP\IConfig $config
* @param ?LoggerInterface $logger
* @param ?IConfig $config
* @return \OC\TempManager
*/
protected function getManager($logger = null, $config = null) {

+ 3
- 3
tests/lib/Template/CSSResourceLocatorTest.php View File

@@ -34,8 +34,8 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IAppData;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class CSSResourceLocatorTest extends \Test\TestCase {
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
@@ -48,7 +48,7 @@ class CSSResourceLocatorTest extends \Test\TestCase {
protected $themingDefaults;
/** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var IconsCacher|\PHPUnit\Framework\MockObject\MockObject */
protected $iconsCacher;
@@ -60,7 +60,7 @@ class CSSResourceLocatorTest extends \Test\TestCase {
protected function setUp(): void {
parent::setUp();

$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->appData = $this->createMock(AppData::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->config = $this->createMock(IConfig::class);

+ 5
- 5
tests/lib/Template/IconsCacherTest.php View File

@@ -32,11 +32,11 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IAppData;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class IconsCacherTest extends \Test\TestCase {
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
@@ -46,7 +46,7 @@ class IconsCacherTest extends \Test\TestCase {
private $timeFactory;

protected function setUp(): void {
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->appData = $this->createMock(AppData::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);

@@ -110,7 +110,7 @@ class IconsCacherTest extends \Test\TestCase {
";
$expected = "
icon.test {
background-image: var(--icon-test);
}
";
@@ -133,7 +133,7 @@ class IconsCacherTest extends \Test\TestCase {
";
$expected = "
icon.test {
background-image: var(--icon-test);
}
";

+ 3
- 3
tests/lib/Template/JSCombinerTest.php View File

@@ -32,8 +32,8 @@ use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class JSCombinerTest extends \Test\TestCase {
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
@@ -46,7 +46,7 @@ class JSCombinerTest extends \Test\TestCase {
protected $depsCache;
/** @var JSCombiner */
protected $jsCombiner;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
@@ -62,7 +62,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->cacheFactory->expects($this->at(0))
->method('createDistributed')
->willReturn($this->depsCache);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->jsCombiner = new JSCombiner(
$this->appData,
$this->urlGenerator,

+ 3
- 3
tests/lib/Template/JSResourceLocatorTest.php View File

@@ -28,8 +28,8 @@ use OC\Template\JSCombiner;
use OC\Template\JSResourceLocator;
use OCP\Files\IAppData;
use OCP\ICacheFactory;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class JSResourceLocatorTest extends \Test\TestCase {
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
@@ -40,7 +40,7 @@ class JSResourceLocatorTest extends \Test\TestCase {
protected $config;
/** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $cacheFactory;
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;

protected function setUp(): void {
@@ -50,7 +50,7 @@ class JSResourceLocatorTest extends \Test\TestCase {
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->config = $this->createMock(SystemConfig::class);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
}

private function jsResourceLocator() {

+ 2
- 2
tests/lib/Template/ResourceLocatorTest.php View File

@@ -9,7 +9,7 @@
namespace Test\Template;

use OC\Template\ResourceNotFoundException;
use OCP\ILogger;
use Psr\Log\LoggerInterface;

class ResourceLocatorTest extends \Test\TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject */
@@ -17,7 +17,7 @@ class ResourceLocatorTest extends \Test\TestCase {

protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
}

/**

+ 3
- 3
tests/lib/Template/SCSSCacherTest.php View File

@@ -37,11 +37,11 @@ use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;

class SCSSCacherTest extends \Test\TestCase {
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
/** @var IAppData|\PHPUnit\Framework\MockObject\MockObject */
protected $appData;
@@ -68,7 +68,7 @@ class SCSSCacherTest extends \Test\TestCase {

protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->appData = $this->createMock(AppData::class);
$this->iconsCacher = $this->createMock(IconsCacher::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);

+ 2
- 1
tests/lib/Traits/EncryptionTrait.php View File

@@ -16,6 +16,7 @@ use OCA\Encryption\KeyManager;
use OCA\Encryption\Users\Setup;
use OCP\Encryption\IManager;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;

/**
* Enables encryption
@@ -82,7 +83,7 @@ trait EncryptionTrait {
$encryptionWrapper = new EncryptionWrapper(
new ArrayCache(),
\OC::$server->getEncryptionManager(),
\OC::$server->getLogger()
\OC::$server->get(LoggerInterface::class)
);

$this->registerStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage']);

+ 3
- 3
tests/lib/Updater/ChangesCheckTest.php View File

@@ -33,8 +33,8 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\ILogger;
use Test\TestCase;
use Psr\Log\LoggerInterface;

class ChangesCheckTest extends TestCase {
/** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
@@ -46,7 +46,7 @@ class ChangesCheckTest extends TestCase {
/** @var ChangesMapper|\PHPUnit\Framework\MockObject\MockObject */
protected $mapper;

/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;

protected function setUp(): void {
@@ -54,7 +54,7 @@ class ChangesCheckTest extends TestCase {

$this->clientService = $this->createMock(IClientService::class);
$this->mapper = $this->createMock(ChangesMapper::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);

$this->checker = new ChangesCheck($this->clientService, $this->mapper, $this->logger);
}

+ 3
- 3
tests/lib/User/SessionTest.php View File

@@ -24,7 +24,6 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IRequestId;
use OCP\ISession;
@@ -33,6 +32,7 @@ use OCP\Lockdown\ILockdownManager;
use OCP\Security\ISecureRandom;
use OCP\User\Events\PostLoginEvent;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use OC\Security\CSRF\CsrfTokenManager;

@@ -57,7 +57,7 @@ class SessionTest extends \Test\TestCase {
private $userSession;
/** @var ILockdownManager|MockObject */
private $lockdownManager;
/** @var ILogger|MockObject */
/** @var LoggerInterface|MockObject */
private $logger;
/** @var IEventDispatcher|MockObject */
private $dispatcher;
@@ -76,7 +76,7 @@ class SessionTest extends \Test\TestCase {
$this->manager = $this->createMock(Manager::class);
$this->session = $this->createMock(ISession::class);
$this->lockdownManager = $this->createMock(ILockdownManager::class);
$this->logger = $this->createMock(ILogger::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([

Loading…
Cancel
Save