1
0

CapabilitiesTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\UserStatus\Tests;
  8. use OCA\UserStatus\Capabilities;
  9. use OCP\IEmojiHelper;
  10. use Test\TestCase;
  11. class CapabilitiesTest extends TestCase {
  12. /** @var IEmojiHelper|\PHPUnit\Framework\MockObject\MockObject */
  13. private $emojiHelper;
  14. /** @var Capabilities */
  15. private $capabilities;
  16. protected function setUp(): void {
  17. parent::setUp();
  18. $this->emojiHelper = $this->createMock(IEmojiHelper::class);
  19. $this->capabilities = new Capabilities($this->emojiHelper);
  20. }
  21. /**
  22. * @param bool $supportsEmojis
  23. *
  24. * @dataProvider getCapabilitiesDataProvider
  25. */
  26. public function testGetCapabilities(bool $supportsEmojis): void {
  27. $this->emojiHelper->expects($this->once())
  28. ->method('doesPlatformSupportEmoji')
  29. ->willReturn($supportsEmojis);
  30. $this->assertEquals([
  31. 'user_status' => [
  32. 'enabled' => true,
  33. 'restore' => true,
  34. 'supports_emoji' => $supportsEmojis,
  35. ]
  36. ], $this->capabilities->getCapabilities());
  37. }
  38. public function getCapabilitiesDataProvider(): array {
  39. return [
  40. [true],
  41. [false],
  42. ];
  43. }
  44. }