0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-12 23:47:25 +00:00
nextcloud_server/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php
Andy Scherzinger 1f7e2ba599
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-13 17:41:36 +02:00

47 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() {
$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() {
$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());
}
}