aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Notification/ActionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Notification/ActionTest.php')
-rw-r--r--tests/lib/Notification/ActionTest.php67
1 files changed, 27 insertions, 40 deletions
diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php
index 6016760c24f..252819f1e29 100644
--- a/tests/lib/Notification/ActionTest.php
+++ b/tests/lib/Notification/ActionTest.php
@@ -1,22 +1,9 @@
<?php
+
/**
- * @author Joas Schilling <nickvergessen@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace Test\Notification;
@@ -34,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)],
@@ -43,16 +30,16 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabel
* @param string $label
*/
- public function testSetLabel($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)],
@@ -60,17 +47,17 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLabelInvalid
* @param mixed $label
*
*/
- public function testSetLabelInvalid($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)],
@@ -79,33 +66,33 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetParsedLabel
* @param string $label
*/
- public function testSetParsedLabel($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
*
*/
- public function testSetParsedLabelInvalid($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'],
@@ -115,18 +102,18 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLink
* @param string $link
* @param string $type
*/
- public function testSetLink($link, $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));
$this->assertSame($link, $this->action->getLink());
$this->assertSame($type, $this->action->getRequestType());
}
- public function dataSetLinkInvalid() {
+ public static function dataSetLinkInvalid(): array {
return [
// Invalid link
['', 'GET'],
@@ -138,18 +125,18 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetLinkInvalid
* @param mixed $link
* @param mixed $type
*
*/
- public function testSetLinkInvalid($link, $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],
@@ -157,16 +144,16 @@ class ActionTest extends TestCase {
}
/**
- * @dataProvider dataSetPrimary
* @param bool $primary
*/
- public function testSetPrimary($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));
$this->assertSame($primary, $this->action->isPrimary());
}
- public function testIsValid() {
+ public function testIsValid(): void {
$this->assertFalse($this->action->isValid());
$this->assertFalse($this->action->isValidParsed());
$this->action->setLabel('label');
@@ -177,7 +164,7 @@ class ActionTest extends TestCase {
$this->assertFalse($this->action->isValidParsed());
}
- public function testIsValidParsed() {
+ public function testIsValidParsed(): void {
$this->assertFalse($this->action->isValid());
$this->assertFalse($this->action->isValidParsed());
$this->action->setParsedLabel('label');