Files
Côme Chilliet 8dcea8a500 fix: Harmonize namepsaces in tests
There was a weird inconsistent mix of Test\, Tests\lib, Test\Core,
 Tests\Core and Core\.
Now there is only Test\ for tests/lib/ and Tests\Core for tests/Core.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-08-24 08:38:57 +02:00

49 lines
1.2 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Contacts\ContactsMenu;
use OC\Contacts\ContactsMenu\ActionFactory;
use OCP\Contacts\ContactsMenu\IAction;
use Test\TestCase;
class ActionFactoryTest extends TestCase {
private ActionFactory $actionFactory;
#[\Override]
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());
}
}