diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2025-06-13 09:10:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-13 09:10:09 +0200 |
commit | 7be047a5c08d4401899d38c9a7d7ebdb6d8e78b2 (patch) | |
tree | 70348117aaae719bd278f4476afe6563ee16aa14 /tests/lib/Avatar | |
parent | 1f0086ff6b49c31facd7cb13921725142b47409f (diff) | |
parent | 3561937816578a699008c010829142a01580e7bf (diff) | |
download | nextcloud-server-master.tar.gz nextcloud-server-master.zip |
Diffstat (limited to 'tests/lib/Avatar')
-rw-r--r-- | tests/lib/Avatar/UserAvatarTest.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 633a0fda368..ead829c231c 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -7,8 +7,10 @@ namespace Test\Avatar; +use OC\Avatar\UserAvatar; use OC\Files\SimpleFS\SimpleFolder; use OC\User\User; +use OCP\Color; use OCP\Files\File; use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFile; @@ -56,7 +58,7 @@ class UserAvatarTest extends \Test\TestCase { ->willReturn($file); $this->folder->method('getFile') - ->willReturnCallback(function (string $path) { + ->willReturnCallback(function (string $path): void { if ($path === 'avatar.64.png') { throw new NotFoundException(); } @@ -144,7 +146,7 @@ class UserAvatarTest extends \Test\TestCase { if ($path === 'avatar.png') { return $file; } else { - throw new \OCP\Files\NotFoundException; + throw new NotFoundException; } } ); @@ -261,17 +263,17 @@ class UserAvatarTest extends \Test\TestCase { } public function testMixPalette(): void { - $colorFrom = new \OCP\Color(0, 0, 0); - $colorTo = new \OCP\Color(6, 12, 18); + $colorFrom = new Color(0, 0, 0); + $colorTo = new Color(6, 12, 18); $steps = 6; - $palette = \OCP\Color::mixPalette($steps, $colorFrom, $colorTo); + $palette = Color::mixPalette($steps, $colorFrom, $colorTo); foreach ($palette as $j => $color) { // calc increment $incR = $colorTo->red() / $steps * $j; $incG = $colorTo->green() / $steps * $j; $incB = $colorTo->blue() / $steps * $j; // ensure everything is equal - $this->assertEquals($color, new \OCP\Color($incR, $incG, $incB)); + $this->assertEquals($color, new Color($incR, $incG, $incB)); } $hashToInt = $this->invokePrivate($this->avatar, 'hashToInt', ['abcdef', 18]); $this->assertTrue(gettype($hashToInt) === 'integer'); @@ -288,7 +290,7 @@ class UserAvatarTest extends \Test\TestCase { $l = $this->createMock(IL10N::class); $l->method('t')->willReturnArgument(0); - return new \OC\Avatar\UserAvatar( + return new UserAvatar( $this->folder, $l, $user, |