mirror of
https://github.com/nextcloud/server.git
synced 2024-12-29 00:18:42 +00:00
49dd79eabb
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
48 lines
1.2 KiB
PHP
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());
|
|
}
|
|
}
|