aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Accounts/AccountManagerTest.php7
-rw-r--r--tests/lib/Accounts/AccountTest.php1
-rw-r--r--tests/lib/AppConfigTest.php8
-rw-r--r--tests/lib/Avatar/AvatarManagerTest.php2
-rw-r--r--tests/lib/Avatar/GuestAvatarTest.php5
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php18
-rw-r--r--tests/lib/Config/LexiconTest.php15
-rw-r--r--tests/lib/Config/UserConfigTest.php8
8 files changed, 43 insertions, 21 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/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,
);