aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Activity/ManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Activity/ManagerTest.php')
-rw-r--r--tests/lib/Activity/ManagerTest.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php
index f42a38eab53..db0bedce359 100644
--- a/tests/lib/Activity/ManagerTest.php
+++ b/tests/lib/Activity/ManagerTest.php
@@ -9,6 +9,8 @@
namespace Test\Activity;
use OCP\Activity\Exceptions\IncompleteActivityException;
+use OCP\Activity\IConsumer;
+use OCP\Activity\IEvent;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
@@ -86,11 +88,11 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider getUserFromTokenThrowInvalidTokenData
*
* @param string $token
* @param array $users
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getUserFromTokenThrowInvalidTokenData')]
public function testGetUserFromTokenThrowInvalidToken($token, $users): void {
$this->expectException(\UnexpectedValueException::class);
@@ -107,12 +109,12 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider getUserFromTokenData
*
* @param string $userLoggedIn
* @param string $token
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('getUserFromTokenData')]
public function testGetUserFromToken($userLoggedIn, $token, $expected): void {
if ($userLoggedIn !== null) {
$this->mockUserSession($userLoggedIn);
@@ -198,10 +200,10 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider dataPublish
* @param string|null $author
* @param string $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataPublish')]
public function testPublish($author, $expected): void {
if ($author !== null) {
$authorObject = $this->getMockBuilder(IUser::class)
@@ -228,7 +230,7 @@ class ManagerTest extends TestCase {
$consumer->expects($this->once())
->method('receive')
->with($event)
- ->willReturnCallback(function (\OCP\Activity\IEvent $event) use ($expected) {
+ ->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');
$this->assertSame($expected, $event->getAuthor(), 'Author name not set correctly');
@@ -258,7 +260,7 @@ class ManagerTest extends TestCase {
->getMock();
$consumer->expects($this->once())
->method('receive')
- ->willReturnCallback(function (\OCP\Activity\IEvent $event) {
+ ->willReturnCallback(function (IEvent $event): void {
$this->assertSame('test_app', $event->getApp(), 'App not set correctly');
$this->assertSame('test_type', $event->getType(), 'Type not set correctly');
$this->assertSame('test_affected', $event->getAffectedUser(), 'Affected user not set correctly');
@@ -281,7 +283,7 @@ class ManagerTest extends TestCase {
}
}
-class NoOpConsumer implements \OCP\Activity\IConsumer {
- public function receive(\OCP\Activity\IEvent $event) {
+class NoOpConsumer implements IConsumer {
+ public function receive(IEvent $event) {
}
}