diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Avatar/AvatarManagerTest.php | 2 | ||||
-rw-r--r-- | tests/lib/Avatar/GuestAvatarTest.php | 5 | ||||
-rw-r--r-- | tests/lib/Avatar/UserAvatarTest.php | 18 |
3 files changed, 10 insertions, 15 deletions
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php index 23d3b9d1c2a..495d7099d59 100644 --- a/tests/lib/Avatar/AvatarManagerTest.php +++ b/tests/lib/Avatar/AvatarManagerTest.php @@ -269,7 +269,7 @@ class AvatarManagerTest extends \Test\TestCase { } if ($expectedPlaceholder) { - $expected = new PlaceholderAvatar($folder, $user, $this->createMock(LoggerInterface::class)); + $expected = new PlaceholderAvatar($folder, $user, $this->config, $this->logger); } else { $expected = new UserAvatar($folder, $this->l10n, $user, $this->logger, $this->config); } diff --git a/tests/lib/Avatar/GuestAvatarTest.php b/tests/lib/Avatar/GuestAvatarTest.php index 8188684b51f..b49fcea6ed2 100644 --- a/tests/lib/Avatar/GuestAvatarTest.php +++ b/tests/lib/Avatar/GuestAvatarTest.php @@ -34,8 +34,9 @@ class GuestAvatarTest extends TestCase { */ public function setupGuestAvatar() { /* @var MockObject|LoggerInterface $logger */ - $logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); - $this->guestAvatar = new GuestAvatar('einstein', $logger); + $logger = $this->createMock(LoggerInterface::class); + $config = $this->createMock(\OCP\IConfig::class); + $this->guestAvatar = new GuestAvatar('einstein', $config, $logger); } /** diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 03a868c7854..1ca3b8135cc 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -18,20 +18,15 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\IConfig; use OCP\IL10N; use OCP\Image; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class UserAvatarTest extends \Test\TestCase { - /** @var SimpleFolder | \PHPUnit\Framework\MockObject\MockObject */ - private $folder; - /** @var \OC\Avatar\UserAvatar */ - private $avatar; - - /** @var User|\PHPUnit\Framework\MockObject\MockObject $user */ - private $user; - - /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ - private $config; + private UserAvatar $avatar; + private SimpleFolder&MockObject $folder; + private IConfig&MockObject $config; + private User&MockObject $user; protected function setUp(): void { parent::setUp(); @@ -236,7 +231,7 @@ class UserAvatarTest extends \Test\TestCase { } public function testGenerateSvgAvatar(): void { - $avatar = $this->invokePrivate($this->avatar, 'getAvatarVector', [64, false]); + $avatar = $this->invokePrivate($this->avatar, 'getAvatarVector', [$this->user->getDisplayName(), 64, false]); $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="64" height="64" version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"> @@ -246,7 +241,6 @@ class UserAvatarTest extends \Test\TestCase { $this->assertEquals($avatar, $svg); } - #[\PHPUnit\Framework\Attributes\DataProvider('avatarTextData')] public function testGetAvatarText($displayName, $expectedAvatarText): void { $user = $this->getUserWithDisplayName($displayName); |