aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Notification
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Notification')
-rw-r--r--tests/lib/Notification/ActionTest.php29
-rw-r--r--tests/lib/Notification/ManagerTest.php12
-rw-r--r--tests/lib/Notification/NotificationTest.php156
3 files changed, 98 insertions, 99 deletions
diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php
index 3ae4b1db7e7..252819f1e29 100644
--- a/tests/lib/Notification/ActionTest.php
+++ b/tests/lib/Notification/ActionTest.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -20,7 +21,7 @@ class ActionTest extends TestCase {
$this->action = new Action();
}
- public function dataSetLabel() {
+ public static function dataSetLabel(): array {
return [
['test1'],
[str_repeat('a', 1)],
@@ -29,16 +30,16 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabel
* @param string $label
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLabel')]
public function testSetLabel($label): void {
$this->assertSame('', $this->action->getLabel());
$this->assertSame($this->action, $this->action->setLabel($label));
$this->assertSame($label, $this->action->getLabel());
}
- public function dataSetLabelInvalid() {
+ public static function dataSetLabelInvalid(): array {
return [
[''],
[str_repeat('a', 33)],
@@ -46,17 +47,17 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabelInvalid
* @param mixed $label
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLabelInvalid')]
public function testSetLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setLabel($label);
}
- public function dataSetParsedLabel() {
+ public static function dataSetParsedLabel(): array {
return [
['test1'],
[str_repeat('a', 1)],
@@ -65,33 +66,33 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedLabel
* @param string $label
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedLabel')]
public function testSetParsedLabel($label): void {
$this->assertSame('', $this->action->getParsedLabel());
$this->assertSame($this->action, $this->action->setParsedLabel($label));
$this->assertSame($label, $this->action->getParsedLabel());
}
- public function dataSetParsedLabelInvalid() {
+ public static function dataSetParsedLabelInvalid(): array {
return [
[''],
];
}
/**
- * @dataProvider dataSetParsedLabelInvalid
* @param mixed $label
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedLabelInvalid')]
public function testSetParsedLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setParsedLabel($label);
}
- public function dataSetLink() {
+ public static function dataSetLink(): array {
return [
['test1', 'GET'],
['test2', 'POST'],
@@ -101,10 +102,10 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLink
* @param string $link
* @param string $type
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLink')]
public function testSetLink($link, $type): void {
$this->assertSame('', $this->action->getLink());
$this->assertSame($this->action, $this->action->setLink($link, $type));
@@ -112,7 +113,7 @@ class ActionTest extends TestCase {
$this->assertSame($type, $this->action->getRequestType());
}
- public function dataSetLinkInvalid() {
+ public static function dataSetLinkInvalid(): array {
return [
// Invalid link
['', 'GET'],
@@ -124,18 +125,18 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLinkInvalid
* @param mixed $link
* @param mixed $type
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLinkInvalid')]
public function testSetLinkInvalid($link, $type): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setLink($link, $type);
}
- public function dataSetPrimary() {
+ public static function dataSetPrimary(): array {
return [
[true],
[false],
@@ -143,9 +144,9 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetPrimary
* @param bool $primary
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetPrimary')]
public function testSetPrimary($primary): void {
$this->assertSame(false, $this->action->isPrimary());
$this->assertSame($this->action, $this->action->setPrimary($primary));
diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php
index 2a85316d7c4..cbd76989d24 100644
--- a/tests/lib/Notification/ManagerTest.php
+++ b/tests/lib/Notification/ManagerTest.php
@@ -153,7 +153,7 @@ class ManagerTest extends TestCase {
$this->coordinator,
$this->richTextFormatter,
])
- ->setMethods(['getApps'])
+ ->onlyMethods(['getApps'])
->getMock();
$manager->expects($this->once())
@@ -185,7 +185,7 @@ class ManagerTest extends TestCase {
$this->coordinator,
$this->richTextFormatter,
])
- ->setMethods(['getApps'])
+ ->onlyMethods(['getApps'])
->getMock();
$manager->expects($this->never())
@@ -210,7 +210,7 @@ class ManagerTest extends TestCase {
$this->coordinator,
$this->richTextFormatter,
])
- ->setMethods(['getApps'])
+ ->onlyMethods(['getApps'])
->getMock();
$manager->expects($this->once())
@@ -236,7 +236,7 @@ class ManagerTest extends TestCase {
$this->coordinator,
$this->richTextFormatter,
])
- ->setMethods(['getApps'])
+ ->onlyMethods(['getApps'])
->getMock();
$manager->expects($this->once())
@@ -246,7 +246,7 @@ class ManagerTest extends TestCase {
$manager->getCount($notification);
}
- public function dataIsFairUseOfFreePushService(): array {
+ public static function dataIsFairUseOfFreePushService(): array {
return [
[true, 999, true],
[true, 1000, true],
@@ -256,11 +256,11 @@ class ManagerTest extends TestCase {
}
/**
- * @dataProvider dataIsFairUseOfFreePushService
* @param bool $hasValidSubscription
* @param int $userCount
* @param bool $isFair
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsFairUseOfFreePushService')]
public function testIsFairUseOfFreePushService(bool $hasValidSubscription, int $userCount, bool $isFair): void {
$this->subscriptionRegistry->method('delegateHasValidSubscription')
->willReturn($hasValidSubscription);
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index 957d74233be..cebe9d51021 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -30,7 +30,7 @@ class NotificationTest extends TestCase {
$this->notification = new Notification($this->validator, $this->richTextFormatter);
}
- protected function dataValidString($maxLength) {
+ protected static function dataValidString($maxLength): array {
$dataSets = [
['test1'],
['1564'],
@@ -42,7 +42,7 @@ class NotificationTest extends TestCase {
return $dataSets;
}
- protected function dataInvalidString($maxLength) {
+ protected static function dataInvalidString($maxLength): array {
$dataSets = [
['']
];
@@ -52,29 +52,29 @@ class NotificationTest extends TestCase {
return $dataSets;
}
- public function dataSetApp() {
- return $this->dataValidString(32);
+ public static function dataSetApp(): array {
+ return self::dataValidString(32);
}
/**
- * @dataProvider dataSetApp
* @param string $app
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetApp')]
public function testSetApp($app): void {
$this->assertSame('', $this->notification->getApp());
$this->assertSame($this->notification, $this->notification->setApp($app));
$this->assertSame($app, $this->notification->getApp());
}
- public function dataSetAppInvalid() {
- return $this->dataInvalidString(32);
+ public static function dataSetAppInvalid(): array {
+ return self::dataInvalidString(32);
}
/**
- * @dataProvider dataSetAppInvalid
* @param mixed $app
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetAppInvalid')]
public function testSetAppInvalid($app): void {
$this->expectException(\InvalidArgumentException::class);
@@ -82,36 +82,36 @@ class NotificationTest extends TestCase {
}
- public function dataSetUser() {
- return $this->dataValidString(64);
+ public static function dataSetUser(): array {
+ return self::dataValidString(64);
}
/**
- * @dataProvider dataSetUser
* @param string $user
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUser')]
public function testSetUser($user): void {
$this->assertSame('', $this->notification->getUser());
$this->assertSame($this->notification, $this->notification->setUser($user));
$this->assertSame($user, $this->notification->getUser());
}
- public function dataSetUserInvalid() {
- return $this->dataInvalidString(64);
+ public static function dataSetUserInvalid(): array {
+ return self::dataInvalidString(64);
}
/**
- * @dataProvider dataSetUserInvalid
* @param mixed $user
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetUserInvalid')]
public function testSetUserInvalid($user): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setUser($user);
}
- public function dataSetDateTime() {
+ public static function dataSetDateTime(): array {
$past = new \DateTime();
$past->sub(new \DateInterval('P1Y'));
$current = new \DateTime();
@@ -126,16 +126,16 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetDateTime
* @param \DateTime $dateTime
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDateTime')]
public function testSetDateTime(\DateTime $dateTime): void {
$this->assertSame(0, $this->notification->getDateTime()->getTimestamp());
$this->assertSame($this->notification, $this->notification->setDateTime($dateTime));
$this->assertSame($dateTime, $this->notification->getDateTime());
}
- public function dataSetDateTimeZero() {
+ public static function dataSetDateTimeZero(): array {
$nineTeenSeventy = new \DateTime();
$nineTeenSeventy->setTimestamp(0);
return [
@@ -144,18 +144,17 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetDateTimeZero
* @param \DateTime $dateTime
- *
* @expectedMessage 'The given date time is invalid'
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDateTimeZero')]
public function testSetDateTimeZero($dateTime): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setDateTime($dateTime);
}
- public function dataSetObject() {
+ public static function dataSetObject(): array {
return [
['a', '21'],
[str_repeat('a', 64), '42'],
@@ -163,10 +162,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetObject
* @param string $type
* @param string $id
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetObject')]
public function testSetObject($type, $id): void {
$this->assertSame('', $this->notification->getObjectType());
$this->assertSame('', $this->notification->getObjectId());
@@ -175,11 +174,11 @@ class NotificationTest extends TestCase {
$this->assertSame($id, $this->notification->getObjectId());
}
- public function dataSetObjectTypeInvalid() {
- return $this->dataInvalidString(64);
+ public static function dataSetObjectTypeInvalid(): array {
+ return self::dataInvalidString(64);
}
- public function dataSetObjectIdInvalid() {
+ public static function dataSetObjectIdInvalid(): array {
return [
[''],
[str_repeat('a', 64 + 1)],
@@ -187,18 +186,17 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetObjectIdInvalid
* @param mixed $id
- *
* @expectedMessage 'The given object id is invalid'
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetObjectIdInvalid')]
public function testSetObjectIdInvalid($id): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setObject('object', $id);
}
- public function dataSetSubject() {
+ public static function dataSetSubject(): array {
return [
['a', []],
[str_repeat('a', 64), [str_repeat('a', 160)]],
@@ -207,10 +205,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetSubject
* @param string $subject
* @param array $parameters
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubject')]
public function testSetSubject($subject, $parameters): void {
$this->assertSame('', $this->notification->getSubject());
$this->assertSame([], $this->notification->getSubjectParameters());
@@ -219,51 +217,51 @@ class NotificationTest extends TestCase {
$this->assertSame($parameters, $this->notification->getSubjectParameters());
}
- public function dataSetSubjectInvalidSubject() {
- return $this->dataInvalidString(64);
+ public static function dataSetSubjectInvalidSubject(): array {
+ return self::dataInvalidString(64);
}
/**
- * @dataProvider dataSetSubjectInvalidSubject
* @param mixed $subject
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetSubjectInvalidSubject')]
public function testSetSubjectInvalidSubject($subject): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setSubject($subject, []);
}
- public function dataSetParsedSubject() {
- return $this->dataValidString(false);
+ public static function dataSetParsedSubject(): array {
+ return self::dataValidString(false);
}
/**
- * @dataProvider dataSetParsedSubject
* @param string $subject
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedSubject')]
public function testSetParsedSubject($subject): void {
$this->assertSame('', $this->notification->getParsedSubject());
$this->assertSame($this->notification, $this->notification->setParsedSubject($subject));
$this->assertSame($subject, $this->notification->getParsedSubject());
}
- public function dataSetParsedSubjectInvalid() {
- return $this->dataInvalidString(false);
+ public static function dataSetParsedSubjectInvalid(): array {
+ return self::dataInvalidString(false);
}
/**
- * @dataProvider dataSetParsedSubjectInvalid
* @param mixed $subject
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedSubjectInvalid')]
public function testSetParsedSubjectInvalid($subject): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setParsedSubject($subject);
}
- public function dataSetMessage() {
+ public static function dataSetMessage(): array {
return [
['a', []],
[str_repeat('a', 64), [str_repeat('a', 160)]],
@@ -272,10 +270,10 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataSetMessage
* @param string $message
* @param array $parameters
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetMessage')]
public function testSetMessage($message, $parameters): void {
$this->assertSame('', $this->notification->getMessage());
$this->assertSame([], $this->notification->getMessageParameters());
@@ -284,102 +282,102 @@ class NotificationTest extends TestCase {
$this->assertSame($parameters, $this->notification->getMessageParameters());
}
- public function dataSetMessageInvalidMessage() {
- return $this->dataInvalidString(64);
+ public static function dataSetMessageInvalidMessage(): array {
+ return self::dataInvalidString(64);
}
/**
- * @dataProvider dataSetMessageInvalidMessage
* @param mixed $message
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetMessageInvalidMessage')]
public function testSetMessageInvalidMessage($message): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setMessage($message, []);
}
- public function dataSetParsedMessage() {
- return $this->dataValidString(false);
+ public static function dataSetParsedMessage(): array {
+ return self::dataValidString(false);
}
/**
- * @dataProvider dataSetParsedMessage
* @param string $message
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedMessage')]
public function testSetParsedMessage($message): void {
$this->assertSame('', $this->notification->getParsedMessage());
$this->assertSame($this->notification, $this->notification->setParsedMessage($message));
$this->assertSame($message, $this->notification->getParsedMessage());
}
- public function dataSetParsedMessageInvalid() {
- return $this->dataInvalidString(false);
+ public static function dataSetParsedMessageInvalid(): array {
+ return self::dataInvalidString(false);
}
/**
- * @dataProvider dataSetParsedMessageInvalid
* @param mixed $message
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetParsedMessageInvalid')]
public function testSetParsedMessageInvalid($message): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setParsedMessage($message);
}
- public function dataSetLink() {
- return $this->dataValidString(4000);
+ public static function dataSetLink(): array {
+ return self::dataValidString(4000);
}
/**
- * @dataProvider dataSetLink
* @param string $link
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLink')]
public function testSetLink($link): void {
$this->assertSame('', $this->notification->getLink());
$this->assertSame($this->notification, $this->notification->setLink($link));
$this->assertSame($link, $this->notification->getLink());
}
- public function dataSetLinkInvalid() {
- return $this->dataInvalidString(4000);
+ public static function dataSetLinkInvalid(): array {
+ return self::dataInvalidString(4000);
}
/**
- * @dataProvider dataSetLinkInvalid
* @param mixed $link
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetLinkInvalid')]
public function testSetLinkInvalid($link): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setLink($link);
}
- public function dataSetIcon() {
- return $this->dataValidString(4000);
+ public static function dataSetIcon(): array {
+ return self::dataValidString(4000);
}
/**
- * @dataProvider dataSetIcon
* @param string $icon
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetIcon')]
public function testSetIcon($icon): void {
$this->assertSame('', $this->notification->getIcon());
$this->assertSame($this->notification, $this->notification->setIcon($icon));
$this->assertSame($icon, $this->notification->getIcon());
}
- public function dataSetIconInvalid() {
- return $this->dataInvalidString(4000);
+ public static function dataSetIconInvalid(): array {
+ return self::dataInvalidString(4000);
}
/**
- * @dataProvider dataSetIconInvalid
* @param mixed $icon
*
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataSetIconInvalid')]
public function testSetIconInvalid($icon): void {
$this->expectException(\InvalidArgumentException::class);
@@ -392,7 +390,7 @@ class NotificationTest extends TestCase {
}
public function testAddAction(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -410,7 +408,7 @@ class NotificationTest extends TestCase {
public function testAddActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValid')
@@ -422,7 +420,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondPrimary(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValid')
@@ -438,7 +436,7 @@ class NotificationTest extends TestCase {
}
public function testAddParsedAction(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -456,7 +454,7 @@ class NotificationTest extends TestCase {
public function testAddParsedActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
->method('isValidParsed')
@@ -468,7 +466,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionSecondParsedPrimary(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
->method('isValidParsed')
@@ -484,7 +482,7 @@ class NotificationTest extends TestCase {
}
public function testAddActionParsedPrimaryEnd(): void {
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action1 = $this->createMock(IAction::class);
$action1->expects($this->exactly(2))
->method('isValidParsed')
@@ -492,7 +490,7 @@ class NotificationTest extends TestCase {
$action1->expects($this->exactly(2))
->method('isPrimary')
->willReturn(false);
- /** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
+ /** @var IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action2 = $this->createMock(IAction::class);
$action2->expects($this->once())
->method('isValidParsed')
@@ -508,7 +506,7 @@ class NotificationTest extends TestCase {
$this->assertEquals([$action2, $action1, $action1], $this->notification->getParsedActions());
}
- public function dataIsValid() {
+ public static function dataIsValid(): array {
return [
[false, '', false],
[true, '', false],
@@ -518,16 +516,16 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValid
*
* @param bool $isValidCommon
* @param string $subject
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValid')]
public function testIsValid($isValidCommon, $subject, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
- ->setMethods([
+ ->onlyMethods([
'isValidCommon',
'getSubject',
'getParsedSubject',
@@ -551,16 +549,16 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValid
*
* @param bool $isValidCommon
* @param string $subject
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValid')]
public function testIsParsedValid($isValidCommon, $subject, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
- ->setMethods([
+ ->onlyMethods([
'isValidCommon',
'getParsedSubject',
'getSubject',
@@ -583,7 +581,7 @@ class NotificationTest extends TestCase {
$this->assertEquals($expected, $notification->isValidParsed());
}
- public function dataIsValidCommon() {
+ public static function dataIsValidCommon(): array {
return [
['', '', 0, '', '', false],
['app', '', 0, '', '', false],
@@ -595,7 +593,6 @@ class NotificationTest extends TestCase {
}
/**
- * @dataProvider dataIsValidCommon
*
* @param string $app
* @param string $user
@@ -604,10 +601,11 @@ class NotificationTest extends TestCase {
* @param string $objectId
* @param bool $expected
*/
+ #[\PHPUnit\Framework\Attributes\DataProvider('dataIsValidCommon')]
public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected): void {
- /** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
+ /** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
- ->setMethods([
+ ->onlyMethods([
'getApp',
'getUser',
'getDateTime',