diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-01-14 16:34:15 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2025-01-14 16:34:15 +0100 |
commit | db94aeb96ebaa91f66af4b1a08f5c7bb0933552c (patch) | |
tree | ff036d5ff61e02894e1b7d4234397b53534f33b2 /tests/lib | |
parent | 17887d7e745761a572f2fcf65416a833db91f605 (diff) | |
download | nextcloud-server-db94aeb96ebaa91f66af4b1a08f5c7bb0933552c.tar.gz nextcloud-server-db94aeb96ebaa91f66af4b1a08f5c7bb0933552c.zip |
chore(tests): Adapt tests to the countUsers refactor
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Support/Subscription/RegistryTest.php | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php index 869c1498c41..b3a0f8e603e 100644 --- a/tests/lib/Support/Subscription/RegistryTest.php +++ b/tests/lib/Support/Subscription/RegistryTest.php @@ -8,7 +8,6 @@ namespace Test\Support\Subscription; use OC\Support\Subscription\Registry; -use OC\User\Database; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; @@ -17,33 +16,19 @@ use OCP\IUserManager; use OCP\Notification\IManager; use OCP\Support\Subscription\ISubscription; use OCP\Support\Subscription\ISupportedApps; -use OCP\User\Backend\ICountUsersBackend; -use OCP\UserInterface; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\TestCase; class RegistryTest extends TestCase { - /** @var Registry */ - private $registry; + private Registry $registry; - /** @var MockObject|IConfig */ - private $config; - - /** @var MockObject|IServerContainer */ - private $serverContainer; - - /** @var MockObject|IUserManager */ - private $userManager; - - /** @var MockObject|IGroupManager */ - private $groupManager; - - /** @var MockObject|LoggerInterface */ - private $logger; - - /** @var MockObject|IManager */ - private $notificationManager; + private MockObject&IConfig $config; + private MockObject&IServerContainer $serverContainer; + private MockObject&IUserManager $userManager; + private MockObject&IGroupManager $groupManager; + private MockObject&LoggerInterface $logger; + private MockObject&IManager $notificationManager; protected function setUp(): void { parent::setUp(); @@ -198,17 +183,9 @@ class RegistryTest extends TestCase { ->method('getUsersForUserValue') ->with('core', 'enabled', 'false') ->willReturn(array_fill(0, $disabledUsers, '')); - /* @var UserInterface|ICountUsersBackend|\PHPUnit\Framework\MockObject\MockObject $dummyBackend */ - $dummyBackend = $this->createMock(Database::class); - $dummyBackend->expects($this->once()) - ->method('implementsActions') - ->willReturn(true); - $dummyBackend->expects($this->once()) - ->method('countUsers') - ->willReturn($userCount); $this->userManager->expects($this->once()) - ->method('getBackends') - ->willReturn([$dummyBackend]); + ->method('countUsersTotal') + ->willReturn($userCount); if ($expectedResult) { $dummyGroup = $this->createMock(IGroup::class); |