AvatarNodeTest.php 933 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2017 ownCloud GmbH
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Tests\Unit\Avatars;
  8. use OCA\DAV\Avatars\AvatarNode;
  9. use OCP\IAvatar;
  10. use Test\TestCase;
  11. class AvatarNodeTest extends TestCase {
  12. public function testGetName(): void {
  13. /** @var IAvatar | \PHPUnit\Framework\MockObject\MockObject $a */
  14. $a = $this->createMock(IAvatar::class);
  15. $n = new AvatarNode(1024, 'png', $a);
  16. $this->assertEquals('1024.png', $n->getName());
  17. }
  18. public function testGetContentType(): void {
  19. /** @var IAvatar | \PHPUnit\Framework\MockObject\MockObject $a */
  20. $a = $this->createMock(IAvatar::class);
  21. $n = new AvatarNode(1024, 'png', $a);
  22. $this->assertEquals('image/png', $n->getContentType());
  23. $n = new AvatarNode(1024, 'jpeg', $a);
  24. $this->assertEquals('image/jpeg', $n->getContentType());
  25. }
  26. }