diff --git a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php index a347d820d60..6af6d624b9f 100644 --- a/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php +++ b/tests/php/BackgroundJob/CheckHostedSignalingServerTest.php @@ -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') diff --git a/tests/php/Chat/AutoComplete/SearchPluginTest.php b/tests/php/Chat/AutoComplete/SearchPluginTest.php index 6fff408c290..02100b708b7 100644 --- a/tests/php/Chat/AutoComplete/SearchPluginTest.php +++ b/tests/php/Chat/AutoComplete/SearchPluginTest.php @@ -169,9 +169,9 @@ public static function dataSearchUsers(): array { } /** - * @dataProvider dataSearchUsers * @param array $users */ + #[DataProvider('dataSearchUsers')] public function testSearchUsers(string $search, array $users, array $expected, array $expectedExact): void { $result = $this->createMock(ISearchResult::class); diff --git a/tests/php/Chat/ChatManagerTest.php b/tests/php/Chat/ChatManagerTest.php index 0cdd6006918..2a133e9a78f 100644 --- a/tests/php/Chat/ChatManagerTest.php +++ b/tests/php/Chat/ChatManagerTest.php @@ -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; diff --git a/tests/php/Chat/Parser/SystemMessageTest.php b/tests/php/Chat/Parser/SystemMessageTest.php index b7b53283073..f8c4837849f 100644 --- a/tests/php/Chat/Parser/SystemMessageTest.php +++ b/tests/php/Chat/Parser/SystemMessageTest.php @@ -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; diff --git a/tests/php/Chat/SystemMessage/ListenerTest.php b/tests/php/Chat/SystemMessage/ListenerTest.php index 1378dc3c51d..0f2bfd9df4f 100644 --- a/tests/php/Chat/SystemMessage/ListenerTest.php +++ b/tests/php/Chat/SystemMessage/ListenerTest.php @@ -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'; @@ -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'); diff --git a/tests/php/ConfigTest.php b/tests/php/ConfigTest.php index d72b0e72b66..ae62ce77bb2 100644 --- a/tests/php/ConfigTest.php +++ b/tests/php/ConfigTest.php @@ -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); diff --git a/tests/php/Controller/SignalingControllerTest.php b/tests/php/Controller/SignalingControllerTest.php index 88d3ec90839..536b92d519e 100644 --- a/tests/php/Controller/SignalingControllerTest.php +++ b/tests/php/Controller/SignalingControllerTest.php @@ -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; @@ -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; diff --git a/tests/php/Listener/CalDavEventListenerTest.php b/tests/php/Listener/CalDavEventListenerTest.php index d7ea1164664..989a4bb961b 100644 --- a/tests/php/Listener/CalDavEventListenerTest.php +++ b/tests/php/Listener/CalDavEventListenerTest.php @@ -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; diff --git a/tests/php/Listener/RestrictStartingCallsTest.php b/tests/php/Listener/RestrictStartingCallsTest.php index c5f472083dc..6ef0b382feb 100644 --- a/tests/php/Listener/RestrictStartingCallsTest.php +++ b/tests/php/Listener/RestrictStartingCallsTest.php @@ -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; diff --git a/tests/php/Model/AttendeeMapperTest.php b/tests/php/Model/AttendeeMapperTest.php index bf8a9b11b8f..54884ace207 100644 --- a/tests/php/Model/AttendeeMapperTest.php +++ b/tests/php/Model/AttendeeMapperTest.php @@ -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; diff --git a/tests/php/Notification/NotifierTest.php b/tests/php/Notification/NotifierTest.php index eeb202d3a53..2b508bf00b7 100644 --- a/tests/php/Notification/NotifierTest.php +++ b/tests/php/Notification/NotifierTest.php @@ -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()) @@ -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()) @@ -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); diff --git a/tests/php/Recording/BackendNotifierTest.php b/tests/php/Recording/BackendNotifierTest.php index 5dd320441dd..e2633943378 100644 --- a/tests/php/Recording/BackendNotifierTest.php +++ b/tests/php/Recording/BackendNotifierTest.php @@ -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; @@ -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; diff --git a/tests/php/Service/AvatarServiceTest.php b/tests/php/Service/AvatarServiceTest.php index 00af8faf780..019ed562acf 100644 --- a/tests/php/Service/AvatarServiceTest.php +++ b/tests/php/Service/AvatarServiceTest.php @@ -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; diff --git a/tests/php/Service/EmojiServiceTest.php b/tests/php/Service/EmojiServiceTest.php index cb5e5a368b1..725d2bd6618 100644 --- a/tests/php/Service/EmojiServiceTest.php +++ b/tests/php/Service/EmojiServiceTest.php @@ -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; diff --git a/tests/php/Service/ParticipantServiceTest.php b/tests/php/Service/ParticipantServiceTest.php index a024502ed0b..10810697341 100644 --- a/tests/php/Service/ParticipantServiceTest.php +++ b/tests/php/Service/ParticipantServiceTest.php @@ -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; diff --git a/tests/php/Service/ProxyCacheMessageServiceTest.php b/tests/php/Service/ProxyCacheMessageServiceTest.php index d73fc0e98b2..9a924ca7e14 100644 --- a/tests/php/Service/ProxyCacheMessageServiceTest.php +++ b/tests/php/Service/ProxyCacheMessageServiceTest.php @@ -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; diff --git a/tests/php/Service/RoomServiceTest.php b/tests/php/Service/RoomServiceTest.php index 1ed613eaef1..2939adb119e 100644 --- a/tests/php/Service/RoomServiceTest.php +++ b/tests/php/Service/RoomServiceTest.php @@ -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; diff --git a/tests/php/Service/SessionServiceTest.php b/tests/php/Service/SessionServiceTest.php index 08e8a0c9007..04c9bcbd3a6 100644 --- a/tests/php/Service/SessionServiceTest.php +++ b/tests/php/Service/SessionServiceTest.php @@ -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; diff --git a/tests/php/Signaling/ListenerTest.php b/tests/php/Signaling/ListenerTest.php index 1c767b357da..db2e4464f94 100644 --- a/tests/php/Signaling/ListenerTest.php +++ b/tests/php/Signaling/ListenerTest.php @@ -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; @@ -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);