Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/php/BackgroundJob/CheckHostedSignalingServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public function testRunWithNoChange(): void {

$this->config
->method('getAppValue')
->will($this->returnValueMap([
->willReturnMap([
['spreed', 'hosted-signaling-server-account-id', '', 'my-account-id'],
['spreed', 'hosted-signaling-server-account', '{}', '{"status": "pending"}']
]));
]);

$this->hostedSignalingServerService->expects($this->once())
->method('fetchAccountInfo')
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Chat/AutoComplete/SearchPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ public static function dataSearchUsers(): array {
}

/**
* @dataProvider dataSearchUsers
* @param array<string, string> $users
*/
#[DataProvider('dataSearchUsers')]
public function testSearchUsers(string $search, array $users, array $expected, array $expectedExact): void {
$result = $this->createMock(ISearchResult::class);

Expand Down
5 changes: 2 additions & 3 deletions tests/php/Chat/ChatManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@
use OCP\Share\IManager;
use OCP\Share\IShare;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class ChatManagerTest extends TestCase {
protected CommentsManager|ICommentsManager|MockObject $commentsManager;
protected IEventDispatcher&MockObject $dispatcher;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Chat/Parser/SystemMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IShare;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class SystemMessageTest extends TestCase {
protected IAppConfig&MockObject $appConfig;
protected IUserManager&MockObject $userManager;
Expand Down
11 changes: 3 additions & 8 deletions tests/php/Chat/SystemMessage/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@
use OCP\IUser;
use OCP\IUserSession;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class ListenerTest extends TestCase {
public const DUMMY_REFERENCE_ID = 'DUMMY_REFERENCE_ID';

Expand Down Expand Up @@ -212,11 +211,7 @@ public static function dataRoomTypes(): array {
];
}

/**
* @dataProvider dataRoomTypes
*
* @param int $roomType
*/
#[DataProvider('dataRoomTypes')]
public function testAfterUsersAdd(int $roomType, string $objectType, array $participants, array $expectedMessages): void {
$this->mockLoggedInUser('alice_actor');

Expand Down
2 changes: 1 addition & 1 deletion tests/php/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ public static function dataGetWebSocketDomainForSignalingServer(): array {
}

/**
* @dataProvider dataGetWebSocketDomainForSignalingServer
* @param string $url
* @param string $expectedWebSocketDomain
*/
#[DataProvider('dataGetWebSocketDomainForSignalingServer')]
public function testGetWebSocketDomainForSignalingServer($url, $expectedWebSocketDomain): void {
/** @var MockObject|IConfig $config */
$config = $this->createMock(IConfig::class);
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Controller/SignalingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCP\Security\IHasher;
use OCP\Security\ISecureRandom;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
Expand All @@ -60,9 +61,7 @@ protected function getInputStream(): string {
}
}

/**
* @group DB
*/
#[Group('DB')]
class SignalingControllerTest extends TestCase {
protected TalkSession&MockObject $session;
protected \OCA\Talk\Signaling\Manager&MockObject $signalingManager;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Listener/CalDavEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
use OCP\Calendar\Events\CalendarObjectUpdatedEvent;
use OCP\IL10N;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class CalDavEventListenerTest extends TestCase {
private Manager&MockObject $manager;
private RoomService&MockObject $roomService;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Listener/RestrictStartingCallsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
use OCA\Talk\Service\ParticipantService;
use OCP\IConfig;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class RestrictStartingCallsTest extends TestCase {
protected IConfig&MockObject $serverConfig;
protected ParticipantService&MockObject $participantService;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Model/AttendeeMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IDBConnection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class AttendeeMapperTest extends TestCase {
protected ?AttendeeMapper $attendeeMapper = null;

Expand Down
12 changes: 6 additions & 6 deletions tests/php/Notification/NotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ public function testPrepareGroup(int $type, string $uid, string $displayName, st
$l = $this->createMock(IL10N::class);
$l->expects($this->any())
->method('t')
->will($this->returnCallback(function ($text, $parameters = []) {
->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
});

$room = $this->createMock(Room::class);
$room->expects($this->atLeastOnce())
Expand Down Expand Up @@ -311,9 +311,9 @@ public function testPrepareGroupMultipleTimesOnlyGetsTheRoomOnce(int $type, stri
$l = $this->createMock(IL10N::class);
$l->expects($this->any())
->method('t')
->will($this->returnCallback(function ($text, $parameters = []) {
->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
});

$room = $this->createMock(Room::class);
$room->expects($this->atLeastOnce())
Expand Down Expand Up @@ -795,9 +795,9 @@ public function testPrepareChatMessage(string $subject, int $roomType, array $su
$l = $this->createMock(IL10N::class);
$l->expects($this->any())
->method('t')
->will($this->returnCallback(function ($text, $parameters = []) {
->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
}));
});

$this->notificationManager->method('isPreparingPushNotification')
->willReturn($isPushNotification);
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Recording/BackendNotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\IUserManager;
use OCP\Security\IHasher;
use OCP\Security\ISecureRandom;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
Expand All @@ -56,9 +57,7 @@ protected function doRequest(string $url, array $params, int $retries = 3): void
}
}

/**
* @group DB
*/
#[Group('DB')]
class BackendNotifierTest extends TestCase {
protected IURLGenerator&MockObject $urlGenerator;
protected ParticipantService $participantService;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/AvatarServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
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
*/
#[Group('DB')]
class AvatarServiceTest extends TestCase {
protected IAppData&MockObject $appData;
protected IL10N&MockObject $l;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/EmojiServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
use OCP\IEmojiHelper;
use OCP\Server;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class EmojiServiceTest extends TestCase {
protected ?EmojiService $service = null;

Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/ParticipantServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@
use OCP\IUserManager;
use OCP\Security\ISecureRandom;
use OCP\UserStatus\IManager;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class ParticipantServiceTest extends TestCase {
protected IConfig&MockObject $serverConfig;
protected Config&MockObject $talkConfig;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/ProxyCacheMessageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IDBConnection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class ProxyCacheMessageServiceTest extends TestCase {
protected LoggerInterface&MockObject $logger;
protected ITimeFactory&MockObject $timeFactory;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/RoomServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
use OCP\Server;
use OCP\Share\IManager as IShareManager;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class RoomServiceTest extends TestCase {
protected Manager&MockObject $manager;
protected ParticipantService&MockObject $participantService;
Expand Down
5 changes: 2 additions & 3 deletions tests/php/Service/SessionServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IDBConnection;
use OCP\Security\ISecureRandom;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class SessionServiceTest extends TestCase {
protected ?SessionMapper $sessionMapper = null;
protected ISecureRandom&MockObject $secureRandom;
Expand Down
12 changes: 3 additions & 9 deletions tests/php/Signaling/ListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Comments\IComment;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

/**
* @group DB
*/
#[Group('DB')]
class ListenerTest extends TestCase {
protected BackendNotifier&MockObject $backendNotifier;
protected Manager&MockObject $manager;
Expand Down Expand Up @@ -97,12 +96,7 @@ public static function dataRoomModified(): array {
];
}

/**
* @dataProvider dataRoomModified
* @param string $property
* @param mixed $newValue
* @param mixed $oldValue
*/
#[DataProvider('dataRoomModified')]
public function testRoomModified(string $property, mixed $newValue, mixed $oldValue): void {
$room = $this->createMock(Room::class);

Expand Down
Loading