0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-29 00:18:42 +00:00
nextcloud_server/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php
Christoph Wurst 49dd79eabb
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 22:32:31 +02:00

48 lines
1.2 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Tests\Contacts\ContactsMenu;
use OC\Contacts\ContactsMenu\ActionFactory;
use OCP\Contacts\ContactsMenu\IAction;
use Test\TestCase;
class ActionFactoryTest extends TestCase {
private ActionFactory $actionFactory;
protected function setUp(): void {
parent::setUp();
$this->actionFactory = new ActionFactory();
}
public function testNewLinkAction(): void {
$icon = 'icon-test';
$name = 'Test';
$href = 'some/url';
$action = $this->actionFactory->newLinkAction($icon, $name, $href);
$this->assertInstanceOf(IAction::class, $action);
$this->assertEquals($name, $action->getName());
$this->assertEquals(10, $action->getPriority());
}
public function testNewEMailAction(): void {
$icon = 'icon-test';
$name = 'Test';
$href = 'user@example.com';
$action = $this->actionFactory->newEMailAction($icon, $name, $href);
$this->assertInstanceOf(IAction::class, $action);
$this->assertEquals($name, $action->getName());
$this->assertEquals(10, $action->getPriority());
$this->assertEquals('mailto:user@example.com', $action->getHref());
}
}