UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled

Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz
С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06).
Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
This commit is contained in:
2026-07-06 14:07:50 +00:00
commit 01acfa3b40
1716 changed files with 613013 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Talk\Tests\php\Service;
use OCA\Talk\Room;
use OCA\Talk\Service\AvatarService;
use OCA\Talk\Service\EmojiService;
use OCA\Talk\Service\RoomService;
use OCP\Files\IAppData;
use OCP\IAvatarManager;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Security\ISecureRandom;
use OCP\Server;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
#[Group('DB')]
class AvatarServiceTest extends TestCase {
protected IAppData&MockObject $appData;
protected IL10N&MockObject $l;
protected IURLGenerator&MockObject $url;
protected ISecureRandom&MockObject $random;
protected RoomService&MockObject $roomService;
protected IAvatarManager&MockObject $avatarManager;
protected EmojiService $emojiService;
protected ?AvatarService $service = null;
public function setUp(): void {
parent::setUp();
$this->appData = $this->createMock(IAppData::class);
$this->l = $this->createMock(IL10N::class);
$this->url = $this->createMock(IURLGenerator::class);
$this->random = $this->createMock(ISecureRandom::class);
$this->roomService = $this->createMock(RoomService::class);
$this->avatarManager = $this->createMock(IAvatarManager::class);
$this->emojiService = Server::get(EmojiService::class);
$this->service = new AvatarService(
$this->appData,
$this->l,
$this->url,
$this->random,
$this->roomService,
$this->avatarManager,
$this->emojiService,
);
}
public static function dataGetAvatarVersion(): array {
return [
['', 'STRING WITH 8 CHARS'],
['1', '1'],
['1.png', '1'],
];
}
#[DataProvider('dataGetAvatarVersion')]
public function testGetAvatarVersion(string $avatar, string $expected): void {
/** @var Room&MockObject $room */
$room = $this->createMock(Room::class);
$room->method('getAvatar')
->willReturn($avatar);
$actual = $this->service->getAvatarVersion($room);
if ($expected === 'STRING WITH 8 CHARS') {
$this->assertEquals(8, strlen($actual));
} else {
$this->assertEquals($expected, $actual);
}
}
}