aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php')
-rw-r--r--tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php56
1 files changed, 29 insertions, 27 deletions
diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
index ed6e9ace403..5e2b416a66b 100644
--- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
@@ -1,25 +1,8 @@
<?php
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Tests\Contacts\ContactsMenu\Actions;
@@ -28,7 +11,7 @@ use OC\Contacts\ContactsMenu\Actions\LinkAction;
use Test\TestCase;
class LinkActionTest extends TestCase {
- private $action;
+ private LinkAction $action;
protected function setUp(): void {
parent::setUp();
@@ -36,7 +19,7 @@ class LinkActionTest extends TestCase {
$this->action = new LinkAction();
}
- public function testSetIcon() {
+ public function testSetIcon(): void {
$icon = 'icon-test';
$this->action->setIcon($icon);
@@ -46,15 +29,15 @@ class LinkActionTest extends TestCase {
$this->assertEquals($json['icon'], $icon);
}
- public function testGetSetName() {
+ public function testGetSetName(): void {
$name = 'Jane Doe';
- $this->assertNull($this->action->getName());
+ $this->assertEmpty($this->action->getName());
$this->action->setName($name);
$this->assertEquals($name, $this->action->getName());
}
- public function testGetSetPriority() {
+ public function testGetSetPriority(): void {
$prio = 50;
$this->assertEquals(10, $this->action->getPriority());
@@ -62,23 +45,42 @@ class LinkActionTest extends TestCase {
$this->assertEquals($prio, $this->action->getPriority());
}
- public function testSetHref() {
+ public function testSetHref(): void {
$this->action->setHref('/some/url');
$json = $this->action->jsonSerialize();
$this->assertArrayHasKey('hyperlink', $json);
- $this->assertEquals($json['hyperlink'], '/some/url');
+ $this->assertEquals('/some/url', $json['hyperlink']);
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$this->action->setIcon('icon-contacts');
$this->action->setName('Nickie Works');
$this->action->setPriority(33);
$this->action->setHref('example.com');
+ $this->action->setAppId('contacts');
$expected = [
'title' => 'Nickie Works',
'icon' => 'icon-contacts',
'hyperlink' => 'example.com',
+ 'appId' => 'contacts',
+ ];
+
+ $json = $this->action->jsonSerialize();
+
+ $this->assertEquals($expected, $json);
+ }
+
+ public function testJsonSerializeNoAppName(): void {
+ $this->action->setIcon('icon-contacts');
+ $this->action->setName('Nickie Works');
+ $this->action->setPriority(33);
+ $this->action->setHref('example.com');
+ $expected = [
+ 'title' => 'Nickie Works',
+ 'icon' => 'icon-contacts',
+ 'hyperlink' => 'example.com',
+ 'appId' => '',
];
$json = $this->action->jsonSerialize();