SectionTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\User_LDAP\Tests\Settings;
  7. use OCA\User_LDAP\Settings\Section;
  8. use OCP\IL10N;
  9. use OCP\IURLGenerator;
  10. use Test\TestCase;
  11. class SectionTest extends TestCase {
  12. /** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
  13. private $url;
  14. /** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
  15. private $l;
  16. /** @var Section */
  17. private $section;
  18. protected function setUp(): void {
  19. parent::setUp();
  20. $this->url = $this->createMock(IURLGenerator::class);
  21. $this->l = $this->createMock(IL10N::class);
  22. $this->section = new Section(
  23. $this->url,
  24. $this->l
  25. );
  26. }
  27. public function testGetID(): void {
  28. $this->assertSame('ldap', $this->section->getID());
  29. }
  30. public function testGetName(): void {
  31. $this->l
  32. ->expects($this->once())
  33. ->method('t')
  34. ->with('LDAP/AD integration')
  35. ->willReturn('LDAP/AD integration');
  36. $this->assertSame('LDAP/AD integration', $this->section->getName());
  37. }
  38. public function testGetPriority(): void {
  39. $this->assertSame(25, $this->section->getPriority());
  40. }
  41. public function testGetIcon(): void {
  42. $this->url->expects($this->once())
  43. ->method('imagePath')
  44. ->with('user_ldap', 'app-dark.svg')
  45. ->willReturn('icon');
  46. $this->assertSame('icon', $this->section->getIcon());
  47. }
  48. }