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 /apps/updatenotification | |
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 'apps/updatenotification')
-rw-r--r-- | apps/updatenotification/tests/Settings/AdminTest.php | 115 |
1 files changed, 6 insertions, 109 deletions
diff --git a/apps/updatenotification/tests/Settings/AdminTest.php b/apps/updatenotification/tests/Settings/AdminTest.php index b39cb8fe127..ed0b12ab10f 100644 --- a/apps/updatenotification/tests/Settings/AdminTest.php +++ b/apps/updatenotification/tests/Settings/AdminTest.php @@ -8,7 +8,6 @@ declare(strict_types=1); */ namespace OCA\UpdateNotification\Tests\Settings; -use OC\User\Backend; use OCA\UpdateNotification\Settings\Admin; use OCA\UpdateNotification\UpdateChecker; use OCP\AppFramework\Http\TemplateResponse; @@ -22,8 +21,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; use OCP\L10N\ILanguageIterator; use OCP\Support\Subscription\IRegistry; -use OCP\User\Backend\ICountUsersBackend; -use OCP\UserInterface; use OCP\Util; use Psr\Log\LoggerInterface; use Test\TestCase; @@ -81,42 +78,10 @@ class AdminTest extends TestCase { } public function testGetFormWithUpdate(): void { - $backend1 = $this->createMock(CountUsersBackend::class); - $backend2 = $this->createMock(CountUsersBackend::class); - $backend3 = $this->createMock(CountUsersBackend::class); - $backend1 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(false); - $backend2 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend3 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend1 - ->expects($this->never()) - ->method('countUsers'); - $backend2 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(false); - $backend3 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(5); $this->userManager ->expects($this->once()) - ->method('getBackends') - ->with() - ->willReturn([$backend1, $backend2, $backend3]); + ->method('countUsersTotal') + ->willReturn(5); $channels = [ 'daily', 'beta', @@ -207,42 +172,10 @@ class AdminTest extends TestCase { } public function testGetFormWithUpdateAndChangedUpdateServer(): void { - $backend1 = $this->createMock(CountUsersBackend::class); - $backend2 = $this->createMock(CountUsersBackend::class); - $backend3 = $this->createMock(CountUsersBackend::class); - $backend1 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(false); - $backend2 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend3 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend1 - ->expects($this->never()) - ->method('countUsers'); - $backend2 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(false); - $backend3 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(5); $this->userManager ->expects($this->once()) - ->method('getBackends') - ->with() - ->willReturn([$backend1, $backend2, $backend3]); + ->method('countUsersTotal') + ->willReturn(5); $channels = [ 'daily', 'beta', @@ -334,42 +267,10 @@ class AdminTest extends TestCase { } public function testGetFormWithUpdateAndCustomersUpdateServer(): void { - $backend1 = $this->createMock(CountUsersBackend::class); - $backend2 = $this->createMock(CountUsersBackend::class); - $backend3 = $this->createMock(CountUsersBackend::class); - $backend1 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(false); - $backend2 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend3 - ->expects($this->once()) - ->method('implementsActions') - ->with(Backend::COUNT_USERS) - ->willReturn(true); - $backend1 - ->expects($this->never()) - ->method('countUsers'); - $backend2 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(false); - $backend3 - ->expects($this->once()) - ->method('countUsers') - ->with() - ->willReturn(5); $this->userManager ->expects($this->once()) - ->method('getBackends') - ->with() - ->willReturn([$backend1, $backend2, $backend3]); + ->method('countUsersTotal') + ->willReturn(5); $channels = [ 'daily', 'beta', @@ -543,7 +444,3 @@ class AdminTest extends TestCase { $this->assertSame($expectation, $result); } } - -abstract class CountUsersBackend implements UserInterface, ICountUsersBackend { - -} |