1
0

ActionFactoryTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace Tests\Contacts\ContactsMenu;
  7. use OC\Contacts\ContactsMenu\ActionFactory;
  8. use OCP\Contacts\ContactsMenu\IAction;
  9. use Test\TestCase;
  10. class ActionFactoryTest extends TestCase {
  11. private ActionFactory $actionFactory;
  12. protected function setUp(): void {
  13. parent::setUp();
  14. $this->actionFactory = new ActionFactory();
  15. }
  16. public function testNewLinkAction(): void {
  17. $icon = 'icon-test';
  18. $name = 'Test';
  19. $href = 'some/url';
  20. $action = $this->actionFactory->newLinkAction($icon, $name, $href);
  21. $this->assertInstanceOf(IAction::class, $action);
  22. $this->assertEquals($name, $action->getName());
  23. $this->assertEquals(10, $action->getPriority());
  24. }
  25. public function testNewEMailAction(): void {
  26. $icon = 'icon-test';
  27. $name = 'Test';
  28. $href = 'user@example.com';
  29. $action = $this->actionFactory->newEMailAction($icon, $name, $href);
  30. $this->assertInstanceOf(IAction::class, $action);
  31. $this->assertEquals($name, $action->getName());
  32. $this->assertEquals(10, $action->getPriority());
  33. $this->assertEquals('mailto:user@example.com', $action->getHref());
  34. }
  35. }