diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Accounts/AccountManagerTest.php | 7 | ||||
-rw-r--r-- | tests/lib/Accounts/AccountTest.php | 1 | ||||
-rw-r--r-- | tests/lib/Activity/ManagerTest.php | 16 | ||||
-rw-r--r-- | tests/lib/AppConfigTest.php | 8 | ||||
-rw-r--r-- | tests/lib/Avatar/AvatarManagerTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Avatar/GuestAvatarTest.php | 5 | ||||
-rw-r--r-- | tests/lib/Avatar/UserAvatarTest.php | 18 | ||||
-rw-r--r-- | tests/lib/Config/LexiconTest.php | 15 | ||||
-rw-r--r-- | tests/lib/Config/UserConfigTest.php | 8 | ||||
-rw-r--r-- | tests/lib/DB/QueryBuilder/FunctionBuilderTest.php | 1 | ||||
-rw-r--r-- | tests/lib/Files/Mount/ObjectHomeMountProviderTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php | 285 | ||||
-rw-r--r-- | tests/lib/Files/ViewTest.php | 27 | ||||
-rw-r--r-- | tests/lib/Search/SearchComposerTest.php | 290 | ||||
-rw-r--r-- | tests/lib/Security/IdentityProof/ManagerTest.php | 61 | ||||
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 5 | ||||
-rw-r--r-- | tests/lib/TaskProcessing/TaskProcessingTest.php | 16 | ||||
-rw-r--r-- | tests/lib/TemplateLayoutTest.php | 4 |
18 files changed, 715 insertions, 56 deletions
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php index 97078467936..c625644bd96 100644 --- a/tests/lib/Accounts/AccountManagerTest.php +++ b/tests/lib/Accounts/AccountManagerTest.php @@ -575,6 +575,13 @@ class AccountManagerTest extends TestCase { ], [ + 'name' => IAccountManager::PROPERTY_BLUESKY, + 'value' => '', + 'scope' => IAccountManager::SCOPE_LOCAL, + 'verified' => IAccountManager::NOT_VERIFIED, + ], + + [ 'name' => IAccountManager::PROPERTY_FEDIVERSE, 'value' => '', 'scope' => IAccountManager::SCOPE_LOCAL, diff --git a/tests/lib/Accounts/AccountTest.php b/tests/lib/Accounts/AccountTest.php index 514ff17e58e..ddba7c559c0 100644 --- a/tests/lib/Accounts/AccountTest.php +++ b/tests/lib/Accounts/AccountTest.php @@ -64,6 +64,7 @@ class AccountTest extends TestCase { IAccountManager::PROPERTY_AVATAR => new AccountProperty(IAccountManager::PROPERTY_AVATAR, '', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, ''), IAccountManager::PROPERTY_PHONE => new AccountProperty(IAccountManager::PROPERTY_PHONE, '+358407991028', IAccountManager::SCOPE_LOCAL, IAccountManager::NOT_VERIFIED, ''), IAccountManager::PROPERTY_TWITTER => new AccountProperty(IAccountManager::PROPERTY_TWITTER, 'therealsteve', IAccountManager::SCOPE_PRIVATE, IAccountManager::NOT_VERIFIED, ''), + IAccountManager::PROPERTY_BLUESKY => new AccountProperty(IAccountManager::PROPERTY_BLUESKY, 'therealsteve.bsky.social', IAccountManager::SCOPE_PRIVATE, IAccountManager::NOT_VERIFIED, ''), IAccountManager::PROPERTY_ORGANISATION => new AccountProperty(IAccountManager::PROPERTY_ORGANISATION, 'Steve Incorporated', IAccountManager::SCOPE_FEDERATED, IAccountManager::NOT_VERIFIED, ''), IAccountManager::PROPERTY_ROLE => new AccountProperty(IAccountManager::PROPERTY_ROLE, 'Founder', IAccountManager::SCOPE_FEDERATED, IAccountManager::NOT_VERIFIED, ''), IAccountManager::PROPERTY_HEADLINE => new AccountProperty(IAccountManager::PROPERTY_HEADLINE, 'I am Steve', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, ''), diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php index db0bedce359..c7c30357ec7 100644 --- a/tests/lib/Activity/ManagerTest.php +++ b/tests/lib/Activity/ManagerTest.php @@ -11,6 +11,7 @@ namespace Test\Activity; use OCP\Activity\Exceptions\IncompleteActivityException; use OCP\Activity\IConsumer; use OCP\Activity\IEvent; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; @@ -30,6 +31,7 @@ class ManagerTest extends TestCase { protected IConfig&MockObject $config; protected IValidator&MockObject $validator; protected IRichTextFormatter&MockObject $richTextFormatter; + private ITimeFactory&MockObject $time; protected function setUp(): void { parent::setUp(); @@ -39,6 +41,7 @@ class ManagerTest extends TestCase { $this->config = $this->createMock(IConfig::class); $this->validator = $this->createMock(IValidator::class); $this->richTextFormatter = $this->createMock(IRichTextFormatter::class); + $this->time = $this->createMock(ITimeFactory::class); $this->activityManager = new \OC\Activity\Manager( $this->request, @@ -46,7 +49,8 @@ class ManagerTest extends TestCase { $this->config, $this->validator, $this->richTextFormatter, - $this->createMock(IL10N::class) + $this->createMock(IL10N::class), + $this->time, ); $this->assertSame([], self::invokePrivate($this->activityManager, 'getConsumers')); @@ -217,6 +221,11 @@ class ManagerTest extends TestCase { ->willReturn($authorObject); } + $time = time(); + $this->time + ->method('getTime') + ->willReturn($time); + $event = $this->activityManager->generateEvent(); $event->setApp('test') ->setType('test_type') @@ -230,9 +239,8 @@ class ManagerTest extends TestCase { $consumer->expects($this->once()) ->method('receive') ->with($event) - ->willReturnCallback(function (IEvent $event) use ($expected): void { - $this->assertLessThanOrEqual(time() + 2, $event->getTimestamp(), 'Timestamp not set correctly'); - $this->assertGreaterThanOrEqual(time() - 2, $event->getTimestamp(), 'Timestamp not set correctly'); + ->willReturnCallback(function (IEvent $event) use ($expected, $time): void { + $this->assertEquals($time, $event->getTimestamp(), 'Timestamp not set correctly'); $this->assertSame($expected, $event->getAuthor(), 'Author name not set correctly'); }); $this->activityManager->registerConsumer(function () use ($consumer) { diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index 03405bf96ca..0ae917a1d9f 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -9,6 +9,8 @@ namespace Test; use InvalidArgumentException; use OC\AppConfig; +use OC\Config\ConfigManager; +use OC\Config\PresetManager; use OCP\Exceptions\AppConfigTypeConflictException; use OCP\Exceptions\AppConfigUnknownKeyException; use OCP\IAppConfig; @@ -29,6 +31,8 @@ class AppConfigTest extends TestCase { protected IAppConfig $appConfig; protected IDBConnection $connection; private IConfig $config; + private ConfigManager $configManager; + private PresetManager $presetManager; private LoggerInterface $logger; private ICrypto $crypto; @@ -99,6 +103,8 @@ class AppConfigTest extends TestCase { $this->connection = Server::get(IDBConnection::class); $this->config = Server::get(IConfig::class); + $this->configManager = Server::get(ConfigManager::class); + $this->presetManager = Server::get(PresetManager::class); $this->logger = Server::get(LoggerInterface::class); $this->crypto = Server::get(ICrypto::class); @@ -190,6 +196,8 @@ class AppConfigTest extends TestCase { $config = new AppConfig( $this->connection, $this->config, + $this->configManager, + $this->presetManager, $this->logger, $this->crypto, ); diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php index 23d3b9d1c2a..495d7099d59 100644 --- a/tests/lib/Avatar/AvatarManagerTest.php +++ b/tests/lib/Avatar/AvatarManagerTest.php @@ -269,7 +269,7 @@ class AvatarManagerTest extends \Test\TestCase { } if ($expectedPlaceholder) { - $expected = new PlaceholderAvatar($folder, $user, $this->createMock(LoggerInterface::class)); + $expected = new PlaceholderAvatar($folder, $user, $this->config, $this->logger); } else { $expected = new UserAvatar($folder, $this->l10n, $user, $this->logger, $this->config); } diff --git a/tests/lib/Avatar/GuestAvatarTest.php b/tests/lib/Avatar/GuestAvatarTest.php index 8188684b51f..b49fcea6ed2 100644 --- a/tests/lib/Avatar/GuestAvatarTest.php +++ b/tests/lib/Avatar/GuestAvatarTest.php @@ -34,8 +34,9 @@ class GuestAvatarTest extends TestCase { */ public function setupGuestAvatar() { /* @var MockObject|LoggerInterface $logger */ - $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); - $this->guestAvatar = new GuestAvatar('einstein', $logger); + $logger = $this->createMock(LoggerInterface::class); + $config = $this->createMock(\OCP\IConfig::class); + $this->guestAvatar = new GuestAvatar('einstein', $config, $logger); } /** diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 03a868c7854..1ca3b8135cc 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -18,20 +18,15 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\IConfig; use OCP\IL10N; use OCP\Image; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class UserAvatarTest extends \Test\TestCase { - /** @var SimpleFolder | \PHPUnit\Framework\MockObject\MockObject */ - private $folder; - /** @var \OC\Avatar\UserAvatar */ - private $avatar; - - /** @var User|\PHPUnit\Framework\MockObject\MockObject $user */ - private $user; - - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - private $config; + private UserAvatar $avatar; + private SimpleFolder&MockObject $folder; + private IConfig&MockObject $config; + private User&MockObject $user; protected function setUp(): void { parent::setUp(); @@ -236,7 +231,7 @@ class UserAvatarTest extends \Test\TestCase { } public function testGenerateSvgAvatar(): void { - $avatar = $this->invokePrivate($this->avatar, 'getAvatarVector', [64, false]); + $avatar = $this->invokePrivate($this->avatar, 'getAvatarVector', [$this->user->getDisplayName(), 64, false]); $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="64" height="64" version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> @@ -246,7 +241,6 @@ class UserAvatarTest extends \Test\TestCase { $this->assertEquals($avatar, $svg); } - #[\PHPUnit\Framework\Attributes\DataProvider('avatarTextData')] public function testGetAvatarText($displayName, $expectedAvatarText): void { $user = $this->getUserWithDisplayName($displayName); diff --git a/tests/lib/Config/LexiconTest.php b/tests/lib/Config/LexiconTest.php index def9e152853..d7e9b12a1cf 100644 --- a/tests/lib/Config/LexiconTest.php +++ b/tests/lib/Config/LexiconTest.php @@ -10,6 +10,7 @@ namespace Tests\lib\Config; use OC\AppConfig; use OC\AppFramework\Bootstrap\Coordinator; use OC\Config\ConfigManager; +use OC\Config\PresetManager; use OCP\Config\Exceptions\TypeConflictException; use OCP\Config\Exceptions\UnknownKeyException; use OCP\Config\IUserConfig; @@ -32,6 +33,7 @@ class LexiconTest extends TestCase { private IAppConfig $appConfig; private IUserConfig $userConfig; private ConfigManager $configManager; + private PresetManager $presetManager; protected function setUp(): void { parent::setUp(); @@ -45,6 +47,7 @@ class LexiconTest extends TestCase { $this->appConfig = Server::get(IAppConfig::class); $this->userConfig = Server::get(IUserConfig::class); $this->configManager = Server::get(ConfigManager::class); + $this->presetManager = Server::get(PresetManager::class); } protected function tearDown(): void { @@ -206,26 +209,26 @@ class LexiconTest extends TestCase { } public function testAppConfigLexiconPreset() { - $this->configManager->setLexiconPreset(Preset::FAMILY); + $this->presetManager->setLexiconPreset(Preset::FAMILY); $this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); } public function testAppConfigLexiconPresets() { - $this->configManager->setLexiconPreset(Preset::MEDIUM); + $this->presetManager->setLexiconPreset(Preset::MEDIUM); $this->assertSame('club+medium', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); - $this->configManager->setLexiconPreset(Preset::FAMILY); + $this->presetManager->setLexiconPreset(Preset::FAMILY); $this->assertSame('family', $this->appConfig->getValueString(TestLexicon_E::APPID, 'key3')); } public function testUserConfigLexiconPreset() { - $this->configManager->setLexiconPreset(Preset::FAMILY); + $this->presetManager->setLexiconPreset(Preset::FAMILY); $this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); } public function testUserConfigLexiconPresets() { - $this->configManager->setLexiconPreset(Preset::MEDIUM); + $this->presetManager->setLexiconPreset(Preset::MEDIUM); $this->assertSame('club+medium', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); - $this->configManager->setLexiconPreset(Preset::FAMILY); + $this->presetManager->setLexiconPreset(Preset::FAMILY); $this->assertSame('family', $this->userConfig->getValueString('user1', TestLexicon_E::APPID, 'key3')); } } diff --git a/tests/lib/Config/UserConfigTest.php b/tests/lib/Config/UserConfigTest.php index 5666a441b93..9dd5ab10084 100644 --- a/tests/lib/Config/UserConfigTest.php +++ b/tests/lib/Config/UserConfigTest.php @@ -7,6 +7,8 @@ declare(strict_types=1); */ namespace Test\lib\Config; +use OC\Config\ConfigManager; +use OC\Config\PresetManager; use OC\Config\UserConfig; use OCP\Config\Exceptions\TypeConflictException; use OCP\Config\Exceptions\UnknownKeyException; @@ -29,6 +31,8 @@ use Test\TestCase; class UserConfigTest extends TestCase { protected IDBConnection $connection; private IConfig $config; + private ConfigManager $configManager; + private PresetManager $presetManager; private LoggerInterface $logger; private ICrypto $crypto; private array $originalPreferences; @@ -173,6 +177,8 @@ class UserConfigTest extends TestCase { $this->connection = Server::get(IDBConnection::class); $this->config = Server::get(IConfig::class); + $this->configManager = Server::get(ConfigManager::class); + $this->presetManager = Server::get(PresetManager::class); $this->logger = Server::get(LoggerInterface::class); $this->crypto = Server::get(ICrypto::class); @@ -282,6 +288,8 @@ class UserConfigTest extends TestCase { $userConfig = new UserConfig( $this->connection, $this->config, + $this->configManager, + $this->presetManager, $this->logger, $this->crypto, ); diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index fc20af8a841..5a111c91aa7 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -367,6 +367,7 @@ class FunctionBuilderTest extends TestCase { $result = $query->execute(); $column = $result->fetchOne(); $result->closeCursor(); + $this->assertNotNull($column); $this->assertEquals($bytes, $column); } diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php index dd696279b86..ae0a53f2cc0 100644 --- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php +++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php @@ -84,7 +84,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase { $this->config->method('getUserValue') ->willReturn(null); - $this->config->expects($this->once()) + $this->config ->method('setUserValue') ->with( $this->equalTo('uid'), diff --git a/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php b/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php new file mode 100644 index 00000000000..b60b7ca4f83 --- /dev/null +++ b/tests/lib/Files/ObjectStore/PrimaryObjectStoreConfigTest.php @@ -0,0 +1,285 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2025 Robin Appelman <robin@icewind.nl> + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace lib\Files\ObjectStore; + +use OC\Files\ObjectStore\PrimaryObjectStoreConfig; +use OC\Files\ObjectStore\StorageObjectStore; +use OCP\App\IAppManager; +use OCP\IConfig; +use OCP\IUser; +use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; + +class PrimaryObjectStoreConfigTest extends TestCase { + private array $systemConfig = []; + private array $userConfig = []; + private IConfig&MockObject $config; + private IAppManager&MockObject $appManager; + private PrimaryObjectStoreConfig $objectStoreConfig; + + protected function setUp(): void { + parent::setUp(); + + $this->systemConfig = []; + $this->config = $this->createMock(IConfig::class); + $this->appManager = $this->createMock(IAppManager::class); + $this->config->method('getSystemValue') + ->willReturnCallback(function ($key, $default = '') { + if (isset($this->systemConfig[$key])) { + return $this->systemConfig[$key]; + } else { + return $default; + } + }); + $this->config->method('getUserValue') + ->willReturnCallback(function ($userId, $appName, $key, $default = '') { + if (isset($this->userConfig[$userId][$appName][$key])) { + return $this->userConfig[$userId][$appName][$key]; + } else { + return $default; + } + }); + $this->config->method('setUserValue') + ->willReturnCallback(function ($userId, $appName, $key, $value) { + $this->userConfig[$userId][$appName][$key] = $value; + }); + + $this->objectStoreConfig = new PrimaryObjectStoreConfig($this->config, $this->appManager); + } + + private function getUser(string $uid): IUser { + $user = $this->createMock(IUser::class); + $user->method('getUID') + ->willReturn($uid); + return $user; + } + + private function setConfig(string $key, $value) { + $this->systemConfig[$key] = $value; + } + + public function testNewUserGetsDefault() { + $this->setConfig('objectstore', [ + 'default' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test')); + $this->assertEquals('server1', $result['arguments']['host']); + + $this->assertEquals('server1', $this->config->getUserValue('test', 'homeobjectstore', 'objectstore', null)); + } + + public function testExistingUserKeepsStorage() { + // setup user with `server1` as storage + $this->testNewUserGetsDefault(); + + $this->setConfig('objectstore', [ + 'default' => 'server2', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ], + 'server2' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server2', + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test')); + $this->assertEquals('server1', $result['arguments']['host']); + + $this->assertEquals('server1', $this->config->getUserValue('test', 'homeobjectstore', 'objectstore', null)); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('other-user')); + $this->assertEquals('server2', $result['arguments']['host']); + } + + public function testNestedAliases() { + $this->setConfig('objectstore', [ + 'default' => 'a1', + 'a1' => 'a2', + 'a2' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ], + ]); + $this->assertEquals('server1', $this->objectStoreConfig->resolveAlias('default')); + } + + public function testMultibucketChangedConfig() { + $this->setConfig('objectstore', [ + 'default' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => true, + 'num_buckets' => 8, + 'bucket' => 'bucket-' + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test')); + $this->assertEquals('server1', $result['arguments']['host']); + $this->assertEquals('bucket-7', $result['arguments']['bucket']); + + $this->setConfig('objectstore', [ + 'default' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => true, + 'num_buckets' => 64, + 'bucket' => 'bucket-' + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test')); + $this->assertEquals('server1', $result['arguments']['host']); + $this->assertEquals('bucket-7', $result['arguments']['bucket']); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test-foo')); + $this->assertEquals('server1', $result['arguments']['host']); + $this->assertEquals('bucket-40', $result['arguments']['bucket']); + + $this->setConfig('objectstore', [ + 'default' => 'server2', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => true, + 'num_buckets' => 64, + 'bucket' => 'bucket-' + ], + ], + 'server2' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server2', + 'multibucket' => true, + 'num_buckets' => 16, + 'bucket' => 'bucket-' + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test')); + $this->assertEquals('server1', $result['arguments']['host']); + $this->assertEquals('bucket-7', $result['arguments']['bucket']); + + $result = $this->objectStoreConfig->getObjectStoreConfigForUser($this->getUser('test-bar')); + $this->assertEquals('server2', $result['arguments']['host']); + $this->assertEquals('bucket-4', $result['arguments']['bucket']); + } + + public function testMultibucketOldConfig() { + $this->setConfig('objectstore_multibucket', [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => true, + 'num_buckets' => 8, + 'bucket' => 'bucket-' + ], + ]); + $configs = $this->objectStoreConfig->getObjectStoreConfigs(); + $this->assertEquals([ + 'default' => 'server1', + 'root' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => true, + 'num_buckets' => 8, + 'bucket' => 'bucket-' + ], + ], + ], $configs); + } + + public function testSingleObjectStore() { + $this->setConfig('objectstore', [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ]); + $configs = $this->objectStoreConfig->getObjectStoreConfigs(); + $this->assertEquals([ + 'default' => 'server1', + 'root' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + 'multibucket' => false, + ], + ], + ], $configs); + } + + public function testRoot() { + $this->setConfig('objectstore', [ + 'default' => 'server1', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ], + 'server2' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server2', + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForRoot(); + $this->assertEquals('server1', $result['arguments']['host']); + + $this->setConfig('objectstore', [ + 'default' => 'server1', + 'root' => 'server2', + 'server1' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server1', + ], + ], + 'server2' => [ + 'class' => StorageObjectStore::class, + 'arguments' => [ + 'host' => 'server2', + ], + ], + ]); + + $result = $this->objectStoreConfig->getObjectStoreConfigForRoot(); + $this->assertEquals('server2', $result['arguments']['host']); + } +} diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index c490cd08dae..ad27c3f798c 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -23,6 +23,7 @@ use OCP\Cache\CappedMemoryCache; use OCP\Constants; use OCP\Files\Config\IMountProvider; use OCP\Files\Config\IMountProviderCollection; +use OCP\Files\Config\IUserMountCache; use OCP\Files\FileInfo; use OCP\Files\ForbiddenException; use OCP\Files\GenericFileException; @@ -258,28 +259,36 @@ class ViewTest extends \Test\TestCase { * @medium */ public function testGetPath(): void { + $user = $this->createMock(IUser::class); + $user->method('getUID') + ->willReturn('test'); $storage1 = $this->getTestStorage(); $storage2 = $this->getTestStorage(); $storage3 = $this->getTestStorage(); - Filesystem::mount($storage1, [], '/'); - Filesystem::mount($storage2, [], '/substorage'); - Filesystem::mount($storage3, [], '/folder/anotherstorage'); + Filesystem::mount($storage1, [], '/test/files'); + Filesystem::mount($storage2, [], '/test/files/substorage'); + Filesystem::mount($storage3, [], '/test/files/folder/anotherstorage'); - $rootView = new View(''); + $userMountCache = Server::get(IUserMountCache::class); + $userMountCache->registerMounts($user, [ + new MountPoint($storage1, '/test/files'), + new MountPoint($storage2, '/test/files/substorage'), + new MountPoint($storage3, '/test/files/folder/anotherstorage'), + ]); + + $rootView = new View('/test/files'); $cachedData = $rootView->getFileInfo('/foo.txt'); - /** @var int $id1 */ - $id1 = $cachedData['fileid']; + $id1 = $cachedData->getId(); $this->assertEquals('/foo.txt', $rootView->getPath($id1)); $cachedData = $rootView->getFileInfo('/substorage/foo.txt'); - /** @var int $id2 */ - $id2 = $cachedData['fileid']; + $id2 = $cachedData->getId(); $this->assertEquals('/substorage/foo.txt', $rootView->getPath($id2)); - $folderView = new View('/substorage'); + $folderView = new View('/test/files/substorage'); $this->assertEquals('/foo.txt', $folderView->getPath($id2)); } diff --git a/tests/lib/Search/SearchComposerTest.php b/tests/lib/Search/SearchComposerTest.php new file mode 100644 index 00000000000..f8cf1410fad --- /dev/null +++ b/tests/lib/Search/SearchComposerTest.php @@ -0,0 +1,290 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace Test\Search; + +use InvalidArgumentException; +use OC\AppFramework\Bootstrap\Coordinator; +use OC\AppFramework\Bootstrap\RegistrationContext; +use OC\AppFramework\Bootstrap\ServiceRegistration; +use OC\Search\SearchComposer; +use OCP\IAppConfig; +use OCP\IURLGenerator; +use OCP\IUser; +use OCP\Search\IInAppSearch; +use OCP\Search\IProvider; +use OCP\Search\ISearchQuery; +use PHPUnit\Framework\MockObject\MockObject; +use Psr\Container\ContainerInterface; +use Psr\Log\LoggerInterface; +use Test\TestCase; + +class SearchComposerTest extends TestCase { + private Coordinator&MockObject $bootstrapCoordinator; + private ContainerInterface&MockObject $container; + private IURLGenerator&MockObject $urlGenerator; + private LoggerInterface&MockObject $logger; + private IAppConfig&MockObject $appConfig; + private SearchComposer $searchComposer; + + protected function setUp(): void { + parent::setUp(); + + $this->bootstrapCoordinator = $this->createMock(Coordinator::class); + $this->container = $this->createMock(ContainerInterface::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->logger = $this->createMock(LoggerInterface::class); + $this->appConfig = $this->createMock(IAppConfig::class); + + $this->searchComposer = new SearchComposer( + $this->bootstrapCoordinator, + $this->container, + $this->urlGenerator, + $this->logger, + $this->appConfig + ); + + $this->setupUrlGenerator(); + } + + private function setupUrlGenerator(): void { + $this->urlGenerator->method('imagePath') + ->willReturnCallback(function ($appId, $imageName) { + return "/apps/$appId/img/$imageName"; + }); + } + + private function setupEmptyRegistrationContext(): void { + $this->bootstrapCoordinator->expects($this->once()) + ->method('getRegistrationContext') + ->willReturn(null); + } + + private function setupAppConfigForAllowedProviders(array $allowedProviders = []): void { + $this->appConfig->method('getValueArray') + ->with('core', 'unified_search.providers_allowed') + ->willReturn($allowedProviders); + } + + /** + * @param array<string, array{service: string, appId: string, order: int, isInApp?: bool}> $providerConfigs + * @return array{registrations: ServiceRegistration[], providers: IProvider[]} + */ + private function createMockProvidersAndRegistrations(array $providerConfigs): array { + $registrations = []; + $providers = []; + $containerMap = []; + + foreach ($providerConfigs as $providerId => $config) { + // Create registration mock + $registration = $this->createMock(ServiceRegistration::class); + $registration->method('getService')->willReturn($config['service']); + $registration->method('getAppId')->willReturn($config['appId']); + $registrations[] = $registration; + + // Create provider mock + $providerClass = $config['isInApp'] ?? false ? IInAppSearch::class : IProvider::class; + $provider = $this->createMock($providerClass); + $provider->method('getId')->willReturn($providerId); + $provider->method('getName')->willReturn("Provider $providerId"); + $provider->method('getOrder')->willReturn($config['order']); + + $providers[$providerId] = $provider; + $containerMap[] = [$config['service'], $provider]; + } + + $this->container->expects($this->exactly(count($providerConfigs))) + ->method('get') + ->willReturnMap($containerMap); + + return ['registrations' => $registrations, 'providers' => $providers]; + } + + private function setupRegistrationContextWithProviders(array $registrations): void { + $registrationContext = $this->createMock(RegistrationContext::class); + $registrationContext->method('getSearchProviders')->willReturn($registrations); + + $this->bootstrapCoordinator->expects($this->once()) + ->method('getRegistrationContext') + ->willReturn($registrationContext); + } + + public function testGetProvidersWithNoRegisteredProviders(): void { + $this->setupEmptyRegistrationContext(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertIsArray($providers); + $this->assertEmpty($providers); + } + + public function testSearchWithUnknownProvider(): void { + $this->setupEmptyRegistrationContext(); + + $user = $this->createMock(IUser::class); + $query = $this->createMock(ISearchQuery::class); + + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Provider unknown_provider is unknown'); + + $this->searchComposer->search($user, 'unknown_provider', $query); + } + + public function testGetProvidersWithMultipleProviders(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 10], + 'provider2' => ['service' => 'provider2_service', 'appId' => 'app2', 'order' => 5], + 'provider3' => ['service' => 'provider3_service', 'appId' => 'app3', 'order' => 15, 'isInApp' => true], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertProvidersStructureAndSorting($providers, [ + ['id' => 'provider2', 'name' => 'Provider provider2', 'appId' => 'app2', 'order' => 5, 'inAppSearch' => false], + ['id' => 'provider1', 'name' => 'Provider provider1', 'appId' => 'app1', 'order' => 10, 'inAppSearch' => false], + ['id' => 'provider3', 'name' => 'Provider provider3', 'appId' => 'app3', 'order' => 15, 'inAppSearch' => true], + ]); + } + + public function testGetProvidersWithEmptyAllowedProvidersConfiguration(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 10], + 'provider2' => ['service' => 'provider2_service', 'appId' => 'app2', 'order' => 5], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertCount(2, $providers); + $this->assertProvidersAreSortedByOrder($providers); + $this->assertEquals('provider2', $providers[0]['id']); + $this->assertEquals('provider1', $providers[1]['id']); + } + + public function testGetProvidersWithAllowedProvidersRestriction(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 10], + 'provider2' => ['service' => 'provider2_service', 'appId' => 'app2', 'order' => 5], + 'provider3' => ['service' => 'provider3_service', 'appId' => 'app3', 'order' => 15], + 'provider4' => ['service' => 'provider4_service', 'appId' => 'app4', 'order' => 8], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(['provider1', 'provider3']); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertProvidersStructureAndSorting($providers, [ + ['id' => 'provider1', 'name' => 'Provider provider1', 'appId' => 'app1', 'order' => 10, 'inAppSearch' => false], + ['id' => 'provider3', 'name' => 'Provider provider3', 'appId' => 'app3', 'order' => 15, 'inAppSearch' => false], + ]); + + // Verify excluded providers are not present + $providerIds = array_column($providers, 'id'); + $this->assertNotContains('provider2', $providerIds); + $this->assertNotContains('provider4', $providerIds); + } + + public function testGetProvidersFiltersByAllowedProvidersCompletely(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 10], + 'provider2' => ['service' => 'provider2_service', 'appId' => 'app2', 'order' => 5], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(['provider_not_exists']); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertIsArray($providers); + $this->assertEmpty($providers); + } + + public function testGetProvidersWithMixedOrderValues(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 100], + 'provider2' => ['service' => 'provider2_service', 'appId' => 'app2', 'order' => 1], + 'provider3' => ['service' => 'provider3_service', 'appId' => 'app3', 'order' => 50], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertCount(3, $providers); + $this->assertProvidersAreSortedByOrder($providers); + + // Verify correct ordering: provider2 (1), provider3 (50), provider1 (100) + $this->assertEquals('provider2', $providers[0]['id']); + $this->assertEquals('provider3', $providers[1]['id']); + $this->assertEquals('provider1', $providers[2]['id']); + } + + public function testProviderIconGeneration(): void { + $providerConfigs = [ + 'provider1' => ['service' => 'provider1_service', 'appId' => 'app1', 'order' => 10], + ]; + + $mockData = $this->createMockProvidersAndRegistrations($providerConfigs); + $this->setupRegistrationContextWithProviders($mockData['registrations']); + $this->setupAppConfigForAllowedProviders(); + + $providers = $this->searchComposer->getProviders('/test/route', []); + + $this->assertCount(1, $providers); + $this->assertArrayHasKey('icon', $providers[0]); + $this->assertStringContainsString('/apps/provider1/img/provider1.svg', $providers[0]['icon']); + } + + /** + * Assert providers array structure and expected sorting + */ + private function assertProvidersStructureAndSorting(array $actualProviders, array $expectedProviders): void { + $this->assertIsArray($actualProviders); + $this->assertCount(count($expectedProviders), $actualProviders); + + foreach ($actualProviders as $index => $provider) { + $this->assertProviderHasRequiredFields($provider); + + $expected = $expectedProviders[$index]; + $this->assertEquals($expected['id'], $provider['id']); + $this->assertEquals($expected['name'], $provider['name']); + $this->assertEquals($expected['appId'], $provider['appId']); + $this->assertEquals($expected['order'], $provider['order']); + $this->assertEquals($expected['inAppSearch'], $provider['inAppSearch']); + } + + $this->assertProvidersAreSortedByOrder($actualProviders); + } + + private function assertProviderHasRequiredFields(array $provider): void { + $requiredFields = ['id', 'appId', 'name', 'icon', 'order', 'triggers', 'filters', 'inAppSearch']; + foreach ($requiredFields as $field) { + $this->assertArrayHasKey($field, $provider, "Provider must have '$field' field"); + } + } + + private function assertProvidersAreSortedByOrder(array $providers): void { + $orders = array_column($providers, 'order'); + $sortedOrders = $orders; + sort($sortedOrders); + $this->assertEquals($sortedOrders, $orders, 'Providers should be sorted by order'); + } +} diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php index 445158e8a23..921d72388a1 100644 --- a/tests/lib/Security/IdentityProof/ManagerTest.php +++ b/tests/lib/Security/IdentityProof/ManagerTest.php @@ -16,6 +16,8 @@ use OC\Security\IdentityProof\Manager; use OCP\Files\IAppData; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\ICache; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IUser; use OCP\Security\ICrypto; @@ -24,18 +26,14 @@ use Psr\Log\LoggerInterface; use Test\TestCase; class ManagerTest extends TestCase { - /** @var Factory|MockObject */ - private $factory; - /** @var IAppData|MockObject */ - private $appData; - /** @var ICrypto|MockObject */ - private $crypto; - /** @var Manager|MockObject */ - private $manager; - /** @var IConfig|MockObject */ - private $config; - /** @var LoggerInterface|MockObject */ - private $logger; + private Factory&MockObject $factory; + private IAppData&MockObject $appData; + private ICrypto&MockObject $crypto; + private Manager&MockObject $manager; + private IConfig&MockObject $config; + private LoggerInterface&MockObject $logger; + private ICacheFactory&MockObject $cacheFactory; + private ICache&MockObject $cache; protected function setUp(): void { parent::setUp(); @@ -49,6 +47,12 @@ class ManagerTest extends TestCase { ->with('identityproof') ->willReturn($this->appData); $this->logger = $this->createMock(LoggerInterface::class); + $this->cacheFactory = $this->createMock(ICacheFactory::class); + $this->cache = $this->createMock(ICache::class); + + $this->cacheFactory->expects($this->any()) + ->method('createDistributed') + ->willReturn($this->cache); $this->crypto = $this->createMock(ICrypto::class); $this->manager = $this->getManager(['generateKeyPair']); @@ -66,7 +70,8 @@ class ManagerTest extends TestCase { $this->factory, $this->crypto, $this->config, - $this->logger + $this->logger, + $this->cacheFactory, ); } else { return $this->getMockBuilder(Manager::class) @@ -74,7 +79,8 @@ class ManagerTest extends TestCase { $this->factory, $this->crypto, $this->config, - $this->logger + $this->logger, + $this->cacheFactory, ]) ->onlyMethods($setMethods) ->getMock(); @@ -115,6 +121,33 @@ class ManagerTest extends TestCase { ->method('getFolder') ->with('user-MyUid') ->willReturn($folder); + $this->cache + ->expects($this->exactly(2)) + ->method('get') + ->willReturn(null); + + $expected = new Key('MyPublicKey', 'MyPrivateKey'); + $this->assertEquals($expected, $this->manager->getKey($user)); + } + + public function testGetKeyWithExistingKeyCached(): void { + $user = $this->createMock(IUser::class); + $user + ->expects($this->once()) + ->method('getUID') + ->willReturn('MyUid'); + $this->crypto + ->expects($this->once()) + ->method('decrypt') + ->with('EncryptedPrivateKey') + ->willReturn('MyPrivateKey'); + $this->cache + ->expects($this->exactly(2)) + ->method('get') + ->willReturnMap([ + ['user-MyUid-public', 'MyPublicKey'], + ['user-MyUid-private', 'EncryptedPrivateKey'], + ]); $expected = new Key('MyPublicKey', 'MyPrivateKey'); $this->assertEquals($expected, $this->manager->getKey($user)); diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 7859407651f..0e37934786a 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -722,7 +722,10 @@ class ManagerTest extends \Test\TestCase { $this->config->method('getAppValue')->willReturnMap([ ['core', 'shareapi_enforce_links_password_excluded_groups', '', ''], - ['core', 'shareapi_enforce_links_password', 'no', 'yes'], + ]); + + $this->appConfig->method('getValueBool')->willReturnMap([ + ['core', 'shareapi_enforce_links_password', true], ]); self::invokePrivate($this->manager, 'verifyPassword', [null]); diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php index db474a00687..d2f619da349 100644 --- a/tests/lib/TaskProcessing/TaskProcessingTest.php +++ b/tests/lib/TaskProcessing/TaskProcessingTest.php @@ -24,6 +24,7 @@ use OCP\Files\Config\IUserMountCache; use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; @@ -535,6 +536,7 @@ class TaskProcessingTest extends \Test\TestCase { private IUserMountCache $userMountCache; private IRootFolder $rootFolder; private IConfig $config; + private IAppConfig $appConfig; public const TEST_USER = 'testuser'; @@ -600,8 +602,9 @@ class TaskProcessingTest extends \Test\TestCase { $this->userMountCache = $this->createMock(IUserMountCache::class); $this->config = Server::get(IConfig::class); + $this->appConfig = Server::get(IAppConfig::class); $this->manager = new Manager( - $this->config, + $this->appConfig, $this->coordinator, $this->serverContainer, Server::get(LoggerInterface::class), @@ -641,7 +644,7 @@ class TaskProcessingTest extends \Test\TestCase { $taskProcessingTypeSettings = [ TextToText::ID => false, ]; - $this->config->setAppValue('core', 'ai.taskprocessing_type_preferences', json_encode($taskProcessingTypeSettings)); + $this->appConfig->setValueString('core', 'ai.taskprocessing_type_preferences', json_encode($taskProcessingTypeSettings), lazy: true); self::assertCount(0, $this->manager->getAvailableTaskTypes()); self::assertCount(1, $this->manager->getAvailableTaskTypes(true)); self::assertTrue($this->manager->hasProviders()); @@ -651,7 +654,7 @@ class TaskProcessingTest extends \Test\TestCase { public function testProviderShouldBeRegisteredAndTaskFailValidation(): void { - $this->config->setAppValue('core', 'ai.taskprocessing_type_preferences', ''); + $this->appConfig->setValueString('core', 'ai.taskprocessing_type_preferences', '', lazy: true); $this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([ new ServiceRegistration('test', BrokenSyncProvider::class) ]); @@ -797,7 +800,7 @@ class TaskProcessingTest extends \Test\TestCase { $taskProcessingTypeSettings = [ TextToText::ID => true, ]; - $this->config->setAppValue('core', 'ai.taskprocessing_type_preferences', json_encode($taskProcessingTypeSettings)); + $this->appConfig->setValueString('core', 'ai.taskprocessing_type_preferences', json_encode($taskProcessingTypeSettings), lazy: true); self::assertCount(1, $this->manager->getAvailableTaskTypes()); @@ -969,6 +972,7 @@ class TaskProcessingTest extends \Test\TestCase { // run background job $bgJob = new RemoveOldTasksBackgroundJob( $timeFactory, + $this->manager, $this->taskMapper, Server::get(LoggerInterface::class), Server::get(IAppDataFactory::class), @@ -1239,7 +1243,7 @@ class TaskProcessingTest extends \Test\TestCase { private function createManagerInstance(): Manager { // Clear potentially cached config values if needed - $this->config->deleteAppValue('core', 'ai.taskprocessing_type_preferences'); + $this->appConfig->deleteKey('core', 'ai.taskprocessing_type_preferences'); // Re-create Text2ImageManager if its state matters or mocks change $text2imageManager = new \OC\TextToImage\Manager( @@ -1253,7 +1257,7 @@ class TaskProcessingTest extends \Test\TestCase { ); return new Manager( - $this->config, + $this->appConfig, $this->coordinator, $this->serverContainer, Server::get(LoggerInterface::class), diff --git a/tests/lib/TemplateLayoutTest.php b/tests/lib/TemplateLayoutTest.php index c1cafcd6b93..ce5d2f6dd0b 100644 --- a/tests/lib/TemplateLayoutTest.php +++ b/tests/lib/TemplateLayoutTest.php @@ -13,6 +13,7 @@ use OC\InitialStateService; use OC\TemplateLayout; use OCP\App\IAppManager; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IAppConfig; use OCP\IConfig; use OCP\INavigationManager; use OCP\ServerVersion; @@ -21,6 +22,7 @@ use PHPUnit\Framework\MockObject\MockObject; class TemplateLayoutTest extends \Test\TestCase { private IConfig&MockObject $config; + private IAppConfig&MockObject $appConfig; private IAppManager&MockObject $appManager; private InitialStateService&MockObject $initialState; private INavigationManager&MockObject $navigationManager; @@ -33,6 +35,7 @@ class TemplateLayoutTest extends \Test\TestCase { parent::setUp(); $this->config = $this->createMock(IConfig::class); + $this->appConfig = $this->createMock(IAppConfig::class); $this->appManager = $this->createMock(IAppManager::class); $this->initialState = $this->createMock(InitialStateService::class); $this->navigationManager = $this->createMock(INavigationManager::class); @@ -68,6 +71,7 @@ class TemplateLayoutTest extends \Test\TestCase { ->onlyMethods(['getAppNamefromPath']) ->setConstructorArgs([ $this->config, + $this->appConfig, $this->appManager, $this->initialState, $this->navigationManager, |